Expand description
splicer — plan and generate WebAssembly component compositions.
Most users only need the two top-level entry points:
splice— splice middleware into an existing composition.compose— synthesize a composition from N components.
Both take a typed request struct and return a typed output struct
whose wac_deps field is shaped to be handed straight to
wac_resolver::FileSystemPackageResolver
(or formatted into a wac compose ... --dep ... shell command).
Advanced users who want more granular control can reach for the
lower-level building blocks under lowlevel, or import the
shared types from types.
§Quick start
let rules_yaml = std::fs::read_to_string("splice.yaml")?;
let bundle = splicer::splice(splicer::SpliceRequest {
composition_wasm: "composition.wasm".into(),
rules_yaml,
package_name: "example:composition".into(),
splits_dir: "./splits".into(),
skip_type_check: false,
})?;
// Compose to a single Wasm component, in-process — no shelling out.
let composed: Vec<u8> = bundle.to_wasm()?;
std::fs::write("composed.wasm", &composed)?;
for adapter in &bundle.generated_adapters {
println!(
"generated adapter for middleware '{}' at {}",
adapter.middleware_name, adapter.adapter_path,
);
}§Want to drive wac compose yourself?
Bundle::wac and Bundle::wac_deps expose the raw inputs.
Write the WAC to disk and call Bundle::wac_compose_cmd to get
the equivalent wac compose ... --dep ... shell command, or feed
wac_deps directly into
wac_resolver::FileSystemPackageResolver
— the keys are fully-qualified WAC package keys, the values are
PathBufs, no translation step required.
For finer control over the in-process path (e.g. a custom
filesystem search base for unresolved package references), reach
for compose_wac.
§Side effects on disk
Both splice and compose write files as part of their work:
splicewrites one.wasmfile per sub-component intosplits_dir(the splitter pass), and may writesplicer_adapter_*.wasmfiles alongside them (the adapter generator). Adapter paths are surfaced inBundle::generated_adaptersandBundle::wac_deps.- Neither function writes the generated WAC source — that’s
returned in
Bundle::wacfor the caller to use however they like (typically by passing the bundle toBundle::to_wasm).
Re-exports§
pub use ::cviz;
Modules§
- builtin_
info - Introspection helpers for the builtins shipped with this splicer. Reads the embedded manifests so callers (CLI, custom tooling) can render the same key/default/doc surface that splice-time validation enforces. Bulk of the module stays private — these are the only pieces that make sense to expose.
- lowlevel
- Direct access to splicer’s internal pipeline stages, for callers
that need finer control than
splice/composeoffer. - types
- Types that appear on the public API surface and may be useful to import directly.
Structs§
- Bundle
- Output of
spliceandcompose: the generated WAC source, the dep map it references, contract diagnostics, and any tier-1 adapter components splicer wrote to disk. Most callers reach forBundle::to_wasmto go straight to a composed component. - Component
Input - One component to feed into
compose. - Compose
Request - Inputs to
compose. - Splice
Request - Inputs to
splice.
Functions§
- compose
- Synthesize a composition from N individual components.
- compose_
wac - In-process equivalent of
wac compose: parsewac, resolve every package reference againstwac_deps, and encode the result into wasmparser-validated bytes.wac_depsmust cover every package the WAC references — the resolver does not fall back to the filesystem. - format_
wac_ compose_ cmd - Format a
wac compose <wac_path> --dep ...shell command line from the wac source path and the per-dependency(package_key, wasm_path)map returned byspliceorcompose. - splice
- Splice middleware into a pre-composed Wasm component.