1.93K subscribers
3.51K photos
136 videos
15 files
3.73K links
Блог со звёздочкой.

Много репостов, немножко программирования.

Небольшое прикольное комьюнити: @decltype_chat_ptr_t
Автор: @insert_reference_here
Download Telegram
#prog #rust #rustlib

coffee_break

Nowadays, the devious Rust compiler developers are trying to make the compiler even faster, and they're slowly succeeding.

Here comes Coffee break, a friendly developer tool to make this problem go away.


Before you run cargo build, reward yourself with a coffee break:

use coffee_break::coffee_break;

fn work_stuff() {
let maybe = |(true|false)||(false|true)||(true|false)|true;
let absolutely = maybe(true)(true)(true);

// Take a break and hit compile
coffee_break!(5 minutes);
}
You just got 5 minutes to stretch your legs, get a coffee, or make Friday afternoon a bit nicer.
👏7😁3
#prog #rust #rustlib

qualifier_attr — procedural macro attributes for adding "qualifiers" to various items.

// We can add a qualifier to a function
// with an attribute.
#[qualifiers(const)]
fn const_fn() -> u32 {
42
}

const CONST_RES: u32 = const_fn();

// It's not so impressive on its own,
// but with `cfg_attr`, it can be conditional.
#[cfg_attr(
feature = "extern_c",
no_mangle,
qualifiers(pub, extern "C")
)]
fn extern_c_fn() -> u32 {
42
}
👍9