pub struct Event {
pub run: Ref,
pub seq: u64,
pub ticks: Vec<Tick>,
pub kind: EventKind,
}Expand description
A timestamped record emitted during a run’s evaluation.
§Examples
let run = Ref::Symbol(Symbol::new("run"));
let event = Event::started(run, 0, Ref::Symbol(Symbol::new("request"))).unwrap();
assert!(matches!(event.kind, EventKind::Started { .. }));
// Ticks must carry distinct clocks.
let dup = vec![
Tick::new(Symbol::new("clock"), Ref::Symbol(Symbol::new("a"))),
Tick::new(Symbol::new("clock"), Ref::Symbol(Symbol::new("b"))),
];
assert!(
Event::new(Ref::Symbol(Symbol::new("run")), 1, dup, EventKind::Done).is_err()
);Fields§
§run: RefReference identifying the run that emitted the event.
seq: u64Per-run monotonic sequence number.
ticks: Vec<Tick>Logical-clock readings at the time of emission.
kind: EventKindThe event payload.
Implementations§
Source§impl Event
impl Event
Sourcepub fn new(
run: Ref,
seq: u64,
ticks: Vec<Tick>,
kind: EventKind,
) -> Result<Self>
pub fn new( run: Ref, seq: u64, ticks: Vec<Tick>, kind: EventKind, ) -> Result<Self>
Build an event after validating its ticks have distinct clocks.
Sourcepub fn started(run: Ref, seq: u64, request: Ref) -> Result<Self>
pub fn started(run: Ref, seq: u64, request: Ref) -> Result<Self>
Build a EventKind::Started event with no ticks.
Sourcepub fn final_value(run: Ref, seq: u64, value: Ref) -> Result<Self>
pub fn final_value(run: Ref, seq: u64, value: Ref) -> Result<Self>
Build a EventKind::Final event with no ticks.
Trait Implementations§
impl Eq for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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