pub struct EventLedger { /* private fields */ }Expand description
Ordered store of events grouped by run, allocating sequence numbers.
§Examples
let mut ledger = EventLedger::new();
let run = Ref::Symbol(Symbol::new("run"));
let request = Ref::Symbol(Symbol::new("request"));
let started = ledger.started(run.clone(), request).unwrap();
let done = ledger.done(run.clone()).unwrap();
assert_eq!(started.seq, 0);
assert_eq!(done.seq, 1);
assert_eq!(ledger.len_for_run(&run), 2);Implementations§
Source§impl EventLedger
impl EventLedger
Sourcepub fn len_for_run(&self, run: &Ref) -> usize
pub fn len_for_run(&self, run: &Ref) -> usize
Number of events recorded for run.
Sourcepub fn events_for_run(&self, run: &Ref) -> &[Event]
pub fn events_for_run(&self, run: &Ref) -> &[Event]
Events recorded for run, in order.
Sourcepub fn push(&mut self, run: Ref, kind: EventKind) -> Result<Event>
pub fn push(&mut self, run: Ref, kind: EventKind) -> Result<Event>
Append an event of kind to run with no ticks.
Sourcepub fn push_with_ticks(
&mut self,
run: Ref,
ticks: Vec<Tick>,
kind: EventKind,
) -> Result<Event>
pub fn push_with_ticks( &mut self, run: Ref, ticks: Vec<Tick>, kind: EventKind, ) -> Result<Event>
Append an event of kind to run carrying the given ticks.
Sourcepub fn started(&mut self, run: Ref, request: Ref) -> Result<Event>
pub fn started(&mut self, run: Ref, request: Ref) -> Result<Event>
Append a EventKind::Started event to run.
Sourcepub fn final_value(&mut self, run: Ref, value: Ref) -> Result<Event>
pub fn final_value(&mut self, run: Ref, value: Ref) -> Result<Event>
Append a EventKind::Final event to run.
Trait Implementations§
Source§impl Clone for EventLedger
impl Clone for EventLedger
Source§fn clone(&self) -> EventLedger
fn clone(&self) -> EventLedger
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EventLedger
impl Debug for EventLedger
Source§impl Default for EventLedger
impl Default for EventLedger
Source§fn default() -> EventLedger
fn default() -> EventLedger
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EventLedger
impl RefUnwindSafe for EventLedger
impl Send for EventLedger
impl Sync for EventLedger
impl Unpin for EventLedger
impl UnsafeUnpin for EventLedger
impl UnwindSafe for EventLedger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more