[−][src]Struct eggtimer::TimedList
An iterable list structure where each element has an associated Duration
.
When an element's Duration
has elapsed, the element is removed from the
list upon the next mutable function call. Timed-out elements will never be iterated over.
Methods
impl<T> TimedList<T>
[src]
pub fn new() -> TimedList<T>
[src]
Creates a new TimedList
pub fn insert<D: ToDuration>(&mut self, element: T, time: D)
[src]
Inserts an element into the list with the given number of floating-point seconds
pub fn clean(&mut self)
[src]
Forces the removal of all elements whose Duration
has elpased.
This method does not need to be called manually unless you
want to explicitely free the memory of timed-out elements immediately.
pub fn clear(&mut self)
[src]
Removes all elements from the list
pub fn len(&self) -> usize
[src]
Gets the number of elements in the list that have not timed out.
pub fn is_empty(&self) -> bool
[src]
Check if the list is empty or if all existing elements have timed out.
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&T) -> bool,
[src]
F: FnMut(&T) -> bool,
Retains elements in the list that match the predicate
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &T>
[src]
Iterates immutably through all elements.
While this method does not remove timed-out elements, it does filter them out. If iteration takes sufficiently long, elements that may have been valid when iteration began may be skipped when they are actually iterated over.
pub fn iter_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut T>
[src]
Iterates mutably through all elements.
If iteration takes sufficiently long, elements that may have been valid when iteration began may be skipped when they are actually iterated over.
pub fn timer_iter(&self) -> impl DoubleEndedIterator<Item = (&T, EggTimer)>
[src]
Iterates immutably through all elements and their timers.
While this method does not remove timed-out elements, it does filter them out. If iteration takes sufficiently long, elements that may have been valid when iteration began may be skipped when they are actually iterated over.
pub fn timer_iter_mut(
&mut self
) -> impl DoubleEndedIterator<Item = (&mut T, EggTimer)>
[src]
&mut self
) -> impl DoubleEndedIterator<Item = (&mut T, EggTimer)>
Iterates mutably through all elements.
If iteration takes sufficiently long, elements that may have been valid when iteration began may be skipped when they are actually iterated over.
Trait Implementations
impl<T: PartialOrd> PartialOrd<TimedList<T>> for TimedList<T>
[src]
fn partial_cmp(&self, other: &TimedList<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &TimedList<T>) -> bool
[src]
fn le(&self, other: &TimedList<T>) -> bool
[src]
fn gt(&self, other: &TimedList<T>) -> bool
[src]
fn ge(&self, other: &TimedList<T>) -> bool
[src]
impl<T: PartialEq> PartialEq<TimedList<T>> for TimedList<T>
[src]
impl<T> IntoIterator for TimedList<T> where
T: 'static,
[src]
T: 'static,
type Item = T
The type of the elements being iterated over.
type IntoIter = Box<dyn DoubleEndedIterator<Item = T>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T: Default> Default for TimedList<T>
[src]
impl<T: Clone> Clone for TimedList<T>
[src]
fn clone(&self) -> TimedList<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for TimedList<T>
[src]
impl<T, D> FromIterator<(T, D)> for TimedList<T> where
D: ToDuration,
[src]
D: ToDuration,
fn from_iter<I: IntoIterator<Item = (T, D)>>(iter: I) -> Self
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,