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

Joined November 2023
Want true pub-sub semantics in Rust? The Bus crate gives you SP→MC broadcast semantics. Crossbeam’s MPSC supports multiple consumers, but it round-robins messages, not exactly what you want for fan-out. crates.io/crates/bus
1
2
1
42
3,121
🦀 #Rust Tip #119: Some folks suggest using std::panic::catch_unwind as a solution to the recent unwrap() panic that stopped the internet. In my opinion this is an anti-pattern, some thoughts: - bypasses memory safety constraints (e.g., panic in unsafe block)
9
47
4,281
#119 (contd.) - imposes runtime cost by stack walking - encourages using panic for control flow - many APIs are not unwind-safe - cannot catch "fatal" errors such as out-of-memory
9
777
Daily Rust retweeted
You generally want a Clippy linter like this one in your Rust production code
🦀 Bad news everyone - unwrap() is the reason behind cloudflare outage >The FL2 Rust code that makes the check and was the source of the unhandled error is shown below blog.cloudflare.com/18-novem…
27
42
8
1,066
90,458
Don't use unwrap() in your production code, boys and girls! 😃
Cloudflare generated many millions of HTTP 5XX responses today. They were triggered because code in a core proxy called .unwrap() on a Result for an operation that was expected to never fail.
28
21
4
386
33,076
Animate anything with Rust 🦀 🌀 KramaFrame — A simple, generic, and flexible keyframe animation library. ⚡ Manage multiple animations, apply easing functions, and map progress to any range. 🐁 Includes a terminal demo w/ @ratatui_rs ⭐ GitHub: github.com/CosmoBunny/kramaf… #rustlang #animation #library #programming #terminal #ratatui #tui
6
84
8,583
This is gold if you're using async Rust 💯 🌀 channels-console — A TUI dashboard for inspecting std/tokio/futures/crossbeam channels. 📊 Watch messages, queue depth, throughput & memory usage live. 🦀 Written in Rust & built with @ratatui_rs ⭐ GitHub: github.com/pawurb/channels-c… #rustlang #ratatui #tui #async #concurrency #tokio #debugging
8
44
2
420
22,404
🦀 #Rust Tip #118: Result::and_then lets us chain operations that return Result, bypassing nested pattern matching. Although the ? operator often accomplishes the same, and_then allows us to remain in a more functional "combinator style".
12
13
1
169
11,565
🥵
7
16
1
169
5,738
🦀 #Rust Tip #117: fn foo(&self) fn bar (&mut self) fn baz (self) fn boo (mut self) Confused about which one to use in your struct implementations? Here's a useful overview:
7
14
156
6,876
🦀 #Rust Tip #116: Most of us should know Mutex<> for locking access to specific resources. However, this does also require locking the resources for read. If you need concurrent access to read, take a look at RwLock<> doc.rust-lang.org/std/sync/s…
1
7
856
🦀 #Rust Tip #115: Here's an interesting self-referential use of iterators, from Rustlings (rustlings.rust-lang.org/, highly recommended for Rust learners). We get an iterator that capitalizes the char, then use the chain() operator to attach the rest of the string chars.
4
6
100
6,189
Note: the reason to_uppercase() returns an iterator is that some characters capitalize to two chars. E.g., "ffi" (Unicode) to "FFI"
1
5
944
"Cargo is the most admired cloud development and infrastructure tool" in 2025, says a Stack Overflow study. survey.stackoverflow.co/2025…
2
4
20
1,276
🦀 #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:
17
933
🦀 #Rust Tip #113: build.rs 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? 🦀
7
2
115
5,490
🦀 #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.
4
12
138
6,186
🦀 #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 main.rs file.
2
35
1,984
🦀 #Rust Tip #110: Rust 2024 edition allows if let Some() chaining. Finally!
4
9
1
163
9,602