rustoftheday Profile Banner
Daily Rust Profile
Daily Rust

@rustoftheday

Followers
3K
Following
675
Media
126
Statuses
423

Daily tips & tricks for Rust 🦀 programming. Following back all accounts with 🦀 or 🐪 in their profile.

Joined November 2023
Don't wanna be here? Send us removal request.
@rustoftheday
Daily Rust
2 days
🦀 #Rust Tip #114: A serde tip: #[serde(flatten)] can be used to beautify Json output when serializing. This is useful to improve the handling of enums in particular:
Tweet media one
0
0
13
@rustoftheday
Daily Rust
9 days
An amazing overview of the core Rust types and traits: https://t.co/Ak9SANexqK
Tweet card summary image
rustcurious.com
A complete map of the Rust type system
1
21
162
@rustoftheday
Daily Rust
1 month
🦀 #Rust Tip #113: https://t.co/BunGWrJlNN is secretly a decent C build system. You can compile wrappers + link C SDKs for Rust wrappers and calling into C code. BTW those println!s are "hidden" build instructions to Cargo. Who needs Makefiles? 🦀
Tweet media one
0
9
113
@rustoftheday
Daily Rust
1 month
🦀 #Rust Tip #112: Rust will happily compile and call C functions in unsafe mode. Just declare them in an extern "C" block. Great for interop with legacy code or standard library C functions.
Tweet media one
4
13
143
@rustoftheday
Daily Rust
1 month
🦀 #Rust Tip #111: You can use the examples/ directory in your crate and cargo run --example <name> to run quick experimentations, demos or tests without affecting your https://t.co/OlqnBdRobN file.
0
2
34
@rustoftheday
Daily Rust
2 months
🦀 #Rust Tip #110: Rust 2024 edition allows if let Some() chaining. Finally!
Tweet media one
4
11
175
@rustoftheday
Daily Rust
2 months
Sorry this was actually #Rust Tip #109, my bad.
2
0
10
@rustoftheday
Daily Rust
2 months
🦀 #Rust Tip #108: A (new to me) function of Cargo is "cargo check". Use this to turbocharge your edit-compile cycles as cargo check runs type checking only but skips codegen and linking. Great for sorting out those borrow-checker issues 🧠
5
6
80
@rustoftheday
Daily Rust
3 months
If they had just used #Rust ... No null pointers!
@dan_goosewin
goosewin
3 months
null pointer was the culprit that took down google 😭
Tweet media one
1
0
10
@rustoftheday
Daily Rust
3 months
🦀 #Rust Tip #108: I always enjoy the power of Rust #iterators. Here are two utility functions that you might not know about: .peekable() : Allow peeking at next element without consuming it .partition(cond_fn): Partition an iterator into separate collections with a condition
Tweet media one
0
10
162
@rustoftheday
Daily Rust
3 months
🦀 #Rust Tip #107: TIL about the #[cold] attribute for functions that don't get called very often. This helps the compiler prioritize hot path functions for better instruction cache performance. #[cold] can also be used to tag enum variants to optimize memory layout.
Tweet media one
5
23
389
@swlkr
swlkr
4 months
when you write a rust app, no tests, and it works first try
Tweet media one
16
25
560
@rustoftheday
Daily Rust
4 months
🦀 #Rust Tip #106: Boxing large enum values can be beneficial to save stack space and to prevent recursion-bombs 💣, by moving these payloads to the heap.
Tweet media one
0
11
151
@rustoftheday
Daily Rust
4 months
This looks like there is finally a (usable) #debugger for #Rust . Worth checking out? https://t.co/GBMK4XTzNl
firedbg.sea-ql.org
🔥 Time Travel Visual Debugger for Rust
0
5
30
@rustoftheday
Daily Rust
4 months
🦀 #Rust Tip #105: Want to make sure your loop breaks out to a specific level? Rust allows using labels to finetune the exit point:
Tweet media one
7
12
237
@rustoftheday
Daily Rust
5 months
🦀 #Rust #Crate 22: Are you dissatisfied with the performance hit of your println! debugging output? Do you think env_logger is boring? Turbocharge your log outputs with high performance and fine-grained structured control using the tracing crate: https://t.co/hLu2J5wdvH
Tweet media one
1
7
62
@rustoftheday
Daily Rust
6 months
🦀 #Rust Tip #105: Searching for ways to allow a warning I learned that there are "inner" and "outer" attributes. - Inner #![...] applies broadly to the whole module or crate: #![allow(dead_code)] - Outer #[...] applies to the following item: #[derive(Debug)]
0
1
14
@AstraKernel
AstraKernel 💫
6 months
Lol 😆
Tweet media one
5
7
98
@LiamWoodleigh
Liam Woodleigh
7 months
@rustoftheday @tsoding C++ and memory unsafe languages should be considered deprecated
3
1
6