Struct PendingContext
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§
§impl PendingContext
impl PendingContext
pub fn new() -> PendingContext
pub fn new() -> PendingContext
Create an empty pending context buffer.
pub fn set_prompt(&self)
pub fn set_prompt(&self)
Mark that a prompt (turnComplete:true) should follow the next flush.
pub 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.
pub fn drain_context(&self) -> Vec<Content>
pub fn drain_context(&self) -> Vec<Content>
Drain only context turns, leaving any pending prompt armed.
pub fn take_prompt(&self) -> bool
pub fn take_prompt(&self) -> bool
Take and clear the pending prompt flag without touching queued context.
pub fn clear_prompt(&self)
pub fn clear_prompt(&self)
Clear any armed prompt without touching queued context.
pub fn has_prompt(&self) -> bool
pub fn has_prompt(&self) -> bool
Return whether a prompt is currently armed.