[][src]Struct eggtimer::TimedList

pub struct TimedList<T> { /* fields omitted */ }

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]

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]

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]

impl<T: PartialEq> PartialEq<TimedList<T>> for TimedList<T>[src]

impl<T> IntoIterator for TimedList<T> where
    T: 'static, 
[src]

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?

impl<T: Default> Default for TimedList<T>[src]

impl<T: Clone> Clone for 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]

Auto Trait Implementations

impl<T> Send for TimedList<T> where
    T: Send

impl<T> Sync for TimedList<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<I> IntoIterator for I where
    I: Iterator
[src]

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?

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.