Skip to main content

lattice_plugin_host/
media_host.rs

1//! IM.6b — the inline-media provider guest world.
2//!
3//! A WASM media provider implements the `media-plugin` world: it exports the
4//! `media` producer (`media-blocks`) and imports the capability-gated
5//! `host-services` a scan might need. This module holds the `bindgen!` for
6//! that world, using the same shared-types trick as every seam before it —
7//! `with:` points `types` + `host-services` at the `plugin` world's generated
8//! modules so a crossed `media-block` is the SAME Rust type the boundary
9//! round-trips.
10//!
11//! **Producer, async.** The guest is called OFF the render path on a trigger
12//! and its result cached; a guest on the render path would be per-frame WASM,
13//! a paramount-#1 violation.
14
15pub(crate) mod bindings {
16    wasmtime::component::bindgen!({
17        world: "media-plugin",
18        path: "../lattice-wit/wit",
19        // A produce call suspends the guest stack rather than pinning the
20        // caller's thread — and never the render path.
21        exports: { default: async },
22        with: {
23            "lattice:plugin-host/types": crate::lattice::plugin_host::types,
24            "lattice:plugin-host/host-services": crate::lattice::plugin_host::host_services,
25            "lattice:plugin-host/logging": crate::lattice::plugin_host::logging,
26        },
27    });
28}