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
sourceimpl 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 !RefUnwindSafe for RantVar
impl !Send for RantVar
impl !Sync for RantVar
impl Unpin for RantVar
impl !UnwindSafe for RantVar
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more