pub struct TimeboundCircularBuffer<const S: usize, P>where
P: CuMsgPayload,{
pub inner: CircularBuffer<S, CuMsg<P>>,
}Expand description
An augmented circular buffer that allows for time-based operations.
Fields§
§inner: CircularBuffer<S, CuMsg<P>>Implementations§
Source§impl<const S: usize, P> TimeboundCircularBuffer<S, P>where
P: CuMsgPayload,
impl<const S: usize, P> TimeboundCircularBuffer<S, P>where
P: CuMsgPayload,
pub fn new() -> Self
Sourcepub fn iter_window(
&self,
start_time: CuTime,
end_time: CuTime,
) -> impl Iterator<Item = &CuMsg<P>>
pub fn iter_window( &self, start_time: CuTime, end_time: CuTime, ) -> impl Iterator<Item = &CuMsg<P>>
Gets a slice of messages that fall within the given time range. In case of a Tov::Range, the message is included if its start and end time fall within the range.
Sourcepub fn purge(&mut self, time_horizon: CuTime)
pub fn purge(&mut self, time_horizon: CuTime)
Remove all the messages that are older than the given time horizon.
Sourcepub fn most_recent_time(&self) -> CuResult<Option<CuTime>>
pub fn most_recent_time(&self) -> CuResult<Option<CuTime>>
Get the most recent time of the messages in the buffer.
Trait Implementations§
Source§impl<const S: usize, P> Default for TimeboundCircularBuffer<S, P>where
P: CuMsgPayload,
impl<const S: usize, P> Default for TimeboundCircularBuffer<S, P>where
P: CuMsgPayload,
Auto Trait Implementations§
impl<const S: usize, P> Freeze for TimeboundCircularBuffer<S, P>where
P: Freeze,
impl<const S: usize, P> RefUnwindSafe for TimeboundCircularBuffer<S, P>where
P: RefUnwindSafe,
impl<const S: usize, P> Send for TimeboundCircularBuffer<S, P>where
P: Send,
impl<const S: usize, P> Sync for TimeboundCircularBuffer<S, P>where
P: Sync,
impl<const S: usize, P> Unpin for TimeboundCircularBuffer<S, P>where
P: Unpin,
impl<const S: usize, P> UnwindSafe for TimeboundCircularBuffer<S, P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more