pub enum Instr {
Add {
dst: usize,
srcs: Vec<usize>,
},
Mul {
dst: usize,
srcs: Vec<usize>,
},
Pow {
dst: usize,
base: usize,
exp: i64,
},
Powf {
dst: usize,
base: usize,
exp: usize,
},
BuiltinOp {
dst: usize,
op: BuiltinOp,
src: usize,
},
ExternalFun {
dst: usize,
fn_idx: usize,
srcs: Vec<usize>,
},
Copy {
dst: usize,
src: usize,
},
}Expand description
An internal, index-based instruction executed by super::ExpressionEvaluator.
All indices are absolute positions in the evaluator’s flat stack:
indices 0..param_count are parameters, param_count..param_count+const_count
are constants, and the remainder are temporaries and outputs.
Variants§
Add
stack[dst] = sum(stack[srcs[0]], stack[srcs[1]], ...)
Mul
stack[dst] = product(stack[srcs[0]], stack[srcs[1]], ...)
Pow
stack[dst] = stack[base]^exp where exp is an integer
Powf
stack[dst] = stack[base]^stack[exp] (floating-point exponent)
BuiltinOp
stack[dst] = builtin(stack[src])
ExternalFun
stack[dst] = fns[fn_idx](&stack[srcs[0]..])
Copy
stack[dst] = stack[src]
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Instr
impl RefUnwindSafe for Instr
impl Send for Instr
impl Sync for Instr
impl Unpin for Instr
impl UnsafeUnpin for Instr
impl UnwindSafe for Instr
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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