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.
An empty value.
Implementations
impl Value
[src]
impl Value
[src]pub fn is_boolean(&self) -> bool
[src]
pub fn is_boolean(&self) -> bool
[src]Returns true if self
is a Value::Boolean
.
pub fn as_string(&self) -> EvalexprResult<String>
[src]
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]
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]
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]
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]
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]
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]
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]
pub fn as_empty(&self) -> EvalexprResult<()>
[src]Returns ()
, or returnsErr
if self
is not a Value::Tuple
.
Trait Implementations
impl From<Value> for EvalexprResult<Value>
[src]
impl From<Value> for EvalexprResult<Value>
[src]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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
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]
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