Rust Keyword Generics Progress Report: February 2023
Rust Keyword Generics Progress Report: February 2023
Posted Feb 24, 2023 3:09 UTC (Fri) by xi0n (guest, #138144)Parent article: Rust Keyword Generics Progress Report: February 2023
Right now, many libraries (including std) rely purely on naming convention to distinguish mutable and immutable methods. Both variants also have to be written separately, leading to proliferation of pairs such as get/get_mut, as_ref/as_mut, as_deref/as_deref_mut, and sometimes also traits (Deref/DerefMut) and various wrapper types (e.g. Ref and Mut in Bevy). Unlike async or even const, this duplication affects basically any Rust codebase. Having something like ?mut so that you can at least write methods that are generic over `&?mut self` would go a long towards reducing API cruft.
