pub enum RantVar {
ByVal(RantValue),
ByValConst(RantValue),
ByRef(Rc<RefCell<RantValue>>),
ByRefConst(Rc<RantValue>),
}Expand description
Represents a Rant variable of one of two flavors: by-value or by-reference.
§Cloning
The Clone implementation for this type does not copy any data in ByRef* variants; it only copies the reference.
Variants§
ByVal(RantValue)
By-value variable
ByValConst(RantValue)
By-value constant
ByRef(Rc<RefCell<RantValue>>)
By-ref variable
ByRefConst(Rc<RantValue>)
By-ref constant
Implementations§
Source§impl RantVar
impl RantVar
Sourcepub fn make_by_ref(&mut self)
pub fn make_by_ref(&mut self)
Converts the variable to its by-reference counterpart.
Sourcepub fn write(&mut self, value: RantValue) -> bool
pub fn write(&mut self, value: RantValue) -> bool
Attempts to write the specified value to the variable.
If the variable is a constant, returns false; otherwise, returns true.
Sourcepub fn value_ref(&self) -> impl Deref<Target = RantValue> + '_
pub fn value_ref(&self) -> impl Deref<Target = RantValue> + '_
Returns an immutable reference to the contained value.
Sourcepub fn value_cloned(&self) -> RantValue
pub fn value_cloned(&self) -> RantValue
Returns a copy of the variable value.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RantVar
impl !RefUnwindSafe for RantVar
impl !Send for RantVar
impl !Sync for RantVar
impl Unpin for RantVar
impl !UnwindSafe for RantVar
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