Supercharging Your Code With Five Little-Known Attributes
summary
Five concrete attributes are demonstrated and shown to work on real code: non_exhaustive forces wildcard matches so adding enum variants won’t break downstream crates; deprecated plus deny(deprecated) flags old APIs so calls to the legacy pizza_validator become compile warnings or errors; the third-party pre crate adds caller-side assurances to prevent the two_box null-pointer segfault and succeeds after reallocating on the Rust side; type_tag makes trait objects serializable across crates.
AI-written summary · about
chapters (4)
related talks
25mType System Tips for the Real World
26mThe Freedom of Static Typing
33mReplacing #[cfg] with Traits: The Inlinable Dyn Extension Trait Pattern
19mRust Without Tears: A Guide to Avoiding Common Traps
32mBuilding and Maintaining Rust at Scale
36mThe language that isn't
31mDefense Against The Wrong Logic: Proactive Rust Coding
49mThe Eternal Sunshine of the Spotless Programming Language
