pub struct PendingContext { /* private fields */ }Expand description
Thread-safe buffer for pending context turns awaiting delivery.
Context is queued by the control plane (lifecycle steps 7d/7e/7f/12/13)
and drained by DeferredWriter before the next user interaction.
§Thread safety
Uses parking_lot::Mutex — fast uncontested locking, no poisoning.
The control lane pushes once per turn; user sends drain once per frame.
Contention is near-zero.
Implementations§
Source§impl PendingContext
impl PendingContext
Sourcepub fn new() -> PendingContext
pub fn new() -> PendingContext
Create an empty pending context buffer.
Sourcepub fn set_prompt(&self)
pub fn set_prompt(&self)
Mark that a prompt (turnComplete:true) should follow the next flush.
Sourcepub fn drain(&self) -> (Vec<Content>, bool)
pub fn drain(&self) -> (Vec<Content>, bool)
Drain all pending context, returning the contents and whether to prompt.
After this call, the buffer is empty and the prompt flag is cleared.
Sourcepub fn drain_context(&self) -> Vec<Content>
pub fn drain_context(&self) -> Vec<Content>
Drain only context turns, leaving any pending prompt armed.
Sourcepub fn take_prompt(&self) -> bool
pub fn take_prompt(&self) -> bool
Take and clear the pending prompt flag without touching queued context.
Sourcepub fn clear_prompt(&self)
pub fn clear_prompt(&self)
Clear any armed prompt without touching queued context.
Sourcepub fn has_prompt(&self) -> bool
pub fn has_prompt(&self) -> bool
Return whether a prompt is currently armed.
Trait Implementations§
Source§impl Default for PendingContext
impl Default for PendingContext
Source§fn default() -> PendingContext
fn default() -> PendingContext
Auto Trait Implementations§
impl !Freeze for PendingContext
impl !RefUnwindSafe for PendingContext
impl Send for PendingContext
impl Sync for PendingContext
impl Unpin for PendingContext
impl UnwindSafe for PendingContext
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].