[−][src]Enum evalexpr::Value
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.
Methods
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 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 returnsErr
if self
is not a Value::Tuple
.
Trait Implementations
impl<'_> From<&'_ Value> for ValueType
[src]
impl<'_> From<&'_ mut Value> for ValueType
[src]
impl<'_, '_> From<&'_ &'_ mut Value> for ValueType
[src]
impl From<String> for Value
[src]
impl<'_> From<&'_ str> for Value
[src]
impl From<f64> for Value
[src]
impl From<i64> for Value
[src]
impl From<bool> for Value
[src]
impl From<Vec<Value>> for Value
[src]
impl From<Value> for EvalexprResult<Value>
[src]
impl PartialEq<Value> for Value
[src]
impl Clone for Value
[src]
fn clone(&self) -> Value
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Value
[src]
impl Display for Value
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,