Skip to main content

UpdateAlgorithm

Trait UpdateAlgorithm 

Source
pub trait UpdateAlgorithm {
    // Required methods
    fn update_device_properties<'life0, 'async_trait>(
        &'life0 self,
        properties: Properties,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sample<'life0, 'async_trait>(
        &'life0 self,
        urgency: Urgency,
    ) -> Pin<Box<dyn Future<Output = Result<TimeSample, SampleError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn next_possible_sample_time<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = BootInstant> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An |UpdateAlgorithm| trait produces time samples on demand.

Required Methods§

Source

fn update_device_properties<'life0, 'async_trait>( &'life0 self, properties: Properties, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the algorithm’s knowledge of device properties.

Source

fn sample<'life0, 'async_trait>( &'life0 self, urgency: Urgency, ) -> Pin<Box<dyn Future<Output = Result<TimeSample, SampleError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Produce a new time sample, taking into account Urgency.

Source

fn next_possible_sample_time<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = BootInstant> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the reference time at which the next sample may be produced.

A reference timeline is always given on the boot timeline, which means it could fall in a time when the device was suspended. We may want to wake the device to sample time, but also may decide not to, depending on power policy.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§