pub trait LogSourceAsync {
// Required methods
fn latest(
&mut self,
sensor_id: u16,
buf: &mut [u8],
) -> impl Future<Output = Result<Option<(EntryHeader, usize)>, Error>>;
fn oldest(
&mut self,
sensor_id: u16,
buf: &mut [u8],
) -> impl Future<Output = Result<Option<(EntryHeader, usize)>, Error>>;
fn count(
&mut self,
sensor_id: Option<u16>,
) -> impl Future<Output = Result<u32, Error>>;
fn query_range(
&mut self,
sensor_id: Option<u16>,
t_start: u64,
t_end: u64,
callback: &mut dyn FnMut(&EntryHeader, &[u8]) -> bool,
) -> impl Future<Output = Result<u32, Error>>;
}Expand description
Async mirror of LogSource.
Not object-safe — a trait with impl Future returns cannot be — so generic
code over this port dispatches statically. That is the default this crate
wants anyway.
Required Methods§
Sourcefn latest(
&mut self,
sensor_id: u16,
buf: &mut [u8],
) -> impl Future<Output = Result<Option<(EntryHeader, usize)>, Error>>
fn latest( &mut self, sensor_id: u16, buf: &mut [u8], ) -> impl Future<Output = Result<Option<(EntryHeader, usize)>, Error>>
The most recent entry for a sensor, or None if it has none.
Sourcefn oldest(
&mut self,
sensor_id: u16,
buf: &mut [u8],
) -> impl Future<Output = Result<Option<(EntryHeader, usize)>, Error>>
fn oldest( &mut self, sensor_id: u16, buf: &mut [u8], ) -> impl Future<Output = Result<Option<(EntryHeader, usize)>, Error>>
The oldest retained entry for a sensor, or None if it has none.
Sourcefn count(
&mut self,
sensor_id: Option<u16>,
) -> impl Future<Output = Result<u32, Error>>
fn count( &mut self, sensor_id: Option<u16>, ) -> impl Future<Output = Result<u32, Error>>
Entries retained for a sensor, or for every sensor if None.
Sourcefn query_range(
&mut self,
sensor_id: Option<u16>,
t_start: u64,
t_end: u64,
callback: &mut dyn FnMut(&EntryHeader, &[u8]) -> bool,
) -> impl Future<Output = Result<u32, Error>>
fn query_range( &mut self, sensor_id: Option<u16>, t_start: u64, t_end: u64, callback: &mut dyn FnMut(&EntryHeader, &[u8]) -> bool, ) -> impl Future<Output = Result<u32, Error>>
Entries whose timestamp lies in [t_start, t_end], in log order.
The callback is synchronous: it inspects a payload the driver has already read, so there is nothing for it to await.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<F, const PAGE_SIZE: usize, const MAX_SECTORS: usize> LogSourceAsync for SensorDbAsync<F, PAGE_SIZE, MAX_SECTORS>where
F: NorFlash + ReadNorFlash,
Available on crate feature
async only.impl<S, C, const SP: usize, const SS: usize, const CP: usize, const CS: usize> LogSourceAsync for TieredDbAsync<S, C, SP, SS, CP, CS>
Available on crate feature
async only.