What is Allocator::by_ref for?
Rust Internals [Unofficial]
May 26, 2026
rne:
What's the benefit of these kind of associated functions over
impl AsMut<Self> for ...?
Avoiding amiguity for the sake of inference.
rne:
And, having
AsRefandAsMutin mind, why is it calledby_refand notby_mutalthough it returns a mutable reference?
Perhaps (in the case of Iterator) it's as simple as, it only makes sense for &mut. (OTOH it's a 1.0 method, there may not have been much conversation. I didn't dig.)
Discussion in the ATmosphere