pub struct TimeboundCircularBuffer<const S: usize, P, M>where
P: CuMsgPayload,
M: Metadata,{
pub inner: CircularBuffer<S, CuStampedData<P, M>>,
}Expand description
An augmented circular buffer that allows for time-based operations.
Fields§
§inner: CircularBuffer<S, CuStampedData<P, M>>Implementations§
Source§impl<const S: usize, P> TimeboundCircularBuffer<S, P, CuMsgMetadata>where
P: CuMsgPayload,
impl<const S: usize, P> TimeboundCircularBuffer<S, P, CuMsgMetadata>where
P: CuMsgPayload,
pub fn new() -> Self
Sourcepub fn iter_window(
&self,
start_time: CuTime,
end_time: CuTime,
) -> impl Iterator<Item = &CuStampedData<P, CuMsgMetadata>>
pub fn iter_window( &self, start_time: CuTime, end_time: CuTime, ) -> impl Iterator<Item = &CuStampedData<P, CuMsgMetadata>>
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.
Sourcepub fn push(&mut self, msg: CuStampedData<P, CuMsgMetadata>)
pub fn push(&mut self, msg: CuStampedData<P, CuMsgMetadata>)
Push a message into the buffer.
Trait Implementations§
Source§impl<const S: usize, P> Default for TimeboundCircularBuffer<S, P, CuMsgMetadata>where
P: CuMsgPayload,
impl<const S: usize, P> Default for TimeboundCircularBuffer<S, P, CuMsgMetadata>where
P: CuMsgPayload,
Auto Trait Implementations§
impl<const S: usize, P, M> Freeze for TimeboundCircularBuffer<S, P, M>
impl<const S: usize, P, M> RefUnwindSafe for TimeboundCircularBuffer<S, P, M>where
M: RefUnwindSafe,
P: RefUnwindSafe,
impl<const S: usize, P, M> Send for TimeboundCircularBuffer<S, P, M>
impl<const S: usize, P, M> Sync for TimeboundCircularBuffer<S, P, M>
impl<const S: usize, P, M> Unpin for TimeboundCircularBuffer<S, P, M>
impl<const S: usize, P, M> UnwindSafe for TimeboundCircularBuffer<S, P, M>where
M: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more