Skip to main content

ExportFilter

Struct ExportFilter 

Source
pub struct ExportFilter<T> {
    settings: ChannelFilterSettings,
    block: usize,
    probe: VecDeque<(i64, f64, T)>,
    segment: Option<Segment>,
    queue: VecDeque<Entry<T>>,
    ready: usize,
    scratch: Vec<f64>,
}
Expand description

Rows of one channel, in time order, filtered with the zero-phase pipeline.

Rows go in one at a time with Self::push and come out, in the same order, with their filtered value once it is settled. The sample interval is taken as the median step of the first rows of each segment. A step of up to MAX_FILLED_GAP_SAMPLES missing samples is filled with NaN; a longer gap, a step that is not close to a whole number of intervals, or a new rate ends the segment and every filter (templates included) starts over. Rows whose timestamp is not after the previous one are passed through with NaN.

Memory stays bounded: once block + margin samples wait, the backward pass runs from the newest sample (its state settled over margin samples) and the oldest block rows come out.

Fields§

§settings: ChannelFilterSettings§block: usize§probe: VecDeque<(i64, f64, T)>

Rows waiting for the interval to be estimated.

§segment: Option<Segment>§queue: VecDeque<Entry<T>>§ready: usize

Entries at the front of queue whose forward value is known.

§scratch: Vec<f64>

Implementations§

Source§

impl<T> ExportFilter<T>

Source

pub const BLOCK: usize = 65_536

Default rows per backward pass.

Source

pub fn new(settings: ChannelFilterSettings) -> Self

Source

pub fn with_block(settings: ChannelFilterSettings, block: usize) -> Self

Source

pub fn push( &mut self, timestamp_ns: i64, raw: f64, row: T, calibrate: &dyn Fn(&T, f64) -> f64, out: &mut Vec<FilteredRow<T>>, )

Adds one row and appends the rows that are done to out.

  • timestamp_ns - Sample time.
  • raw - Raw value.
  • row - The caller’s row, handed back with the filtered value.
  • calibrate - Converts a (filtered) raw value of a row into its unit.
Source

pub fn finish( &mut self, calibrate: &dyn Fn(&T, f64) -> f64, out: &mut Vec<FilteredRow<T>>, )

Filters and hands back every row still held.

Source

fn start_from_probe( &mut self, calibrate: &dyn Fn(&T, f64) -> f64, out: &mut Vec<FilteredRow<T>>, )

Starts a segment with the interval estimated from the probe rows, then feeds them.

Source

fn begin_segment(&mut self, interval_ns: i64, first_ns: i64)

Source

fn push_in_segment( &mut self, timestamp_ns: i64, raw: f64, row: T, calibrate: &dyn Fn(&T, f64) -> f64, out: &mut Vec<FilteredRow<T>>, )

Source

fn feed(&mut self, raw: f64, row: Option<T>, calibrate: &dyn Fn(&T, f64) -> f64)

Queues one sample and runs it through the causal part.

Source

fn apply_forward(&mut self, values: &[f64], calibrate: &dyn Fn(&T, f64) -> f64)

Stores forward values for the oldest fed entries that lack one.

Source

fn advance_ready(&mut self)

Moves ready over unfed entries that directly follow the ready ones.

Source

fn drain_settled( &mut self, _calibrate: &dyn Fn(&T, f64) -> f64, out: &mut Vec<FilteredRow<T>>, all: bool, )

Runs the backward pass and hands back settled rows: block of them once block + margin are ready, or all of them when all is set.

Source

fn end_segment( &mut self, calibrate: &dyn Fn(&T, f64) -> f64, out: &mut Vec<FilteredRow<T>>, )

Flushes the causal part, hands back every queued row and forgets the segment.

Auto Trait Implementations§

§

impl<T> Freeze for ExportFilter<T>

§

impl<T> RefUnwindSafe for ExportFilter<T>
where T: RefUnwindSafe,

§

impl<T> Send for ExportFilter<T>
where T: Send,

§

impl<T> Sync for ExportFilter<T>
where T: Sync,

§

impl<T> Unpin for ExportFilter<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for ExportFilter<T>

§

impl<T> UnwindSafe for ExportFilter<T>
where T: UnwindSafe,

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more