Path: blob/main/crates/wasi-preview1-component-adapter/provider/src/lib.rs
1692 views
//! This crate contains the binaries of three WebAssembly modules:1//!2//! - [`WASI_SNAPSHOT_PREVIEW1_REACTOR_ADAPTER`]3//! - [`WASI_SNAPSHOT_PREVIEW1_COMMAND_ADAPTER`]4//! - [`WASI_SNAPSHOT_PREVIEW1_PROXY_ADAPTER`]5//!6//! These three modules bridge the wasip1 ABI to the wasip2 ABI of the component7//! model.8//!9//! They can be given to the [`wit_component::ComponentEncoder::adapter`]10//! method, using the [`WASI_SNAPSHOT_PREVIEW1_ADAPTER_NAME`], to translate a11//! module from the historical WASM ABI to the canonical ABI.12//!13//! [`wit_component::ComponentEncoder::adapter`]: https://docs.rs/wit-component/latest/wit_component/struct.ComponentEncoder.html#method.adapter1415/// The name of the adapters in this crate, which may be provided to16/// [`wit_component::ComponentEncoder::adapter`].17///18/// [`wit_component::ComponentEncoder::adapter`]: https://docs.rs/wit-component/latest/wit_component/struct.ComponentEncoder.html#method.adapter19pub const WASI_SNAPSHOT_PREVIEW1_ADAPTER_NAME: &str = "wasi_snapshot_preview1";2021/// The "reactor" adapter provides the default adaptation from preview1 to22/// preview2.23///24/// This adapter implements the [`wasi:cli/imports`] world.25///26/// [`wasi:cli/imports`]: https://github.com/WebAssembly/WASI/blob/01bb90d8b66cbc1d50349aaaab9ac5b143c9c98c/preview2/cli/imports.wit27pub const WASI_SNAPSHOT_PREVIEW1_REACTOR_ADAPTER: &[u8] =28include_bytes!("../artefacts/wasi_snapshot_preview1.reactor.wasm");2930/// The "command" adapter extends the ["reactor" adapter] and additionally31/// exports a `run` function entrypoint.32///33/// This adapter implements the [`wasi:cli/command`] world.34///35/// ["reactor" adapter]: WASI_SNAPSHOT_PREVIEW1_REACTOR_ADAPTER36/// [`wasi:cli/command`]: https://github.com/WebAssembly/WASI/blob/01bb90d8b66cbc1d50349aaaab9ac5b143c9c98c/preview2/cli/command.wit37pub const WASI_SNAPSHOT_PREVIEW1_COMMAND_ADAPTER: &[u8] =38include_bytes!("../artefacts/wasi_snapshot_preview1.command.wasm");3940/// The "proxy" adapter provides implements a HTTP proxy which is more41/// restricted than the ["reactor" adapter] adapter, as it lacks filesystem,42/// socket, environment, exit, and terminal support, but includes HTTP handlers43/// for incoming and outgoing requests.44///45/// This adapter implements the [`wasi:http/proxy`] world.46///47/// ["reactor" adapter]: WASI_SNAPSHOT_PREVIEW1_REACTOR_ADAPTER48/// [`wasi:http/proxy`]: https://github.com/WebAssembly/WASI/blob/01bb90d8b66cbc1d50349aaaab9ac5b143c9c98c/preview2/http/proxy.wit49pub const WASI_SNAPSHOT_PREVIEW1_PROXY_ADAPTER: &[u8] =50include_bytes!("../artefacts/wasi_snapshot_preview1.proxy.wasm");515253