lattice_plugin_host/decoration_host.rs
1//! The decoration-provider guest world (PH7.9b).
2//!
3//! A WASM decoration provider implements the `decorations-plugin` world: it
4//! exports the `decorations` producer (`gutter-decorations`) and imports the
5//! `host-services` `walk` seam (PH7.4b). This module holds the **sixth `bindgen!`**
6//! (after `plugin`, `picker-source-plugin`, `completion-source-plugin`,
7//! `grammar-plugin`, `events-plugin`) for that world — the shared-types trick
8//! (`with:` points `types` + `host-services` at the `plugin` world's generated
9//! modules so a crossed `gutter-decoration` value is the SAME Rust type
10//! `WitBoundary` round-trips, `boundary_decoration.rs`; PH7.3d precedent).
11//!
12//! **Producer, async (the completion PH7.6 fork).** The native
13//! `Mode::gutter_decorations` is read per-frame by the renderer; a WASM mode
14//! can't satisfy it inline (per-frame WASM = a paramount-#1 violation). So the
15//! guest is an async producer the host calls OFF the render path on a trigger,
16//! caching the result; `exports: { default: async }` — a produce call suspends
17//! the guest, never the render path. The per-plugin actor that drives it is the
18//! `decoration_task` bridge.
19
20pub(crate) mod bindings {
21 wasmtime::component::bindgen!({
22 world: "decorations-plugin",
23 path: "../lattice-wit/wit",
24 // The guest `gutter-decorations` producer is async — a produce call
25 // suspends the guest stack, never pins the caller's thread (nor the
26 // render path).
27 exports: { default: async },
28 with: {
29 // Reuse the `plugin` world's generated mirrors so a crossed value is
30 // the same Rust type `WitBoundary` round-trips; `host-services` reuses
31 // the already-wired `Host` impl (the completion/picker precedent).
32 "lattice:plugin-host/types": crate::lattice::plugin_host::types,
33 "lattice:plugin-host/host-services": crate::lattice::plugin_host::host_services,
34 "lattice:plugin-host/logging": crate::lattice::plugin_host::logging,
35 },
36 });
37}