Skip to main content

Module pending

Module pending 

Source
Expand description

Pending<T> – the typed handle returned by every mutating actor call (DESIGN.md §5.2.1).

A Pending wraps a tokio::sync::oneshot::Receiver. Three usage patterns:

  1. Async caller (LSP client, plugin host, future async UI): pending.await yields the typed result.
  2. Sync caller in a tokio context (test fixtures running #[tokio::test]): same as above.
  3. Sync caller outside tokio (the TUI input loop, which is a blocking crossterm::event::read loop on the main thread): pending.blocking_recv() parks the current thread until the actor responds. The TUI uses crate::runtime::block_on which forwards to this.

Errors are kept narrow: RuntimeError::ActorGone when the actor task has shut down before it could respond, and RuntimeError::Core for any inner [lattice_core::CoreError] (range out of bounds, etc.). The previous Busy variant was removed in audit slice 6 / H3 – the document actor’s mailbox is now unbounded, so backpressure surfaces as queue depth rather than per-call drops.

Structs§

InvocationId
Monotonic id assigned to every actor-bound invocation. Unique across the process – not reused if an actor task dies and is respawned. Useful for telemetry, logging, and (post-Phase-7) for plugin-side correlation of request/response.
Pending
Outcome of an actor-bound mutation. Wraps a oneshot receiver so the caller can await (or block on) the result.

Enums§

RuntimeError
Failure modes a runtime caller can observe. Kept narrow so the UI can branch on the failure shape rather than a generic message.