[−][src]Struct threshold::maxset::MaxSet
Trait Implementations
impl Clone for MaxSet
[src]
impl Debug for MaxSet
[src]
impl Eq for MaxSet
[src]
impl EventSet for MaxSet
[src]
type EventIter = EventIter
fn new() -> Self
[src]
Returns a new MaxSet
instance.
fn next_event(&mut self) -> u64
[src]
Generates the next event.
Examples
use threshold::*; let mut maxset = MaxSet::new(); assert_eq!(maxset.next_event(), 1); assert_eq!(maxset.next_event(), 2);
fn add_event(&mut self, event: u64) -> bool
[src]
Adds an event to the set.
Returns true
if it's a new event.
Examples
use threshold::*; let mut maxset = MaxSet::new(); assert!(!maxset.is_event(9)); assert!(!maxset.is_event(10)); maxset.add_event(10); assert!(maxset.is_event(9)); assert!(maxset.is_event(10));
fn add_event_range(&mut self, start: u64, end: u64) -> bool
[src]
Adds a range of events to the set.
Returns true
if a new event was added.
In the case of MaxSet
we have that:
add_event_range(start, end) == add_event(end)
fn is_event(&self, event: u64) -> bool
[src]
Checks if an event is part of the set.
Examples
use threshold::*; let mut maxset = MaxSet::new(); let event = maxset.next_event(); assert!(maxset.is_event(event));
fn events(&self) -> (u64, Vec<u64>)
[src]
Returns all events seen.
Examples
use threshold::*; let mut maxset = MaxSet::new(); maxset.add_event(2); maxset.add_event(4); assert_eq!(maxset.events(), (4, vec![]));
fn frontier(&self) -> u64
[src]
Returns the frontier (the highest contiguous event seen).
For a MaxSet
, this is not necessarily the highest contiguous event,
but simply the highest event.
For exact EventSet
representations that will actually return the
highest contiguous event, see AboveExSet
and BelowExSet
.
Examples
use threshold::*; let mut maxset = MaxSet::new(); assert_eq!(maxset.frontier(), 0); maxset.add_event(1); assert_eq!(maxset.frontier(), 1); maxset.add_event(3); assert_eq!(maxset.frontier(), 3); maxset.add_event(2); assert_eq!(maxset.frontier(), 3); maxset.add_event(4); assert_eq!(maxset.frontier(), 4); maxset.add_event(6); assert_eq!(maxset.frontier(), 6);
fn join(&mut self, other: &Self)
[src]
Merges other
MaxSet
into self
.
Examples
use threshold::*; let mut maxset = MaxSet::from_event(10); assert!(!maxset.is_event(20)); maxset.join(&MaxSet::from_event(20)); assert!(maxset.is_event(20));
fn event_iter(self) -> Self::EventIter
[src]
Returns a MaxSet
event iterator with all events from lowest to
highest.
Examples
use threshold::*; let mut maxset = MaxSet::new(); maxset.add_event(3); let mut iter = maxset.event_iter(); assert_eq!(iter.next(), Some(1)); assert_eq!(iter.next(), Some(2)); assert_eq!(iter.next(), Some(3)); assert_eq!(iter.next(), None);
fn from_event(event: u64) -> Self
[src]
fn from_event_range(start: u64, end: u64) -> Self
[src]
fn from_events<I: IntoIterator<Item = u64>>(iter: I) -> Self
[src]
impl PartialEq<MaxSet> for MaxSet
[src]
impl StructuralEq for MaxSet
[src]
impl StructuralPartialEq for MaxSet
[src]
Auto Trait Implementations
impl RefUnwindSafe for MaxSet
impl Send for MaxSet
impl Sync for MaxSet
impl Unpin for MaxSet
impl UnwindSafe for MaxSet
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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<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>,