Skip to main content

Module transient_task

Module transient_task 

Source
Expand description

TR.2b — the per-plugin actor bridge for transient-source providers.

The transient analogue of picker_task.rs, and deliberately its near-twin: a dedicated async task owns the plugin’s Store<PluginState> for life (the Store is !Sync), a [TransientCall] crosses an mpsc channel with a oneshot reply, and the Send + Sync TransientClient serialises calls onto the single-consumer loop.

Two exports, and they are called at very different rates: id() once at load, to key the registry entry; build(ctx) once per menu open. Neither is on a hot path, which is why the design fragment can afford to call the guest per open rather than caching a spec that would go stale the moment the user moved to a different buffer.

Fuel is re-armed per call (arm_store inside each call_*). Arming once at instantiate would be correct for a declare-once seam and wrong here: build is called for the life of the editor, so the menu would work for the first stretch of a session and then silently stop opening.

This is the Nth near-copy of the picker / completion / decoration / media / agenda actor; the rule-of-three note in completion_task still stands, and this slice deliberately did not take the generalisation on mid-seam.

Re-exports§

pub use crate::lattice::plugin_host::types::TransientContext;
pub use crate::lattice::plugin_host::types::TransientGroup;
pub use crate::lattice::plugin_host::types::TransientItem;
pub use crate::lattice::plugin_host::types::TransientItemKind;
pub use crate::lattice::plugin_host::types::TransientSpec;

Structs§

TransientActor
The per-plugin actor: owns the Store + transient bindings for the plugin’s whole life and serves calls off the channel until every TransientClient drops.
TransientClient
The Send + Sync handle the host adapter holds. Cloning is cheap (an mpsc Sender clone); every clone talks to the same actor / Store, so calls serialise on the single-consumer loop the !Sync Store requires. Dropping the last clone ends the actor loop — the teardown seam.