pub struct ObservationSink<'a> { /* private fields */ }Expand description
Where a payload projector writes its observation facts.
A projector reads verdicts, ids and error envelopes off a raw payload
before normalization discards them. Text it forwards must go through
Self::scrub: a payload can echo credentials.
Usage is not a projector’s to report: the driver observes it once, from the usage the decoder normalized into the reply’s end.
ⓘ
use rig_core::wire::{AdapterEvent, AdapterUsage, ObservationSink};
// A projector cannot parse usage a second time off the raw payload.
fn project(sink: &mut ObservationSink<'_>) {
sink.emit(AdapterEvent::Usage {
usage: AdapterUsage::default(),
});
}Implementations§
Source§impl ObservationSink<'_>
impl ObservationSink<'_>
Sourcepub fn error(&mut self, error: AdapterErrorEnvelope)
pub fn error(&mut self, error: AdapterErrorEnvelope)
Record the provider’s error envelope.
Sourcepub fn provider(&mut self, verdict: AdapterVerdict, response_id: Option<String>)
pub fn provider(&mut self, verdict: AdapterVerdict, response_id: Option<String>)
Record the provider’s verdict, and the response id it named.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ObservationSink<'a>
impl<'a> !UnwindSafe for ObservationSink<'a>
impl<'a> Freeze for ObservationSink<'a>
impl<'a> Send for ObservationSink<'a>
impl<'a> Sync for ObservationSink<'a>
impl<'a> Unpin for ObservationSink<'a>
impl<'a> UnsafeUnpin for ObservationSink<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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