pub struct PublishedContext(/* private fields */);Expand description
What one dispatch published beside its answer, passed back beside the
sink rather than on the wire. A tool’s adapter fills it with the tool’s
whole context (a second publish replaces the first); any other layer,
such as a stream rewrite
(ErasedHandler::map_stream),
adds single facts with insert.
Implementations§
Source§impl PublishedContext
impl PublishedContext
Sourcepub fn result_context(&self) -> Option<ToolResultContext>
pub fn result_context(&self) -> Option<ToolResultContext>
The recorder’s non-consuming snapshot. Publish before resolving the sink; values published after resolution are not part of that outcome.
Sourcepub fn publish(&self, context: ToolContext)
pub fn publish(&self, context: ToolContext)
The adapter’s write: the context after the tool ran, scopes cleared. All publication must finish before resolving the sink. Publishing afterward violates the delivery contract: consumers and recorders may observe different versions. The slot does not enforce this ordering.
Sourcepub fn insert<T: ContextValue>(
&self,
value: T,
) -> Result<Option<T>, ToolContextError>
pub fn insert<T: ContextValue>( &self, value: T, ) -> Result<Option<T>, ToolContextError>
Adds value to what is published, beside what is there, as
ToolContext::insert_result does, and returns the value it
replaced. Publish before the dispatch’s answer is resolved, as for
publish.
§Errors
When value cannot be encoded; nothing changes then.
Sourcepub fn take(&self) -> Option<ToolContext>
pub fn take(&self) -> Option<ToolContext>
The driver’s read: what was published, if anything, leaving nothing.
Trait Implementations§
Source§impl Debug for PublishedContext
impl Debug for PublishedContext
Auto Trait Implementations§
impl !Freeze for PublishedContext
impl RefUnwindSafe for PublishedContext
impl Send for PublishedContext
impl Sync for PublishedContext
impl Unpin for PublishedContext
impl UnsafeUnpin for PublishedContext
impl UnwindSafe for PublishedContext
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> 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