pub enum Value {
Int(i64),
Float(f64),
Complex(Complex64),
Vector(Vec<Value>),
Bool(bool),
}Expand description
Represent every possible output value.
Variants§
Implementations§
Source§impl Value
impl Value
pub fn add(self, rhs: Self) -> EvalResult<Self>
pub fn sub(self, rhs: Self) -> EvalResult<Self>
pub fn mul(self, rhs: Self) -> EvalResult<Self>
pub fn div(self, rhs: Self) -> EvalResult<Self>
pub fn negate(self) -> EvalResult<Self>
pub fn exponentiation(self, rhs: Self) -> EvalResult<Self>
pub fn modulo(self, rhs: Self) -> EvalResult<Self>
pub fn less_than(self, rhs: Self) -> EvalResult<Self>
pub fn greater_than(self, rhs: Self) -> EvalResult<Self>
pub fn less_or_equal_to(self, rhs: Self) -> EvalResult<Self>
pub fn greater_or_equal_to(self, rhs: Self) -> EvalResult<Self>
pub fn logical_and(self, rhs: Self) -> EvalResult<Self>
pub fn logical_or(self, rhs: Self) -> EvalResult<Self>
pub fn equal_to(self, rhs: Self) -> EvalResult<Self>
pub fn not_equal_to(self, rhs: Self) -> EvalResult<Self>
pub fn not(self) -> EvalResult<Self>
Source§impl Value
impl Value
pub fn get_type(&self) -> ValueType
pub fn is_int(&self) -> bool
pub fn is_float(&self) -> bool
pub fn is_complex(&self) -> bool
pub fn is_vector(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn as_int(&self) -> EvalResult<i64>
pub fn as_float(&self) -> EvalResult<f64>
pub fn as_complex(&self) -> EvalResult<Complex64>
pub fn as_vector(&self) -> Vec<Value>
pub fn as_bool(&self) -> EvalResult<bool>
pub fn as_type(&self, valuetype: &ValueType) -> EvalResult<Value>
Sourcepub fn from_string(string: String) -> EvalResult<Self>
pub fn from_string(string: String) -> EvalResult<Self>
Creates a new value from a string.
Sourcepub fn try_as_type(&self, valuetype: ValueType) -> Value
pub fn try_as_type(&self, valuetype: ValueType) -> Value
Tries to convert the value to the requested value-type. It returns the lowest complexity value achieved.
pub fn round(&self, rounding: Rounding) -> Self
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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