pub trait BulkEvaluator: Default {
type Data: From<f32> + Copy + Clone;
type Tape: Tape<Storage = Self::TapeStorage>;
type TapeStorage;
// Required method
fn eval<V: Deref<Target = [Self::Data]>>(
&mut self,
tape: &Self::Tape,
vars: &[V],
) -> Result<BulkOutput<'_, Self::Data>, Error>;
// Provided method
fn new() -> Self { ... }
}
Expand description
Trait for bulk evaluation returning the given type T
Bulk evaluators should usually be constructed on a per-thread basis.
They contain (at minimum) output array storage, which is borrowed in the
return from eval
. They may also contain
intermediate storage (e.g. an array of VM registers).
Required Associated Types§
Sourcetype Tape: Tape<Storage = Self::TapeStorage>
type Tape: Tape<Storage = Self::TapeStorage>
Instruction tape used during evaluation
This may be a literal instruction tape (in the case of VM evaluation), or a metaphorical instruction tape (e.g. a JIT function).
Sourcetype TapeStorage
type TapeStorage
Associated type for tape storage
This is a workaround for plumbing purposes
Required Methods§
Sourcefn eval<V: Deref<Target = [Self::Data]>>(
&mut self,
tape: &Self::Tape,
vars: &[V],
) -> Result<BulkOutput<'_, Self::Data>, Error>
fn eval<V: Deref<Target = [Self::Data]>>( &mut self, tape: &Self::Tape, vars: &[V], ) -> Result<BulkOutput<'_, Self::Data>, Error>
Evaluates many points using the given instruction tape
vars
should be a slice-of-slices (or a slice-of-Vec
s) representing
input arguments for each of the tape’s variables; use Tape::vars
to
map from Var
to position in the list.
The returned slice is borrowed from the evaluator.
Returns an error if any of the var
slices are of different lengths, or
if all variables aren’t present.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.