EventSet

Trait EventSet 

Source
pub trait EventSet:
    Clone
    + Debug
    + Default {
    type EventIter: Iterator<Item = u64>;

Show 14 methods // Required methods fn new() -> Self; fn next_event(&mut self) -> u64; fn add_event(&mut self, event: u64) -> bool; fn is_event(&self, event: u64) -> bool; fn events(&self) -> (u64, Vec<u64>); fn frontier(&self) -> u64; fn join(&mut self, other: &Self); fn meet(&mut self, other: &Self); fn subtracted(&self, other: &Self) -> Vec<u64>; fn event_iter(self) -> Self::EventIter; // Provided methods fn from_event(event: u64) -> Self { ... } fn from_event_range(start: u64, end: u64) -> Self { ... } fn from_events<I: IntoIterator<Item = u64>>(iter: I) -> Self { ... } fn add_event_range(&mut self, start: u64, end: u64) -> bool { ... }
}
Expand description

EventSet trait to be implemented by MaxSet, BelowExSet and AboveExSet.

Required Associated Types§

Required Methods§

Source

fn new() -> Self

Returns a new instance.

Source

fn next_event(&mut self) -> u64

Generates the next event.

Source

fn add_event(&mut self, event: u64) -> bool

Adds an event to the set.

Source

fn is_event(&self, event: u64) -> bool

Checks if an event is part of the set.

Source

fn events(&self) -> (u64, Vec<u64>)

Returns all events seen as a pair.

For MaxSet:

  • the first component is the highest event
  • the second component is empty

For BelowExSet:

  • the first component is the highest event
  • the second component is a set of exceptions

For AboveExSet:

  • the first component is the highest event in a contiguous sequence
  • the second component is a set of outstanding events

If we’ve seen events [1, 2, 3, 5, 6], this function returns in

  • MaxSet: (6, [])
  • BelowExSet: (6, [4])
  • AboveExSet: (3, [5, 6])
Source

fn frontier(&self) -> u64

Returns the frontier (the highest contiguous event seen).

Source

fn join(&mut self, other: &Self)

Merges other EventSet into self.

Source

fn meet(&mut self, other: &Self)

Intersects other EventSet with self.

Source

fn subtracted(&self, other: &Self) -> Vec<u64>

Return a list of events that remain when other is subtracted from self.

Source

fn event_iter(self) -> Self::EventIter

Returns an iterator containing all elements represented by this event set.

Provided Methods§

Source

fn from_event(event: u64) -> Self

Creates a new instance from event.

Source

fn from_event_range(start: u64, end: u64) -> Self

Creates a new instance from a range of events.

Source

fn from_events<I: IntoIterator<Item = u64>>(iter: I) -> Self

Creates a new instance from several events.

Source

fn add_event_range(&mut self, start: u64, end: u64) -> bool

Adds a range of events to the set.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§