pub struct RecordingObserver { /* private fields */ }Expand description
A recording observer that stores all events.
Useful for testing and debugging protocol execution.
Implementations§
Source§impl RecordingObserver
impl RecordingObserver
Sourcepub fn events(&self) -> &[ProtocolEvent]
pub fn events(&self) -> &[ProtocolEvent]
Get all recorded events.
Sourcepub fn take_events(&mut self) -> Vec<ProtocolEvent>
pub fn take_events(&mut self) -> Vec<ProtocolEvent>
Take all recorded events, clearing the observer.
Sourcepub fn sends(&self) -> impl Iterator<Item = &ProtocolEvent>
pub fn sends(&self) -> impl Iterator<Item = &ProtocolEvent>
Get send events only.
Sourcepub fn recvs(&self) -> impl Iterator<Item = &ProtocolEvent>
pub fn recvs(&self) -> impl Iterator<Item = &ProtocolEvent>
Get recv events only.
Sourcepub fn errors(&self) -> impl Iterator<Item = &ProtocolEvent>
pub fn errors(&self) -> impl Iterator<Item = &ProtocolEvent>
Get error events only.
Trait Implementations§
Source§impl Debug for RecordingObserver
impl Debug for RecordingObserver
Source§impl Default for RecordingObserver
impl Default for RecordingObserver
Source§fn default() -> RecordingObserver
fn default() -> RecordingObserver
Returns the “default value” for a type. Read more
Source§impl ProtocolObserver for RecordingObserver
impl ProtocolObserver for RecordingObserver
Source§fn on_phase_start(&mut self, protocol: &str, role: &str, phase: &str)
fn on_phase_start(&mut self, protocol: &str, role: &str, phase: &str)
Called when a protocol phase starts.
Source§fn on_phase_end(&mut self, protocol: &str, role: &str, phase: &str)
fn on_phase_end(&mut self, protocol: &str, role: &str, phase: &str)
Called when a protocol phase ends.
Source§fn on_send(&mut self, from: &str, to: &str, msg_type: &str, size: usize)
fn on_send(&mut self, from: &str, to: &str, msg_type: &str, size: usize)
Called when a message is sent.
Source§fn on_recv(&mut self, from: &str, to: &str, msg_type: &str, size: usize)
fn on_recv(&mut self, from: &str, to: &str, msg_type: &str, size: usize)
Called when a message is received.
Source§fn on_choice(&mut self, decider: &str, branch: &str)
fn on_choice(&mut self, decider: &str, branch: &str)
Called when a choice is made (internal choice).
Source§fn on_offer(&mut self, from: &str, branch: &str)
fn on_offer(&mut self, from: &str, branch: &str)
Called when a choice is received (external choice).
Source§fn on_error(&mut self, protocol: &str, role: &str, error: &ChoreographyError)
fn on_error(&mut self, protocol: &str, role: &str, error: &ChoreographyError)
Called when an error occurs.
Source§fn on_complete(&mut self, protocol: &str, role: &str)
fn on_complete(&mut self, protocol: &str, role: &str)
Called when the protocol completes successfully.
Auto Trait Implementations§
impl Freeze for RecordingObserver
impl RefUnwindSafe for RecordingObserver
impl Send for RecordingObserver
impl Sync for RecordingObserver
impl Unpin for RecordingObserver
impl UnsafeUnpin for RecordingObserver
impl UnwindSafe for RecordingObserver
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
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<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Casts the value.
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.