pub trait StatefulUnaryKernel<SampleType>: Send {
    fn work(
        &mut self,
        input: &[SampleType],
        output: &mut [SampleType]
    ) -> (usize, usize, ComputationStatus); }
Expand description

Implements a trait to run computations with stateful kernels.

Required Methods

Computes the kernel on the given input, outputting into the given output. StatefulUnaryKernels have internal state. This results in several properties:

  • Even if the output is sufficiently large, not all input samples may be consumed.
  • A given instantiated kernel must be called sequentially on a single stream of data. Switching between data streams with a single kernel will result in undefined behaviour.

Note that all StatefulUnaryKernels implement UnaryKernel by definition.

Returns a tuple containing, in order:

  • The number of samples consumed from the input,
  • The number of samples produced in the output, and
  • A ComputationStatus which indicates whether the buffers were undersized.

Elements of output beyond what is produced are left in an unspecified state.

Implementors