Struct ExprComputation
pub struct ExprComputation<'a> { /* private fields */ }
Expand description
Implementations§
§impl ExprComputation<'_>
impl ExprComputation<'_>
pub const fn const_default() -> Self
pub const fn const_default() -> Self
Returns a default identity function expression
pub const fn const_default_ref() -> &'static Self
pub const fn const_default_ref() -> &'static Self
Returns a reference to the expression returned by Self::const_default
.
§impl<'a> ExprComputation<'a>
impl<'a> ExprComputation<'a>
pub const fn new(
expr: Expr<'a>,
output_encoding: OutputEncoding,
output_type: IoType,
) -> ExprComputation<'a>
pub const fn new( expr: Expr<'a>, output_encoding: OutputEncoding, output_type: IoType, ) -> ExprComputation<'a>
Creates a new computation using the provided Expr
and output encoding.
pub fn evaluate_with_args(&self, args: &[i128]) -> OwnedValue
pub fn evaluate_with_args(&self, args: &[i128]) -> OwnedValue
Evaluates the computation with the provided (already interpreted) arguments, and returns an OwnedValue
.
pub fn evaluate_with_args_indirect(
&self,
all_args: &[i128],
mapping: &[u16],
) -> OwnedValue
pub fn evaluate_with_args_indirect( &self, all_args: &[i128], mapping: &[u16], ) -> OwnedValue
Evaluates the computation with the provided (already interpreted) arguments, and returns an OwnedValue
.
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_as_bool_with_args_indirect(
&self,
all_args: &[i128],
mapping: &[u16],
) -> bool
pub fn evaluate_as_bool_with_args_indirect( &self, all_args: &[i128], mapping: &[u16], ) -> bool
Evaluates the computation with the provided (already interpreted) arguments, and interprets the result as a boolean. A zero-result is interpreted as false, while all non-zero results are interpreted as true.
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 compare_eq_with_args(&self, args: &[i128], expected: Value<'_>) -> bool
pub fn compare_eq_with_args(&self, args: &[i128], expected: Value<'_>) -> bool
Evaluates the computation with the provided (already interpreted) arguments, and compares the result with expected
.
Returns true if the result is equal to expected
, false otherwise.
pub fn compare_eq_with_args_indirect(
&self,
all_args: &[i128],
mapping: &[u16],
expected: Value<'_>,
) -> bool
pub fn compare_eq_with_args_indirect( &self, all_args: &[i128], mapping: &[u16], expected: Value<'_>, ) -> bool
Evaluates the computation with the provided (already interpreted) arguments, and compares the result with expected
.
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.
Returns true if the result is equal to expected
, false otherwise.
pub fn prepared_compare_eq_with_args_indirect(
&self,
all_args: &[i128],
mapping: &[u16],
expected: &PreparedComparison,
) -> bool
pub fn prepared_compare_eq_with_args_indirect( &self, all_args: &[i128], mapping: &[u16], expected: &PreparedComparison, ) -> bool
Evaluates the computation with the provided (already interpreted) arguments, and compares the result with expected
.
Uses a PreparedComparison
for better performance.
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.
Returns true if the result is equal to expected
, false otherwise.
pub fn output_encoding(&self) -> OutputEncoding
pub fn output_encoding(&self) -> OutputEncoding
Returns the output encoding to which the i128
result of the computation is converted.
pub fn internal_output_type(&self) -> OutputType
pub fn internal_output_type(&self) -> OutputType
Returns the optimized internal output type of the computation.
pub fn output_type(&self) -> IoType
pub fn output_type(&self) -> IoType
Returns the output type of the computation.
Trait Implementations§
§impl<'a> Clone for ExprComputation<'a>
impl<'a> Clone for ExprComputation<'a>
§fn clone(&self) -> ExprComputation<'a>
fn clone(&self) -> ExprComputation<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<'a> Debug for ExprComputation<'a>
impl<'a> Debug for ExprComputation<'a>
§impl Default for &ExprComputation<'_>
impl Default for &ExprComputation<'_>
§impl Default for ExprComputation<'_>
impl Default for ExprComputation<'_>
§impl<'a> PartialEq for ExprComputation<'a>
impl<'a> PartialEq for ExprComputation<'a>
impl<'a> Copy for ExprComputation<'a>
impl<'a> StructuralPartialEq for ExprComputation<'a>
Auto Trait Implementations§
impl<'a> Freeze for ExprComputation<'a>
impl<'a> RefUnwindSafe for ExprComputation<'a>
impl<'a> Send for ExprComputation<'a>
impl<'a> Sync for ExprComputation<'a>
impl<'a> Unpin for ExprComputation<'a>
impl<'a> UnwindSafe for ExprComputation<'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