The current `std::option` API defines 3 versions of most methods, in order to handle by-value, by-reference and by-mutable-reference. As the module grows, it will continue to pick up sets of 3 nearly identical methods rather than one implementation of each.
We could replace the current design with a single by-value implementation of the methods, and composable `as_mut`/`as_imm` methods to convert `Option<T>` to `Option<&T>` or `Option<&mut T>`. This is the same pattern used by iterators, as they keep the element type separate from the algorithms/adaptors. https://github.com/mozilla/rust/issues/9355 https://github.com/mozilla/rust/pull/9359
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
