[−][src]Struct phreak_engine::datastructs::lifespanlist::LifespanList
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]
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
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]
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
impl<T, U> Default for LifespanList<T, U> where
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
[src]
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
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]
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
T: Deserialize<'de>,
U: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T, U> Index<usize> for LifespanList<T, U> where
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
[src]
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
type Output = Bucket<T, U>
The returned type after indexing.
fn index(&self, index: usize) -> &Self::Output
[src]
impl<T, U> IndexMut<usize> for LifespanList<T, U> where
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
[src]
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
impl<T, U> Serialize for LifespanList<T, U> where
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
T: Serialize,
U: Serialize,
[src]
T: PartialEq + Copy,
U: PartialOrd + PartialEq + Copy,
T: Serialize,
U: Serialize,
Auto Trait Implementations
impl<T, U> RefUnwindSafe for LifespanList<T, U> where
T: RefUnwindSafe,
U: RefUnwindSafe,
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for LifespanList<T, U> where
T: Send,
U: Send,
T: Send,
U: Send,
impl<T, U> Sync for LifespanList<T, U> where
T: Sync,
U: Sync,
T: Sync,
U: Sync,
impl<T, U> Unpin for LifespanList<T, U> where
T: Unpin,
U: Unpin,
T: Unpin,
U: Unpin,
impl<T, U> UnwindSafe for LifespanList<T, U> where
T: UnwindSafe,
U: UnwindSafe,
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,