[][src]Struct threshold::maxset::MaxSet

pub struct MaxSet { /* fields omitted */ }

Trait Implementations

impl EventSet for MaxSet[src]

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));

impl IntoIterator for MaxSet[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 MaxSet into iterator with all events from lowest to highest.

Examples

use threshold::*;

let mut maxset = MaxSet::new();
maxset.add_event(3);

let mut iter = maxset.into_iter();
assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next(), Some(3));
assert_eq!(iter.next(), None);

impl Clone for MaxSet[src]

impl Eq for MaxSet[src]

impl PartialEq<MaxSet> for MaxSet[src]

impl Debug for MaxSet[src]

impl StructuralPartialEq for MaxSet[src]

impl StructuralEq for MaxSet[src]

Auto Trait Implementations

impl Send for MaxSet

impl Sync for MaxSet

impl Unpin for MaxSet

impl UnwindSafe for MaxSet

impl RefUnwindSafe for MaxSet

Blanket Implementations

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

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

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = !

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.

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

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

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