pub struct WasmPickerSource { /* private fields */ }Expand description
An Arc<dyn PickerSourceGenerator>-ready adapter over ONE of a picker
plugin’s registered sources.
Cheap to clone (the client is an mpsc Sender clone + a cached spec); every
clone talks to the same actor. N adapters share one actor and one guest
instance since OR.5b — each carries the source id it was registered under
and passes it on every init / accept, which is how one component serves
several pickers.
Implementations§
Source§impl WasmPickerSource
impl WasmPickerSource
Sourcepub async fn connect_all(
client: PickerClient,
) -> Result<Vec<Self>, PluginHostError>
pub async fn connect_all( client: PickerClient, ) -> Result<Vec<Self>, PluginHostError>
Drive the plugin’s register-picker-sources export and wrap each source
it declared.
Async because registration is a guest call. A dead actor or a trapping registration is a typed error, so a bad plugin fails loudly rather than registering a broken source. An empty list is NOT an error — a plugin that declares nothing registers nothing, which is what it asked for.
Trait Implementations§
Source§impl PickerSourceGenerator for WasmPickerSource
impl PickerSourceGenerator for WasmPickerSource
Source§fn owner_plugin(&self) -> Option<u64>
fn owner_plugin(&self) -> Option<u64>
PH.1: the plugin behind this source, so <C-h> can find the page the
plugin registered as <plugin>.picker-<id> — and only that plugin’s.
Same u64 widening the loader applies to HelpTopic::plugin_id.
Source§fn spec(&self) -> &PickerSourceSpec
fn spec(&self) -> &PickerSourceSpec
:describe-picker /
:picker <Tab> listings without cloning.Source§fn init(
&self,
ctx: &PickerContext<'_>,
args: &[String],
) -> SourceResult<PickerInitResult>
fn init( &self, ctx: &PickerContext<'_>, args: &[String], ) -> SourceResult<PickerInitResult>
ctx, clone into async captures if
necessary, return the appropriate PickerInitResult
variant. Synchronous errors (no active buffer when
one was required, args validation failure) return
Err; the host echoes the error and leaves the
picker closed. Read moreSource§fn accept(
&self,
_ctx: &PickerContext<'_>,
_routing: &RoutingPayload,
) -> SourceResult<PickerAcceptOutcome>
fn accept( &self, _ctx: &PickerContext<'_>, _routing: &RoutingPayload, ) -> SourceResult<PickerAcceptOutcome>
PickerAcceptOutcome the host applies. The
generator owns the mapping from its emitted
routing-payload variant(s) to outcome(s); mismatch
returns Err, which the host echoes.Source§fn accept_async(
&self,
ctx: &PickerContext<'_>,
routing: &RoutingPayload,
) -> Option<AcceptFuture>
fn accept_async( &self, ctx: &PickerContext<'_>, routing: &RoutingPayload, ) -> Option<AcceptFuture>
None means “this source resolves accept
synchronously” — every native source takes this path and is unchanged. Read moreSource§fn on_query_changed(
&self,
_ctx: &PickerContext<'_>,
_query: &str,
) -> Option<Result<PickerInitResult, String>>
fn on_query_changed( &self, _ctx: &PickerContext<'_>, _query: &str, ) -> Option<Result<PickerInitResult, String>>
None means “static source –
host uses fuzzy refilter over the candidate set
returned by init”. Returning Some(result) from a
source whose spec().live == true replaces the
picker’s candidate set wholesale; the host wires up
debouncing and cancels any in-flight invocation when a
fresh query arrives. Read moreSource§fn descend(
&self,
_ctx: &PickerContext<'_>,
_candidate: &RawCandidate,
) -> Option<String>
fn descend( &self, _ctx: &PickerContext<'_>, _candidate: &RawCandidate, ) -> Option<String>
<C-l> — refine the query from the selected candidate instead
of accepting it. Read more<CR> on a row that is a SIGNPOST rather than a destination. Read moreSource§fn initial_query(&self, _args: &[String]) -> Option<String>
fn initial_query(&self, _args: &[String]) -> Option<String>
Source§fn preview(
&self,
_ctx: &PickerContext<'_>,
_routing: &RoutingPayload,
) -> Option<PickerPreviewOutcome>
fn preview( &self, _ctx: &PickerContext<'_>, _routing: &RoutingPayload, ) -> Option<PickerPreviewOutcome>
Auto Trait Implementations§
impl !RefUnwindSafe for WasmPickerSource
impl !UnwindSafe for WasmPickerSource
impl Freeze for WasmPickerSource
impl Send for WasmPickerSource
impl Sync for WasmPickerSource
impl Unpin for WasmPickerSource
impl UnsafeUnpin for WasmPickerSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more