[−][src]Struct threshold::above_exset::AboveExSet
Methods
impl AboveExSet
[src]
pub fn from<I: IntoIterator<Item = u64>>(max: u64, iter: I) -> Self
[src]
Creates a new instance from the highest contiguous event, and a sequence of extra events.
Examples
use threshold::*; let above_exset = AboveExSet::from(0, vec![2, 4, 5]); assert!(!above_exset.is_event(&1)); assert!(above_exset.is_event(&2)); assert!(!above_exset.is_event(&3)); assert!(above_exset.is_event(&4)); assert!(above_exset.is_event(&5)); assert!(!above_exset.is_event(&6));
Trait Implementations
impl EventSet for AboveExSet
[src]
fn new() -> Self
[src]
Returns a new AboveExSet
instance.
fn next_event(&mut self) -> u64
[src]
Generates the next event. There should be no extras when calling this.
Examples
use threshold::*; let mut above_exset = AboveExSet::new(); assert_eq!(above_exset.next_event(), 1); assert_eq!(above_exset.next_event(), 2);
fn add_event(&mut self, event: u64)
[src]
Adds an event to the set.
Examples
use threshold::*; let mut above_exset = AboveExSet::new(); above_exset.add_event(1); assert!(above_exset.is_event(&1)); assert!(!above_exset.is_event(&2)); above_exset.add_event(3); assert!(above_exset.is_event(&1)); assert!(!above_exset.is_event(&2)); assert!(above_exset.is_event(&3)); above_exset.add_event(2); assert!(above_exset.is_event(&1)); assert!(above_exset.is_event(&2)); assert!(above_exset.is_event(&3));
fn is_event(&self, event: &u64) -> bool
[src]
Checks if an event is part of the set.
Examples
use threshold::*; let mut above_exset = AboveExSet::new(); let event = above_exset.next_event(); assert!(above_exset.is_event(&event)); above_exset.add_event(3); assert!(!above_exset.is_event(&2)); assert!(above_exset.is_event(&3));
fn events(&self) -> (u64, Vec<u64>)
[src]
Returns all events seen as a tuple. The first component is the highest event seen, while the second is a vector with the exceptions (in no specific order).
Examples
use threshold::*; let mut above_exset = AboveExSet::new(); above_exset.add_event(1); assert_eq!(above_exset.events(), (1, vec![])); above_exset.add_event(3); assert_eq!(above_exset.events(), (1, vec![3])); above_exset.add_event(2); assert_eq!(above_exset.events(), (3, vec![])); above_exset.add_event(4); assert_eq!(above_exset.events(), (4, vec![])); above_exset.add_event(6); assert_eq!(above_exset.events(), (4, vec![6]));
fn frontier(&self) -> u64
[src]
Returns the frontier (the highest contiguous event seen).
Examples
use threshold::*; let mut above_exset = AboveExSet::new(); assert_eq!(above_exset.frontier(), 0); above_exset.add_event(1); assert_eq!(above_exset.frontier(), 1); above_exset.add_event(3); assert_eq!(above_exset.frontier(), 1); above_exset.add_event(2); assert_eq!(above_exset.frontier(), 3); above_exset.add_event(4); assert_eq!(above_exset.frontier(), 4); above_exset.add_event(6); assert_eq!(above_exset.frontier(), 4);
fn join(&mut self, other: &Self)
[src]
Merges other
AboveExSet
into self
.
Examples
use threshold::*; let mut above_exset = AboveExSet::new(); above_exset.add_event(1); above_exset.add_event(3); above_exset.add_event(4); assert_eq!(above_exset.events(), (1, vec![3, 4])); above_exset.join(&AboveExSet::from_event(3)); assert_eq!(above_exset.events(), (1, vec![3, 4])); above_exset.join(&AboveExSet::from_event(5)); assert_eq!(above_exset.events(), (1, vec![3, 4, 5])); let mut other = AboveExSet::new(); other.add_event(2); other.add_event(7); above_exset.join(&other); assert_eq!(above_exset.events(), (5, vec![7]));
fn from_event(event: u64) -> Self
[src]
Creates a new instance from event
.
fn from_events<I: IntoIterator<Item = u64>>(iter: I) -> Self
[src]
Creates a new instance from several events
.
impl Clone for AboveExSet
[src]
fn clone(&self) -> AboveExSet
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl IntoIterator for AboveExSet
[src]
type Item = u64
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Returns a AboveExSet
into iterator with all events from lowest to
highest.
Examples
use threshold::*; let mut above_exset = AboveExSet::new(); above_exset.add_event(3); above_exset.add_event(5); let mut iter = above_exset.into_iter(); assert_eq!(iter.next(), Some(3)); assert_eq!(iter.next(), Some(5)); assert_eq!(iter.next(), None);
impl PartialEq<AboveExSet> for AboveExSet
[src]
fn eq(&self, other: &AboveExSet) -> bool
[src]
fn ne(&self, other: &AboveExSet) -> bool
[src]
impl Eq for AboveExSet
[src]
impl Debug for AboveExSet
[src]
Auto Trait Implementations
impl Sync for AboveExSet
impl Send for AboveExSet
impl Unpin for AboveExSet
impl RefUnwindSafe for AboveExSet
impl UnwindSafe for AboveExSet
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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<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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,