{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiet3ryvluowkrjotgvwgaomuk675l43leom53m3qeagr2dzcu7xae",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mmrgkvk77dh2"
},
"path": "/t/what-is-allocator-by-ref-for/24356#post_11",
"publishedAt": "2026-05-26T15:48:50.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "rne:\n\n> What's the benefit of these kind of associated functions over `impl AsMut<Self> for ...`?\n\nthese are trait methods. (for example on Iterator), so `as_ref` is available on every iterator and only on iterators. you cannot `impl<I : Iterator> AsMut<Self> for I`, that would be against the orphan rule. `AsMut` ofc is not reflexive.\n\n`BorrowMut` is relexive, but then it is on every type and can get noisy, as well as conflict with inherent methods.",
"title": "What is Allocator::by_ref for?"
}