External Publication
Visit Post

What is Allocator::by_ref for?

Rust Internals [Unofficial] May 25, 2026
Source

FeldrinH:

Are these just convenience methods with oddly worded documentation?

yes, these are convenience methods. the purpose i would think would be made clear by the example in the iterator case. x.by_ref().other_method().yet_another() is meant to be a nicer way to write (&mut x).other_method().yet_another()(yes the parentheses are necesary) or for the Allocator case (&x).other_method().yet_another()

it is quite unclear to me why there is such a method on Allocator though

Discussion in the ATmosphere

Loading comments...