InteriorAssign trait { a := b }
Rust Internals [Unofficial]
May 12, 2026
bluelightzero:
I think what I might do instead though is just create a macro or use scripting because all I really want to do is abstract away a pattern that is going to be repeated thousands of times.
The first tool you should be reaching for to fix repeated code is a function , not a macro.
fn set_opt<T>(cell: &RefCell<Option<T>>, value: T) {
*cell.borrow_mut() = Some(value);
}
You should also consider whether the problem can be solved with less use of RefCell.
Discussion in the ATmosphere