pub struct UiDialogMailbox { /* private fields */ }Expand description
Thread-safe mailbox connecting plugin runtime actions to an interactive host (normally the TUI). It deliberately carries only JSON and primitives, so the extension crate remains independent of the UI crate.
Implementations§
Source§impl UiDialogMailbox
impl UiDialogMailbox
pub fn new() -> Self
Sourcepub fn detach(&self)
pub fn detach(&self)
Detach the consumer and cancel every outstanding request. This prevents a TUI restart/reload from leaving plugin polls blocked forever.
pub fn is_attached(&self) -> bool
Sourcepub fn take_pending(&self) -> Option<UiDialogRequest>
pub fn take_pending(&self) -> Option<UiDialogRequest>
Remove and return the next request for presentation by the TUI.
Cancelled/answered requests are skipped; duplicate open calls never
enqueue the same request id twice.
pub fn pending_len(&self) -> usize
Sourcepub fn respond(&self, request_id: &str, answer: Value) -> Result<(), String>
pub fn respond(&self, request_id: &str, answer: Value) -> Result<(), String>
Supply an answer for a request. Repeating the same operation is idempotent; answering a cancelled/unknown request is an explicit error.
Sourcepub fn cancel(&self, request_id: &str) -> Result<(), String>
pub fn cancel(&self, request_id: &str) -> Result<(), String>
Mark one request cancelled. The terminal state remains visible to the
plugin’s next poll, then is reclaimed by that poll.
Sourcepub fn cancel_all(&self)
pub fn cancel_all(&self)
Cancel all requests currently known to the mailbox.
Trait Implementations§
Source§impl Clone for UiDialogMailbox
impl Clone for UiDialogMailbox
Source§fn clone(&self) -> UiDialogMailbox
fn clone(&self) -> UiDialogMailbox
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more