pub struct BindingCell { /* private fields */ }Expand description
A reference-shared mutable binding slot captured from a lexical scope.
Cloned cells point at the same slot, so writes through one handle are visible through every other handle for the same lexical binding. Closure languages use this shape for boxed upvalues and closed-over mutable locals.
Implementations§
Source§impl BindingCell
impl BindingCell
Sourcepub fn uninitialized(name: Symbol) -> Self
pub fn uninitialized(name: Symbol) -> Self
Creates an uninitialized cell.
Sourcepub fn initialized(name: Symbol, value: Value) -> Self
pub fn initialized(name: Symbol, value: Value) -> Self
Creates an initialized mutable cell.
Sourcepub fn live_alias(name: Symbol, target: BindingCell) -> Self
pub fn live_alias(name: Symbol, target: BindingCell) -> Self
Creates a live alias which follows reads and writes to target.
Sourcepub fn get(&self) -> Result<Value>
pub fn get(&self) -> Result<Value>
Reads the cell’s current value.
Errors if the captured slot is still uninitialized.
Sourcepub fn delete(&self) -> Result<()>
pub fn delete(&self) -> Result<()>
Deletes this cell. A deleted cell cannot be read or reinitialized.
Sourcepub fn state(&self) -> Result<BindingCellState>
pub fn state(&self) -> Result<BindingCellState>
Returns a snapshot of the cell’s current state.
Trait Implementations§
Source§impl Clone for BindingCell
impl Clone for BindingCell
Source§fn clone(&self) -> BindingCell
fn clone(&self) -> BindingCell
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BindingCell
impl RefUnwindSafe for BindingCell
impl Send for BindingCell
impl Sync for BindingCell
impl Unpin for BindingCell
impl UnsafeUnpin for BindingCell
impl UnwindSafe for BindingCell
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