pub struct TransientSourceRegistry { /* private fields */ }Implementations§
Source§impl TransientSourceRegistry
impl TransientSourceRegistry
pub fn new() -> Self
Sourcepub fn register(
&self,
name: impl Into<String>,
builder: impl Fn(&TransientContext) -> TransientSpec + Send + Sync + 'static,
)
pub fn register( &self, name: impl Into<String>, builder: impl Fn(&TransientContext) -> TransientSpec + Send + Sync + 'static, )
Register a named synchronous builder — a native menu, whose
rows are a pure function of the open context. Re-registering a
name overwrites the previous entry (last writer wins), matching
PickerRegistry::register’s semantics.
Sourcepub fn register_async(
&self,
name: impl Into<String>,
builder: impl Fn(&TransientContext) -> TransientBuildFuture + Send + Sync + 'static,
)
pub fn register_async( &self, name: impl Into<String>, builder: impl Fn(&TransientContext) -> TransientBuildFuture + Send + Sync + 'static, )
TR.2: register a named builder that answers a
TransientBuildFuture — the guest-backed shape. The host
parks on the future and seats the menu when it lands.
Sourcepub fn unregister(&self, name: &str) -> bool
pub fn unregister(&self, name: &str) -> bool
TR.2: drop the builder registered under name, reporting
whether one was there. The teardown half of
register_async — an unloaded plugin’s
menu name must stop resolving, or Effect::OpenTransient would
keep reaching a client whose actor is gone and report a host
error instead of “unknown source”.
Sourcepub fn build(
&self,
name: &str,
ctx: &TransientContext,
) -> Option<TransientBuild>
pub fn build( &self, name: &str, ctx: &TransientContext, ) -> Option<TransientBuild>
Build the named transient for the place it was opened from, or
None if no builder is registered under name.
MG.23h: ctx is supplied by the renderer at open time rather
than by whatever emitted Effect::OpenTransient. That is what
makes every path uniformly context-aware — the chord, the
ex-command (whose ExCommandContext carries no buffer), and any
future plugin-emitted open. Resolving it at emit time instead
would leave all but the chord looking at nothing.
Sourcepub fn build_ready(
&self,
name: &str,
ctx: &TransientContext,
) -> Option<TransientSpec>
pub fn build_ready( &self, name: &str, ctx: &TransientContext, ) -> Option<TransientSpec>
build for a caller that can only handle a
synchronous answer — tests and native call sites that predate
TR.2. A guest-backed name answers None here rather than
blocking.