{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreic2lacwphoazqnvetxpsdolhmt4rv6czspyobgq4kf5shvev7fa4a",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mll7dqj6u7w2"
},
"path": "/t/interiorassign-trait-a-b/24291?page=2#post_21",
"publishedAt": "2026-05-11T10:53:58.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"std::io::Write"
],
"textContent": "it seems rather obvious to me that `InteriorAssign`, if it were to exist, ought to be defined as\n\n\n pub trait InteriorAssign<Rhs = Self> {\n fn interior_assign(&mut self, rhs: Rhs);\n }\n\n\nand `a := b` would desugar to `(&mut a).interior_assign(b)`, same as all the other `*Assign` traits.\n\nit still would not work with `map[key] := val` without some significant compiler magic, but `map.entry(key) := val` could work at least.\n\nfor implementations of mutating traits on types with interior mutability, you may want to look at std::io::Write",
"title": "InteriorAssign trait { a := b }"
}