Struct Expr
pub struct Expr<'a> { /* private fields */ }
Expand description
The expression used in computations.
Non-owned version of Expression
.
Implementations§
§impl Expr<'_>
impl Expr<'_>
pub const fn const_default() -> Self
pub const fn const_default() -> Self
A default expression, which is the identity function.
pub const fn const_default_ref() -> &'static Self
pub const fn const_default_ref() -> &'static Self
A reference to the default expression, which is the identity function.
§impl<'a> Expr<'a>
impl<'a> Expr<'a>
pub const fn count_holes(&self) -> usize
pub const fn count_holes(&self) -> usize
Counts the number of Op::Hole
s in the expression.
pub fn to_owned(&self) -> Expression
pub fn to_owned(&self) -> Expression
Casts the expression to an owned expression.
pub fn evaluate(&self, args: &[i128]) -> i128
pub fn evaluate(&self, args: &[i128]) -> i128
Evaluates the expression using the given arguments.
Returns the result of the computation as an i128
.
pub fn evaluate_indirect(&self, all_args: &[i128], mapping: &[u16]) -> i128
pub fn evaluate_indirect(&self, all_args: &[i128], mapping: &[u16]) -> i128
Evaluates the expression using the given arguments.
Returns the result of the computation as an i128
.
Performs a lookup in mapping
to figure out which index in all_args
should be used for an argument.
For an argument N
, all_args[mapping[N] as usize]
is used.
pub fn evaluate_indirect_as_u64(
&self,
all_args: &[i128],
mapping: &[u16],
) -> u64
pub fn evaluate_indirect_as_u64( &self, all_args: &[i128], mapping: &[u16], ) -> u64
Evaluates the expression using the given arguments.
The expression produces an i128
, which is then cast to an u64
and returned.
This can be faster if the fast_eval
field is set.
This allows the compiler to eliminate i128
computations all together in some cases.
Performs a lookup in mapping
to figure out which index in all_args
should be used for an argument.
For an argument N
, all_args[mapping[N] as usize]
is used.
pub fn evaluate_indirect_as_bool(
&self,
all_args: &[i128],
mapping: &[u16],
) -> bool
pub fn evaluate_indirect_as_bool( &self, all_args: &[i128], mapping: &[u16], ) -> bool
Evaluates the expression using the given arguments.
The expression produces an i128
, which is then cast to a bool
and returned.
This can be faster if the fast_eval
field is set.
This allows the compiler to eliminate i128
computations all together in some cases.
Performs a lookup in mapping
to figure out which index in all_args
should be used for an argument.
For an argument N
, all_args[mapping[N] as usize]
is used.
Trait Implementations§
impl<'a> Copy for Expr<'a>
Auto Trait Implementations§
impl<'a> Freeze for Expr<'a>
impl<'a> RefUnwindSafe for Expr<'a>
impl<'a> Send for Expr<'a>
impl<'a> Sync for Expr<'a>
impl<'a> Unpin for Expr<'a>
impl<'a> UnwindSafe for Expr<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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>
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>
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