pub enum ExprResult {
Float(OrderedFloat<f64>),
Value(i32),
Char(u8),
Bool(bool),
String(SmolStr),
List(Vec<ExprResult>),
Matrix {
width: usize,
height: usize,
content: Vec<ExprResult>,
},
}Expand description
The successful result of an evaluation. Embeds a real, an integer or a string
Variants§
Float(OrderedFloat<f64>)
Value(i32)
Char(u8)
Bool(bool)
String(SmolStr)
List(Vec<ExprResult>)
Matrix
Implementations§
Source§impl ExprResult
impl ExprResult
pub fn is_float(&self) -> bool
pub fn is_int(&self) -> bool
pub fn is_char(&self) -> bool
pub fn is_string(&self) -> bool
pub fn as_type( &self, other: &ExprResult, ) -> Result<ExprResult, ExpressionTypeError>
pub fn string(&self) -> Result<&str, ExpressionTypeError>
pub fn int(&self) -> Result<i32, ExpressionTypeError>
pub fn float(&self) -> Result<f64, ExpressionTypeError>
pub fn char(&self) -> Result<char, ExpressionTypeError>
pub fn bool(&self) -> Result<bool, ExpressionTypeError>
pub fn not(&self) -> Result<ExprResult, ExpressionTypeError>
Source§impl ExprResult
impl ExprResult
pub fn list_content(&self) -> &[ExprResult]
pub fn list_len(&self) -> usize
pub fn list_get(&self, pos: usize) -> &ExprResult
pub fn list_set(&mut self, pos: usize, value: ExprResult)
Source§impl ExprResult
impl ExprResult
pub fn matrix_set(&mut self, y: usize, x: usize, value: ExprResult)
pub fn matrix_get(&self, y: usize, x: usize) -> &ExprResult
pub fn matrix_height(&self) -> usize
pub fn matrix_width(&self) -> usize
pub fn matrix_rows(&self) -> &[ExprResult]
pub fn matrix_col(&self, x: usize) -> ExprResult
pub fn matrix_set_col(&mut self, x: usize, values: &[ExprResult])
pub fn matrix_row(&self, y: usize) -> &ExprResult
pub fn matrix_transpose(&self) -> ExprResult
pub fn matrix_cols(&self) -> Vec<ExprResult>
Source§impl ExprResult
impl ExprResult
pub fn floor(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn ceil(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn frac(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn sin(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn cos(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn asin(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn acos(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn atan(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn abs(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn ln(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn log10(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn exp(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn sqrt(&self) -> Result<ExprResult, ExpressionTypeError>
pub fn binary_not(&self) -> Result<ExprResult, ExpressionTypeError>
Trait Implementations§
Source§impl<T> Add<T> for ExprResult
impl<T> Add<T> for ExprResult
Source§fn add(self, rhs: T) -> <ExprResult as Add<T>>::Output
fn add(self, rhs: T) -> <ExprResult as Add<T>>::Output
TODO Allow “string” + &80 to add a number to the very last string
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
+ operator.Source§impl AddAssign for ExprResult
impl AddAssign for ExprResult
Source§fn add_assign(&mut self, rhs: ExprResult)
fn add_assign(&mut self, rhs: ExprResult)
Performs the
+= operation. Read moreSource§impl AsRef<ExprResult> for ExprResult
impl AsRef<ExprResult> for ExprResult
Source§fn as_ref(&self) -> &ExprResult
fn as_ref(&self) -> &ExprResult
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl BitAnd for ExprResult
impl BitAnd for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
& operator.Source§fn bitand(self, rhs: ExprResult) -> <ExprResult as BitAnd>::Output
fn bitand(self, rhs: ExprResult) -> <ExprResult as BitAnd>::Output
Performs the
& operation. Read moreSource§impl BitOr for ExprResult
impl BitOr for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
| operator.Source§fn bitor(self, rhs: ExprResult) -> <ExprResult as BitOr>::Output
fn bitor(self, rhs: ExprResult) -> <ExprResult as BitOr>::Output
Performs the
| operation. Read moreSource§impl BitXor for ExprResult
impl BitXor for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
^ operator.Source§fn bitxor(self, rhs: ExprResult) -> <ExprResult as BitXor>::Output
fn bitxor(self, rhs: ExprResult) -> <ExprResult as BitXor>::Output
Performs the
^ operation. Read moreSource§impl Clone for ExprResult
impl Clone for ExprResult
Source§fn clone(&self) -> ExprResult
fn clone(&self) -> ExprResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExprResult
impl Debug for ExprResult
Source§impl Display for ExprResult
impl Display for ExprResult
Source§impl<T> Div<T> for ExprResult
impl<T> Div<T> for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
/ operator.Source§impl<T> From<&[T]> for ExprResult
impl<T> From<&[T]> for ExprResult
Source§fn from(slice: &[T]) -> ExprResult
fn from(slice: &[T]) -> ExprResult
Converts to this type from the input type.
Source§impl From<&SmolStr> for ExprResult
impl From<&SmolStr> for ExprResult
Source§fn from(f: &SmolStr) -> ExprResult
fn from(f: &SmolStr) -> ExprResult
Converts to this type from the input type.
Source§impl From<ExprResult> for ValueAndSource
impl From<ExprResult> for ValueAndSource
Source§fn from(value: ExprResult) -> ValueAndSource
fn from(value: ExprResult) -> ValueAndSource
Converts to this type from the input type.
Source§impl From<OrderedFloat<f64>> for ExprResult
impl From<OrderedFloat<f64>> for ExprResult
Source§fn from(f: OrderedFloat<f64>) -> ExprResult
fn from(f: OrderedFloat<f64>) -> ExprResult
Converts to this type from the input type.
Source§impl From<SmolStr> for ExprResult
impl From<SmolStr> for ExprResult
Source§fn from(f: SmolStr) -> ExprResult
fn from(f: SmolStr) -> ExprResult
Converts to this type from the input type.
Source§impl From<String> for ExprResult
impl From<String> for ExprResult
Source§fn from(f: String) -> ExprResult
fn from(f: String) -> ExprResult
Converts to this type from the input type.
Source§impl From<bool> for ExprResult
impl From<bool> for ExprResult
Source§fn from(b: bool) -> ExprResult
fn from(b: bool) -> ExprResult
Converts to this type from the input type.
Source§impl From<char> for ExprResult
impl From<char> for ExprResult
Source§fn from(i: char) -> ExprResult
fn from(i: char) -> ExprResult
Converts to this type from the input type.
Source§impl From<f64> for ExprResult
impl From<f64> for ExprResult
Source§fn from(f: f64) -> ExprResult
fn from(f: f64) -> ExprResult
Converts to this type from the input type.
Source§impl From<i32> for ExprResult
impl From<i32> for ExprResult
Source§fn from(i: i32) -> ExprResult
fn from(i: i32) -> ExprResult
Converts to this type from the input type.
Source§impl From<i8> for ExprResult
impl From<i8> for ExprResult
Source§fn from(i: i8) -> ExprResult
fn from(i: i8) -> ExprResult
Converts to this type from the input type.
Source§impl From<u16> for ExprResult
impl From<u16> for ExprResult
Source§fn from(i: u16) -> ExprResult
fn from(i: u16) -> ExprResult
Converts to this type from the input type.
Source§impl From<u8> for ExprResult
impl From<u8> for ExprResult
Source§fn from(i: u8) -> ExprResult
fn from(i: u8) -> ExprResult
Converts to this type from the input type.
Source§impl From<usize> for ExprResult
impl From<usize> for ExprResult
Source§fn from(i: usize) -> ExprResult
fn from(i: usize) -> ExprResult
Converts to this type from the input type.
Source§impl LowerHex for ExprResult
impl LowerHex for ExprResult
Source§impl<T> Mul<T> for ExprResult
impl<T> Mul<T> for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
* operator.Source§impl Neg for ExprResult
impl Neg for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
- operator.Source§impl Ord for ExprResult
impl Ord for ExprResult
Source§fn cmp(&self, other: &ExprResult) -> Ordering
fn cmp(&self, other: &ExprResult) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ExprResult
impl PartialEq for ExprResult
Source§impl PartialOrd for ExprResult
impl PartialOrd for ExprResult
Source§impl<T> Rem<T> for ExprResult
impl<T> Rem<T> for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
% operator.Source§impl Shl for ExprResult
impl Shl for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
<< operator.Source§fn shl(self, rhs: ExprResult) -> <ExprResult as Shl>::Output
fn shl(self, rhs: ExprResult) -> <ExprResult as Shl>::Output
Performs the
<< operation. Read moreSource§impl Shr for ExprResult
impl Shr for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
>> operator.Source§fn shr(self, rhs: ExprResult) -> <ExprResult as Shr>::Output
fn shr(self, rhs: ExprResult) -> <ExprResult as Shr>::Output
Performs the
>> operation. Read moreSource§impl<T> Sub<T> for ExprResult
impl<T> Sub<T> for ExprResult
Source§type Output = Result<ExprResult, ExpressionTypeError>
type Output = Result<ExprResult, ExpressionTypeError>
The resulting type after applying the
- operator.Source§impl SubAssign for ExprResult
impl SubAssign for ExprResult
Source§fn sub_assign(&mut self, rhs: ExprResult)
fn sub_assign(&mut self, rhs: ExprResult)
Performs the
-= operation. Read moreSource§impl UpperHex for ExprResult
impl UpperHex for ExprResult
impl Eq for ExprResult
Auto Trait Implementations§
impl Freeze for ExprResult
impl RefUnwindSafe for ExprResult
impl Send for ExprResult
impl Sync for ExprResult
impl Unpin for ExprResult
impl UnwindSafe for ExprResult
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more