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§
Required Methods§
Sourcefn measurement<C: Clock>(
&mut self,
m: Measurement,
clock: &mut C,
) -> FilterUpdate
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
Sourcefn update<C: Clock>(&mut self, clock: &mut C) -> FilterUpdate
fn update<C: Clock>(&mut self, clock: &mut C) -> FilterUpdate
Update initiated through FilterUpdate::next_update timeout.
Sourcefn demobilize<C: Clock>(self, clock: &mut C)
fn demobilize<C: Clock>(self, clock: &mut C)
Handle ending of time synchronization from the source associated with this filter.
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.