pub struct RecordBuffer { /* private fields */ }Expand description
Collects the record of every dispatch it is told about, in the order the
dispatches began, whatever order they resolve in. A dispatch recorded by
it (Dispatch::recorded_by), and every
dispatch nested in it, becomes one EffectRecord once resolved: a
layer’s discard drops it and a
patch replaces its request, as an effect log keeps
them. Clones share the records.
It keeps no handler descriptions and no delivery boundaries: an owner
that writes a log keeps those itself. Its records are
Disposition::Ran with no reviewed outcome; a host that answers,
reviews or cancels effects itself sets those on the records it takes.
Implementations§
Source§impl RecordBuffer
impl RecordBuffer
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty buffer that records a stream as its folded outcome and keeps no times.
Sourcepub fn keeping_stream_events(self) -> Self
pub fn keeping_stream_events(self) -> Self
This buffer keeping a streamed dispatch’s items verbatim in its
record (EffectRecord::events), so a replay re-emits the original
delta boundaries.
Sourcepub fn timed(self) -> Self
pub fn timed(self) -> Self
This buffer stamping each record with the wall-clock time its
dispatch began (EffectRecord::started_ms) and resolved
(EffectRecord::finished_ms). Without it records carry no times,
so a recording is the same on every run.
Sourcepub fn take(&self, id: EffectId) -> Option<EffectRecord>
pub fn take(&self, id: EffectId) -> Option<EffectRecord>
Takes the record of id once it resolved; None while it is in
flight, or when the buffer has none.
Sourcepub fn take_resolved(&self) -> Vec<EffectRecord>
pub fn take_resolved(&self) -> Vec<EffectRecord>
Takes every resolved record, in the order the dispatches began, leaving the ones in flight.
Sourcepub fn take_resolved_where(
&self,
take: impl FnMut(EffectId) -> bool,
) -> Vec<EffectRecord>
pub fn take_resolved_where( &self, take: impl FnMut(EffectId) -> bool, ) -> Vec<EffectRecord>
Takes every resolved record whose id take accepts, in the order
the dispatches began, leaving the rest.
Sourcepub fn records(&self) -> Vec<EffectRecord>
pub fn records(&self) -> Vec<EffectRecord>
A copy of every resolved record, in the order the dispatches began.
Sourcepub fn contains(&self, id: EffectId) -> bool
pub fn contains(&self, id: EffectId) -> bool
Whether the buffer holds a record of id, resolved or not.
Sourcepub fn remove(&self, id: EffectId) -> Option<HandlerKey>
pub fn remove(&self, id: EffectId) -> Option<HandlerKey>
Drops the record of id, resolved or not; the key its dispatch was
routed to, or None when the buffer held none.
Sourcepub fn kept_events(&self, id: EffectId) -> Option<usize>
pub fn kept_events(&self, id: EffectId) -> Option<usize>
How many streamed items the record of id keeps so far, or None
when it keeps none.
Trait Implementations§
Source§impl Clone for RecordBuffer
impl Clone for RecordBuffer
Source§impl Debug for RecordBuffer
impl Debug for RecordBuffer
Source§impl Default for RecordBuffer
impl Default for RecordBuffer
Source§impl Recorder for RecordBuffer
impl Recorder for RecordBuffer
Source§fn handlers(&self, _handlers: Vec<HandlerDescriptor>)
fn handlers(&self, _handlers: Vec<HandlerDescriptor>)
Source§fn begin(
&self,
id: EffectId,
key: HandlerKey,
kind: EffectKind,
origin: DispatchContext,
)
fn begin( &self, id: EffectId, key: HandlerKey, kind: EffectKind, origin: DispatchContext, )
Source§fn discard(&self, id: EffectId)
fn discard(&self, id: EffectId)
Source§fn patch(&self, id: EffectId, kind: EffectKind)
fn patch(&self, id: EffectId, kind: EffectKind)
Source§fn keep_events(&self) -> bool
fn keep_events(&self) -> bool
Self::event).Source§fn origin(&self, id: EffectId, origin: &Origin)
fn origin(&self, id: EffectId, origin: &Origin)
id is from, before its first item, when
keep_events says so.Source§fn tool_output(&self, id: EffectId, output: ToolResultContext)
fn tool_output(&self, id: EffectId, output: ToolResultContext)
resolve. A driver snapshots it without consuming the
caller’s published context.Source§fn stream_error(&self, _id: EffectId, _error: &ErrorReport)
fn stream_error(&self, _id: EffectId, _error: &ErrorReport)
Auto Trait Implementations§
impl Freeze for RecordBuffer
impl RefUnwindSafe for RecordBuffer
impl Send for RecordBuffer
impl Sync for RecordBuffer
impl Unpin for RecordBuffer
impl UnsafeUnpin for RecordBuffer
impl UnwindSafe for RecordBuffer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more