Trait statime::filters::Filter

source ·
pub trait Filter {
    type Config: Clone;

    // Required methods
    fn new(config: Self::Config) -> Self;
    fn measurement<C: Clock>(
        &mut self,
        m: Measurement,
        clock: &mut C,
    ) -> FilterUpdate;
    fn update<C: Clock>(&mut self, clock: &mut C) -> FilterUpdate;
    fn demobilize<C: Clock>(self, clock: &mut C);
}
Expand description

A filter for post-processing time measurements.

Filters are responsible for dealing with the network noise, and should average out the input a bit so minor network variations are not immediately reflected in the synchronization of the clock.

This crate provides a simple BasicFilter which is suitable for most needs, but users can implement their own if desired.

Required Associated Types§

source

type Config: Clone

Configuration for this Filter

This is used to construct a new Filter instance using new.

Required Methods§

source

fn new(config: Self::Config) -> Self

Create a new instance of the filter.

source

fn measurement<C: Clock>( &mut self, m: Measurement, clock: &mut C, ) -> FilterUpdate

Put a new measurement in the filter. The filter can then use this to adjust the clock

source

fn update<C: Clock>(&mut self, clock: &mut C) -> FilterUpdate

Update initiated through FilterUpdate::next_update timeout.

source

fn demobilize<C: Clock>(self, clock: &mut C)

Handle ending of time synchronization from the source associated with this filter.

Object Safety§

This trait is not object safe.

Implementors§