[][src]Struct phreak_engine::datastructs::lifespanlist::LifespanList

pub struct LifespanList<T, U> where
    T: PartialEq + Copy,
    U: PartialOrd + PartialEq + Copy
{ /* fields omitted */ }

A list of items with a lifespan, which supports views at a given time.

A lifespan can be in the form of a start time and optional end time, but it can also be implemented using a monotonic increasing counter, where each moment in time is represented by a simple number, like a u64. Using an u64, you can generate a unique number at 1GHz for 600 years before you exhaust the number space.

Methods

impl<T, U> LifespanList<T, U> where
    T: PartialEq + Copy,
    U: PartialOrd + PartialEq + Copy
[src]

pub fn new() -> Self[src]

Create an empty list

pub fn with_capacity(capacity: usize) -> Self[src]

Create an empty list and reserve capacity

pub fn push_front(&mut self, begin: U, value: T)[src]

Put an item at the front of the list, which is valid starting from 'begin'

pub fn push_back(&mut self, begin: U, value: T)[src]

Put an item at the back of the list, which is valid starting from 'begin'

pub fn pop_front(&mut self) -> Option<T>[src]

Take an item at the front of the list

pub fn pop_back(&mut self) -> Option<T>[src]

Put an item at the back of the list

pub fn len(&self) -> usize[src]

Returns the total count of stored items

pub fn contains(&self, time: U, value: &T) -> bool[src]

pub fn clear(&mut self)[src]

pub fn cleanup(&mut self)[src]

Removes the items with an end time, leaving only the items which remain active at this point

pub fn iter(&self) -> Iter<Bucket<T, U>>[src]

Iterator over all items in the list

pub fn iter_mut(&mut self) -> IterMut<Bucket<T, U>>[src]

Mutable Iterator over all items in the list

pub fn iter_before(&self, time: U) -> IterBefore<T, U>[src]

Returns an iterator over the set at the time just before timestamp

pub fn iter_before_mut(&mut self, time: U) -> IterBeforeMut<T, U>[src]

Returns a mutable iterator over the set at the time just before timestamp

pub fn iter_at(&self, time: U) -> IterAt<T, U>[src]

Returns an iterator over the set at the given timestamp

pub fn iter_at_mut(&mut self, time: U) -> IterAtMut<T, U>[src]

Returns a mutable iterator over the set at the time just before timestamp

pub fn remove(&mut self, time: U, value: &T)[src]

Trait Implementations

impl<T: Debug, U: Debug> Debug for LifespanList<T, U> where
    T: PartialEq + Copy,
    U: PartialOrd + PartialEq + Copy
[src]

impl<T, U> Default for LifespanList<T, U> where
    T: PartialEq + Copy,
    U: PartialOrd + PartialEq + Copy
[src]

impl<'de, T, U> Deserialize<'de> for LifespanList<T, U> where
    T: PartialEq + Copy,
    U: PartialOrd + PartialEq + Copy,
    T: Deserialize<'de>,
    U: Deserialize<'de>, 
[src]

impl<T, U> Index<usize> for LifespanList<T, U> where
    T: PartialEq + Copy,
    U: PartialOrd + PartialEq + Copy
[src]

type Output = Bucket<T, U>

The returned type after indexing.

impl<T, U> IndexMut<usize> for LifespanList<T, U> where
    T: PartialEq + Copy,
    U: PartialOrd + PartialEq + Copy
[src]

impl<T, U> Serialize for LifespanList<T, U> where
    T: PartialEq + Copy,
    U: PartialOrd + PartialEq + Copy,
    T: Serialize,
    U: Serialize
[src]

Auto Trait Implementations

impl<T, U> RefUnwindSafe for LifespanList<T, U> where
    T: RefUnwindSafe,
    U: RefUnwindSafe

impl<T, U> Send for LifespanList<T, U> where
    T: Send,
    U: Send

impl<T, U> Sync for LifespanList<T, U> where
    T: Sync,
    U: Sync

impl<T, U> Unpin for LifespanList<T, U> where
    T: Unpin,
    U: Unpin

impl<T, U> UnwindSafe for LifespanList<T, U> where
    T: UnwindSafe,
    U: UnwindSafe

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.