pub enum Upvalue {
Immutable(ValueWord),
Mutable(Arc<RwLock<ValueWord>>),
}Expand description
Upvalue - a captured variable that can be shared between closures and their enclosing scope.
Most captures are immutable (the compiler never emits StoreClosure), so the
Immutable variant stores the ValueWord directly — no Arc, no RwLock, just an
8-byte clone. The Mutable variant preserves the old Arc<RwLock<ValueWord>>
path for the rare case where a capture is written to.
Variants§
Immutable(ValueWord)
Direct value — no lock, no Arc overhead. Clone is 8 bytes (or Arc bump for heap values).
Mutable(Arc<RwLock<ValueWord>>)
Shared mutable capture — used if StoreClosure is ever emitted.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Upvalue
impl RefUnwindSafe for Upvalue
impl Send for Upvalue
impl Sync for Upvalue
impl Unpin for Upvalue
impl UnsafeUnpin for Upvalue
impl UnwindSafe for Upvalue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more