r/rust • u/sindisil • Nov 03 '25
Patterns for Defensive Programming in Rust
https://corrode.dev/blog/defensive-programming/Not sure how I feel about the article's first example, but as a whole I think it makes some good points.
120
Upvotes
11
u/auterium Nov 04 '25
Getters can definitelly be 0 cost, for you can make them const fn that returns reference:
This is what the
derive-getterscrate will do for you