Enum evalexpr::Value[][src]

pub enum Value {
    String(String),
    Float(FloatType),
    Int(IntType),
    Boolean(bool),
    Tuple(TupleType),
    Empty,
}
Expand description

The value type used by the parser. Values can be of different subtypes that are the variants of this enum.

Variants

String(String)

A string value.

Float(FloatType)

A float value.

Int(IntType)

An integer value.

Boolean(bool)

A boolean value.

Tuple(TupleType)

A tuple value.

Empty

An empty value.

Implementations

impl Value[src]

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

Returns true if self is a Value::String.

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

Returns true if self is a Value::Int.

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

Returns true if self is a Value::Float.

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

Returns true if self is a Value::Int or Value::Float.

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

Returns true if self is a Value::Boolean.

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

Returns true if self is a Value::Tuple.

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

Returns true if self is a Value::Empty.

pub fn as_string(&self) -> EvalexprResult<String>[src]

Clones the value stored in self as String, or returns Err if self is not a Value::String.

pub fn as_int(&self) -> EvalexprResult<IntType>[src]

Clones the value stored in self as IntType, or returns Err if self is not a Value::Int.

pub fn as_float(&self) -> EvalexprResult<FloatType>[src]

Clones the value stored in self as FloatType, or returns Err if self is not a Value::Float.

pub fn as_number(&self) -> EvalexprResult<FloatType>[src]

Clones the value stored in self as FloatType, or returns Err if self is not a Value::Float or Value::Int. Note that this method silently converts IntType to FloatType, if self is a Value::Int.

pub fn as_boolean(&self) -> EvalexprResult<bool>[src]

Clones the value stored in self as bool, or returns Err if self is not a Value::Boolean.

pub fn as_tuple(&self) -> EvalexprResult<TupleType>[src]

Clones the value stored in self as TupleType, or returns Err if self is not a Value::Tuple.

pub fn as_fixed_len_tuple(&self, len: usize) -> EvalexprResult<TupleType>[src]

Clones the value stored in self as TupleType or returns Err if self is not a Value::Tuple of the required length.

pub fn as_empty(&self) -> EvalexprResult<()>[src]

Returns (), or returnsErr if self is not a Value::Tuple.

Trait Implementations

impl Clone for Value[src]

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

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Value[src]

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

Formats the value using the given formatter. Read more

impl Display for Value[src]

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

Formats the value using the given formatter. Read more

impl From<&'_ &'_ mut Value> for ValueType[src]

fn from(value: &&mut Value) -> Self[src]

Performs the conversion.

impl From<&'_ Value> for ValueType[src]

fn from(value: &Value) -> Self[src]

Performs the conversion.

impl From<&'_ mut Value> for ValueType[src]

fn from(value: &mut Value) -> Self[src]

Performs the conversion.

impl From<&'_ str> for Value[src]

fn from(string: &str) -> Self[src]

Performs the conversion.

impl From<()> for Value[src]

fn from(_: ()) -> Self[src]

Performs the conversion.

impl From<String> for Value[src]

fn from(string: String) -> Self[src]

Performs the conversion.

impl From<Value> for EvalexprResult<Value>[src]

fn from(value: Value) -> Self[src]

Performs the conversion.

impl From<Vec<Value, Global>> for Value[src]

fn from(tuple: TupleType) -> Self[src]

Performs the conversion.

impl From<bool> for Value[src]

fn from(boolean: bool) -> Self[src]

Performs the conversion.

impl From<f64> for Value[src]

fn from(float: FloatType) -> Self[src]

Performs the conversion.

impl From<i64> for Value[src]

fn from(int: IntType) -> Self[src]

Performs the conversion.

impl PartialEq<Value> for Value[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Value) -> bool[src]

This method tests for !=.

impl StructuralPartialEq for Value[src]

Auto Trait Implementations

impl RefUnwindSafe for Value

impl Send for Value

impl Sync for Value

impl Unpin for Value

impl UnwindSafe for Value

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

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.

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

Performs the conversion.

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.

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

Performs the conversion.