Enum rant::RantVar[][src]

pub enum RantVar {
    ByVal(RantValue),
    ByValConst(RantValue),
    ByRef(Rc<RefCell<RantValue>>),
    ByRefConst(Rc<RantValue>),
}

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

By-ref variable

ByRefConst(Rc<RantValue>)

By-ref constant

Implementations

impl RantVar[src]

pub fn is_const(&self) -> bool[src]

Returns true if the variable is a constant.

pub fn is_by_val(&self) -> bool[src]

Returns true if the variable is by-value.

pub fn is_by_ref(&self) -> bool[src]

Returns true if the variable is by-reference.

pub fn make_by_ref(&mut self)[src]

Converts the variable to its by-reference counterpart.

pub fn write(&mut self, value: RantValue) -> bool[src]

Attempts to write the specified value to the variable. If the variable is a constant, returns false; otherwise, returns true.

pub fn value_ref(&self) -> impl Deref<Target = RantValue> + '_[src]

Returns an immutable reference to the contained value.

pub fn value_cloned(&self) -> RantValue[src]

Returns a copy of the variable value.

Trait Implementations

impl Clone for RantVar[src]

fn clone(&self) -> Self[src]

Creates a copy of the variable, preserving references.

impl Debug for RantVar[src]

impl Default for RantVar[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,