Value

Enum Value 

Source
pub enum Value {
    None,
    Bool(bool),
    Number(Number),
    String(String),
    List(Vec<Value>),
    Map(IndexMap<Value, Value>),
    Range(ValueRange),
    Error(VMError),
    Tuple(Vec<Value>),
    Type(RigzType),
}

Variants§

§

None

§

Bool(bool)

§

Number(Number)

§

String(String)

§

List(Vec<Value>)

§

Map(IndexMap<Value, Value>)

§

Range(ValueRange)

§

Error(VMError)

§

Tuple(Vec<Value>)

§

Type(RigzType)

Implementations§

Source§

impl Value

Source

pub fn to_number(&self) -> Result<Number, VMError>

Source

pub fn to_float(&self) -> Result<f64, VMError>

Source

pub fn to_int(&self) -> Result<i64, VMError>

Source

pub fn to_usize(&self) -> Result<usize, VMError>

Source

pub fn as_bool(&mut self) -> &mut bool

Source

pub fn as_float(&mut self) -> Result<&mut f64, VMError>

Source

pub fn as_number(&mut self) -> Result<&mut Number, VMError>

Source

pub fn as_int(&mut self) -> Result<&mut i64, VMError>

Source

pub fn as_string(&mut self) -> &mut String

Source

pub fn as_map(&mut self) -> &mut IndexMap<Value, Value>

Source

pub fn as_list(&mut self) -> &mut Vec<Value>

Source

pub fn to_bool(&self) -> bool

Source

pub fn to_list(&self) -> Vec<Value>

Source

pub fn to_map(&self) -> IndexMap<Value, Value>

Source

pub fn rigz_type(&self) -> RigzType

Source

pub fn cast(&self, rigz_type: &RigzType) -> Value

Source

pub fn get(&self, attr: &Value) -> Result<Option<Value>, VMError>

Trait Implementations§

Source§

impl Add for &Value

Source§

type Output = Value

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Value) -> <&Value as Add>::Output

Performs the + operation. Read more
Source§

impl BitAnd for &Value

Source§

type Output = Value

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &Value) -> <&Value as BitAnd>::Output

Performs the & operation. Read more
Source§

impl BitOr for &Value

Source§

type Output = Value

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &Value) -> <&Value as BitOr>::Output

Performs the | operation. Read more
Source§

impl BitXor for &Value

Source§

type Output = Value

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &Value) -> <&Value as BitXor>::Output

Performs the ^ operation. Read more
Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Value

Source§

fn default() -> Value

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Value, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Div for &Value

Source§

type Output = Value

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Value) -> <&Value as Div>::Output

Performs the / operation. Read more
Source§

impl From<&VMError> for Value

Source§

fn from(value: &VMError) -> Value

Converts to this type from the input type.
Source§

impl From<&str> for Value

Source§

fn from(value: &str) -> Value

Converts to this type from the input type.
Source§

impl From<()> for Value

Source§

fn from(_value: ()) -> Value

Converts to this type from the input type.
Source§

impl<A, B> From<(A, B)> for Value
where A: Into<Value>, B: Into<Value>,

Source§

fn from(value: (A, B)) -> Value

Converts to this type from the input type.
Source§

impl<A, B, C> From<(A, B, C)> for Value
where A: Into<Value>, B: Into<Value>, C: Into<Value>,

Source§

fn from(value: (A, B, C)) -> Value

Converts to this type from the input type.
Source§

impl<A, B, C, D> From<(A, B, C, D)> for Value
where A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>,

Source§

fn from(value: (A, B, C, D)) -> Value

Converts to this type from the input type.
Source§

impl<A, B, C, D, E> From<(A, B, C, D, E)> for Value
where A: Into<Value>, B: Into<Value>, C: Into<Value>, D: Into<Value>, E: Into<Value>,

Source§

fn from(value: (A, B, C, D, E)) -> Value

Converts to this type from the input type.
Source§

impl<K, V> From<IndexMap<K, V>> for Value
where K: Into<Value>, V: Into<Value>,

Source§

fn from(value: IndexMap<K, V>) -> Value

Converts to this type from the input type.
Source§

impl<V> From<Option<V>> for Value
where V: Into<Value>,

Source§

fn from(value: Option<V>) -> Value

Converts to this type from the input type.
Source§

impl<V> From<Result<V, VMError>> for Value
where V: Into<Value>,

Source§

fn from(value: Result<V, VMError>) -> Value

Converts to this type from the input type.
Source§

impl From<RigzType> for Value

Source§

fn from(value: RigzType) -> Value

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(value: String) -> Value

Converts to this type from the input type.
Source§

impl<T> From<T> for Value
where T: Into<Number>,

Source§

fn from(value: T) -> Value

Converts to this type from the input type.
Source§

impl From<TokenValue<'_>> for Value

Source§

fn from(val: TokenValue<'_>) -> Value

Converts to this type from the input type.
Source§

impl From<VMError> for Value

Source§

fn from(value: VMError) -> Value

Converts to this type from the input type.
Source§

impl From<ValueRange> for Value

Source§

fn from(value: ValueRange) -> Value

Converts to this type from the input type.
Source§

impl<T> From<Vec<T>> for Value
where T: Into<Value>,

Source§

fn from(value: Vec<T>) -> Value

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(value: bool) -> Value

Converts to this type from the input type.
Source§

impl Hash for Value

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Logical<&Value> for &Value

Source§

type Output = Value

Source§

fn and(self, rhs: &Value) -> <&Value as Logical<&Value>>::Output

Source§

fn or(self, rhs: &Value) -> <&Value as Logical<&Value>>::Output

Source§

fn xor(self, rhs: &Value) -> <&Value as Logical<&Value>>::Output

Source§

fn elvis(self, rhs: &Value) -> <&Value as Logical<&Value>>::Output

Source§

impl Mul for &Value

Source§

type Output = Value

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Value) -> <&Value as Mul>::Output

Performs the * operation. Read more
Source§

impl Neg for &Value

Source§

type Output = Value

The resulting type after applying the - operator.
Source§

fn neg(self) -> <&Value as Neg>::Output

Performs the unary - operation. Read more
Source§

impl Not for &Value

Source§

type Output = Value

The resulting type after applying the ! operator.
Source§

fn not(self) -> <&Value as Not>::Output

Performs the unary ! operation. Read more
Source§

impl PartialEq for Value

Source§

fn eq(&self, other: &Value) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Value) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem for &Value

Source§

type Output = Value

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Value) -> <&Value as Rem>::Output

Performs the % operation. Read more
Source§

impl Reverse for Value

Source§

impl Serialize for Value

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Shl for &Value

Source§

type Output = Value

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: &Value) -> <&Value as Shl>::Output

Performs the << operation. Read more
Source§

impl Shr for &Value

Source§

type Output = Value

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: &Value) -> <&Value as Shr>::Output

Performs the >> operation. Read more
Source§

impl Sub for &Value

Source§

type Output = Value

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Value) -> <&Value as Sub>::Output

Performs the - operation. Read more
Source§

impl Eq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,