Struct wlancfg_lib::util::historical_list::HistoricalList
source · pub struct HistoricalList<T: Timestamped>(pub VecDeque<T>);
Expand description
Struct for list that stores historical data in a VecDeque, up to the some number of most recent entries.
Tuple Fields§
§0: VecDeque<T>
Implementations§
source§impl<T> HistoricalList<T>where
T: Timestamped + Clone,
impl<T> HistoricalList<T>where
T: Timestamped + Clone,
pub fn new(capacity: usize) -> Self
sourcepub fn add(&mut self, historical_data: T)
pub fn add(&mut self, historical_data: T)
Add a new entry, purging the oldest if at capacity. Entry must be newer than the most recent existing entry.
sourcepub fn get_recent(&self, earliest_time: Time) -> Vec<T>
pub fn get_recent(&self, earliest_time: Time) -> Vec<T>
Retrieve list of entries with a time more recent than earliest_time, sorted from oldest to newest. May be empty.
sourcepub fn get_before(&self, latest_time: Time) -> Vec<T>
pub fn get_before(&self, latest_time: Time) -> Vec<T>
Retrieve list of entries with a time before than latest_time, sorted from oldest to newest. May be empty.
sourcepub fn get_between(&self, earliest_time: Time, latest_time: Time) -> Vec<T>
pub fn get_between(&self, earliest_time: Time, latest_time: Time) -> Vec<T>
Retrieve list of entries inclusively between latest_time and earliest_time, sorted from oldest to newest. May be empty.
Trait Implementations§
source§impl<T: Clone + Timestamped> Clone for HistoricalList<T>
impl<T: Clone + Timestamped> Clone for HistoricalList<T>
source§fn clone(&self) -> HistoricalList<T>
fn clone(&self) -> HistoricalList<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug + Timestamped> Debug for HistoricalList<T>
impl<T: Debug + Timestamped> Debug for HistoricalList<T>
source§impl<T: PartialEq + Timestamped> PartialEq for HistoricalList<T>
impl<T: PartialEq + Timestamped> PartialEq for HistoricalList<T>
source§fn eq(&self, other: &HistoricalList<T>) -> bool
fn eq(&self, other: &HistoricalList<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<T: Timestamped> StructuralPartialEq for HistoricalList<T>
Auto Trait Implementations§
impl<T> Freeze for HistoricalList<T>
impl<T> RefUnwindSafe for HistoricalList<T>where
T: RefUnwindSafe,
impl<T> Send for HistoricalList<T>where
T: Send,
impl<T> Sync for HistoricalList<T>where
T: Sync,
impl<T> Unpin for HistoricalList<T>where
T: Unpin,
impl<T> UnwindSafe for HistoricalList<T>where
T: 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