Expand description
PH7.4c.2 — the WasmPickerSource host adapter (the create path).
Wraps a plugin’s picker exports (driven through the PickerClient bridge,
PH7.4c.1b) as an Arc<dyn PickerSourceGenerator> so a plugin source is
indistinguishable from a first-party one at the PickerRegistry
(register_generator). The boundary conversions are PH7.4a’s
WitBoundary + project_picker_context; this adapter only sequences them
against the trait’s sync/async contract.
§Mapping the trait onto an async, actor-bound guest
PickerSourceGenerator’s methods are synchronous, but the guest exports are
async and bound to the plugin’s actor task (picker_task.rs). The three
methods resolve that mismatch differently:
specis fetched once atconnecttime and cached natively, so the syncspec(&self) -> &PickerSourceSpecis a borrow — no per-call guest hop.initreturnsPickerInitResult::Future: the sync prelude projects the borrowed context into an owned WIT record (§4.2) and moves it into a'staticfuture that awaitsclient.initoff-thread, then converts the WIT candidate pairs back. This drops straight into the host’s existingpending_picker_initdrain.acceptreturnsSomefromaccept_async: the same sync-prelude-then-future shape, awaitingclient.accept. The host applies the outcome via the pending-accept drain. The synchronousacceptis a defensive tripwire — the host always prefersaccept_asyncwhen it returnsSome, so a plugin accept never blocks the actor thread (paramount #4).
Structs§
- Wasm
Picker Source - An
Arc<dyn PickerSourceGenerator>-ready adapter over ONE of a picker plugin’s registered sources.
Functions§
- connect_
picker_ sources - Convenience: drive registration and wrap each declared source as the
Arc<dyn PickerSourceGenerator>thePickerRegistrystores.