pub struct WasmCompletionSource { /* private fields */ }Expand description
An async completion producer over a plugin’s CompletionClient. Cheap to
clone (the client is an mpsc Sender clone + cached id/doc); every clone
talks to the same actor.
Implementations§
Source§impl WasmCompletionSource
impl WasmCompletionSource
Sourcepub async fn connect(client: CompletionClient) -> Result<Self, PluginHostError>
pub async fn connect(client: CompletionClient) -> Result<Self, PluginHostError>
Fetch the plugin’s spec through the bridge and build the adapter. Async
because the one-time spec fetch is a guest call; a dead actor is a typed
error, so a bad plugin fails registration loudly.
Sourcepub fn accepts_non_word_query(&self) -> bool
pub fn accepts_non_word_query(&self) -> bool
OR.7: whether this source keeps matching once the query picks up a non-word character (a phrase source — org-roam’s node titles).
Sourcepub async fn generate(
&self,
ctx: &InsertContextSnapshot,
) -> Result<Vec<RawCandidate>, String>
pub async fn generate( &self, ctx: &InsertContextSnapshot, ) -> Result<Vec<RawCandidate>, String>
Produce raw candidates for prefix — the async generator. The result is
native RawCandidates the host feeds through match_and_rank
(matching/ranking/annotation stay native). The outer host error (trap /
plugin-gone) and the inner guest WIT err both collapse to the String
the completion machinery logs; a candidate that fails to cross (malformed
record) fails the whole batch as a typed error, never a silent drop.
Trait Implementations§
Source§impl AsyncCompletionSource for WasmCompletionSource
PH7.6 → PL8.B: the adapter that lets a WASM completion source ride a mode’s
completion_sources() like any native async source (LSP’s precedent). The
aggregator drives produce_async at popup-open / isIncomplete refresh; the
async generate runs on the source’s actor (spawned by the loader on the
multi-thread runtime), never the keystroke path — matching / ranking /
annotation stay native (the host runs match_and_rank over the pushed
candidates), so paramount #1 holds.
impl AsyncCompletionSource for WasmCompletionSource
PH7.6 → PL8.B: the adapter that lets a WASM completion source ride a mode’s
completion_sources() like any native async source (LSP’s precedent). The
aggregator drives produce_async at popup-open / isIncomplete refresh; the
async generate runs on the source’s actor (spawned by the loader on the
multi-thread runtime), never the keystroke path — matching / ranking /
annotation stay native (the host runs match_and_rank over the pushed
candidates), so paramount #1 holds.
Source§fn produce_async(
&self,
ctx: InsertContextSnapshot,
sink: Arc<dyn CandidateSink>,
token: CancellationToken,
) -> Pin<Box<dyn Future<Output = ()> + Send>>
fn produce_async( &self, ctx: InsertContextSnapshot, sink: Arc<dyn CandidateSink>, token: CancellationToken, ) -> Pin<Box<dyn Future<Output = ()> + Send>>
Source§impl Clone for WasmCompletionSource
impl Clone for WasmCompletionSource
Source§fn clone(&self) -> WasmCompletionSource
fn clone(&self) -> WasmCompletionSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for WasmCompletionSource
impl !UnwindSafe for WasmCompletionSource
impl Freeze for WasmCompletionSource
impl Send for WasmCompletionSource
impl Sync for WasmCompletionSource
impl Unpin for WasmCompletionSource
impl UnsafeUnpin for WasmCompletionSource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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