Enum wagon_value::Value

source ·
pub enum Value<T: Valueable> {
    Bool(bool),
    String(String),
    Natural(i32),
    Float(NotNan<f32>),
    Dict(BTreeMap<String, T>),
    Array(Vec<T>),
}
Expand description

The most basic types that a value can ever be.

For recursion reasons, this type is generic over any other type that can be seen as a Value (see Valueable).

Variants§

§

Bool(bool)

A bool.

§

String(String)

A string.

§

Natural(i32)

A whole number.

§

Float(NotNan<f32>)

A float.

§

Dict(BTreeMap<String, T>)

A dictionary.

§

Array(Vec<T>)

A list.

Trait Implementations§

source§

impl Add<RecursiveValue> for Value<RecursiveValue>

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the + operator.
source§

fn add(self, rhs: RecursiveValue) -> Self::Output

Performs the + operation. Read more
source§

impl<'a> Add<Value<RecursiveValue>> for RecursiveValue

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Value<Self>) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Valueable> Add for Value<T>

§

type Output = Result<Value<T>, ValueError<Value<T>>>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Clone + Valueable> Clone for Value<T>

source§

fn clone(&self) -> Value<T>

Returns a copy 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<T: Debug + Valueable> Debug for Value<T>

source§

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

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

impl<T: Valueable> Display for Value<T>

source§

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

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

impl Div<RecursiveValue> for Value<RecursiveValue>

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the / operator.
source§

fn div(self, rhs: RecursiveValue) -> Self::Output

Performs the / operation. Read more
source§

impl<'a> Div<Value<RecursiveValue>> for RecursiveValue

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Value<Self>) -> Self::Output

Performs the / operation. Read more
source§

impl<T: Valueable> Div for Value<T>

§

type Output = Result<Value<T>, ValueError<Value<T>>>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl<T: Valueable> From<&str> for Value<T>

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl<T: Valueable> From<BTreeMap<String, T>> for Value<T>

source§

fn from(value: BTreeMap<String, T>) -> Self

Converts to this type from the input type.
source§

impl From<RecursiveValue> for Value<RecursiveValue>

source§

fn from(value: RecursiveValue) -> Self

Converts to this type from the input type.
source§

impl<T: Valueable> From<String> for Value<T>

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<Value<RecursiveValue>> for RecursiveValue

source§

fn from(value: Value<Self>) -> Self

Converts to this type from the input type.
source§

impl<T: Valueable> From<Value<T>> for bool

source§

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

Converts to this type from the input type.
source§

impl<T: Valueable> From<Value<T>> for f32

source§

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

Converts to this type from the input type.
source§

impl<T: Valueable> From<Value<T>> for i32

source§

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

Converts to this type from the input type.
source§

impl<T: Valueable> From<Vec<T>> for Value<T>

source§

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

Converts to this type from the input type.
source§

impl<T: Valueable> From<bool> for Value<T>

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl<T: Valueable> From<i32> for Value<T>

source§

fn from(value: i32) -> Self

Converts to this type from the input type.
source§

impl<T: Hash + Valueable> Hash for Value<T>

source§

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

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 Mul<RecursiveValue> for Value<RecursiveValue>

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: RecursiveValue) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<Value<RecursiveValue>> for RecursiveValue

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Value<Self>) -> Self::Output

Performs the * operation. Read more
source§

impl<T: Valueable> Mul for Value<T>

§

type Output = Result<Value<T>, ValueError<Value<T>>>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl<T: Valueable> Not for Value<T>

§

type Output = Result<Value<T>, ValueError<Value<T>>>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<T: PartialEq + Valueable> PartialEq for Value<T>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Valueable> PartialOrd for Value<T>

source§

fn partial_cmp(&self, other: &Self) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Pow<RecursiveValue> for Value<RecursiveValue>

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The result after applying the operator.
source§

fn pow(self, rhs: RecursiveValue) -> Self::Output

Returns self to the power rhs. Read more
source§

impl<'a> Pow<Value<RecursiveValue>> for RecursiveValue

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The result after applying the operator.
source§

fn pow(self, rhs: Value<Self>) -> Self::Output

Returns self to the power rhs. Read more
source§

impl<T: Valueable> Pow<Value<T>> for Value<T>

§

type Output = Result<Value<T>, ValueError<Value<T>>>

The result after applying the operator.
source§

fn pow(self, rhs: Self) -> Self::Output

Returns self to the power rhs. Read more
source§

impl Rem<RecursiveValue> for Value<RecursiveValue>

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: RecursiveValue) -> Self::Output

Performs the % operation. Read more
source§

impl<'a> Rem<Value<RecursiveValue>> for RecursiveValue

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Value<Self>) -> Self::Output

Performs the % operation. Read more
source§

impl<T: Valueable> Rem for Value<T>

§

type Output = Result<Value<T>, ValueError<Value<T>>>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
source§

impl Sub<RecursiveValue> for Value<RecursiveValue>

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: RecursiveValue) -> Self::Output

Performs the - operation. Read more
source§

impl<'a> Sub<Value<RecursiveValue>> for RecursiveValue

§

type Output = Result<RecursiveValue, ValueError<RecursiveValue>>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Value<Self>) -> Self::Output

Performs the - operation. Read more
source§

impl<T: Valueable> Sub for Value<T>

§

type Output = Result<Value<T>, ValueError<Value<T>>>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<T: Valueable> TryFrom<f32> for Value<T>

§

type Error = ValueError<Value<T>>

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

fn try_from(value: f32) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T: Valueable> Valueable for Value<T>

source§

fn is_truthy(&self) -> ValueResult<bool, Self>

Is this value seen as true or false? Read more
source§

fn to_int(&self) -> ValueResult<i32, Self>

Convert the value to a regular i32. Read more
source§

fn to_float(&self) -> ValueResult<f32, Self>

Convert the value to a regular f32. Read more
source§

fn display_numerical(&self) -> ValueResult<String, Self>

Get a string representation of the value, as if it were a number. Read more
source§

impl<T: Eq + Valueable> Eq for Value<T>

source§

impl<T: Valueable> StructuralPartialEq for Value<T>

Auto Trait Implementations§

§

impl<T> Freeze for Value<T>

§

impl<T> RefUnwindSafe for Value<T>
where T: RefUnwindSafe,

§

impl<T> Send for Value<T>
where T: Send,

§

impl<T> Sync for Value<T>
where T: Sync,

§

impl<T> Unpin for Value<T>
where T: Unpin,

§

impl<T> UnwindSafe for Value<T>

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> 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> ToOwned for T
where T: Clone,

§

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§

default 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>,

§

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>,

§

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<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,