chore: checkpoint before Python removal

This commit is contained in:
2026-03-26 22:33:59 +00:00
parent 683cec9307
commit e568ddf82a
29972 changed files with 11269302 additions and 2 deletions

513
vendor/wasip3/src/command.rs vendored Normal file
View File

@@ -0,0 +1,513 @@
// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT!
// Options used:
// * with "wasi:cli/environment@0.3.0-rc-2026-01-06" = "crate::cli::environment"
// * with "wasi:cli/exit@0.3.0-rc-2026-01-06" = "crate::cli::exit"
// * with "wasi:cli/stdin@0.3.0-rc-2026-01-06" = "crate::cli::stdin"
// * with "wasi:cli/stdout@0.3.0-rc-2026-01-06" = "crate::cli::stdout"
// * with "wasi:cli/stderr@0.3.0-rc-2026-01-06" = "crate::cli::stderr"
// * with "wasi:cli/types@0.3.0-rc-2026-01-06" = "crate::cli::types"
// * with "wasi:cli/terminal-input@0.3.0-rc-2026-01-06" = "crate::cli::terminal_input"
// * with "wasi:cli/terminal-output@0.3.0-rc-2026-01-06" = "crate::cli::terminal_output"
// * with "wasi:cli/terminal-stdin@0.3.0-rc-2026-01-06" = "crate::cli::terminal_stdin"
// * with "wasi:cli/terminal-stdout@0.3.0-rc-2026-01-06" = "crate::cli::terminal_stdout"
// * with "wasi:cli/terminal-stderr@0.3.0-rc-2026-01-06" = "crate::cli::terminal_stderr"
// * with "wasi:clocks/monotonic-clock@0.3.0-rc-2026-01-06" = "crate::clocks::monotonic_clock"
// * with "wasi:clocks/system-clock@0.3.0-rc-2026-01-06" = "crate::clocks::system_clock"
// * with "wasi:clocks/types@0.3.0-rc-2026-01-06" = "crate::clocks::types"
// * with "wasi:filesystem/types@0.3.0-rc-2026-01-06" = "crate::filesystem::types"
// * with "wasi:filesystem/preopens@0.3.0-rc-2026-01-06" = "crate::filesystem::preopens"
// * with "wasi:random/random@0.3.0-rc-2026-01-06" = "crate::random::random"
// * with "wasi:random/insecure@0.3.0-rc-2026-01-06" = "crate::random::insecure"
// * with "wasi:random/insecure-seed@0.3.0-rc-2026-01-06" = "crate::random::insecure_seed"
// * with "wasi:sockets/types@0.3.0-rc-2026-01-06" = "crate::sockets::types"
// * with "wasi:sockets/ip-name-lookup@0.3.0-rc-2026-01-06" = "crate::sockets::ip_name_lookup"
// * type_section_suffix: "rust-wasip3-0.4.0+wasi-0.3.0-rc-2026-01-06-from-crates-io-command-world"
// * default-bindings-module: "$crate"
// * export-macro-name: _export_command
// * pub-export-macro
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::environment as __with_name0;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::exit as __with_name1;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::types as __with_name2;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::stdin as __with_name3;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::stdout as __with_name4;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::stderr as __with_name5;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::terminal_input as __with_name6;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::terminal_output as __with_name7;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::terminal_stdin as __with_name8;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::terminal_stdout as __with_name9;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::cli::terminal_stderr as __with_name10;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::clocks::types as __with_name11;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::clocks::monotonic_clock as __with_name12;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::clocks::system_clock as __with_name13;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::filesystem::types as __with_name14;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::filesystem::preopens as __with_name15;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::sockets::types as __with_name16;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::sockets::ip_name_lookup as __with_name17;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::random::random as __with_name18;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::random::insecure as __with_name19;
#[allow(unfulfilled_lint_expectations, unused_imports)]
use crate::random::insecure_seed as __with_name20;
#[rustfmt::skip]
#[allow(dead_code, clippy::all)]
pub mod exports {
pub mod wasi {
pub mod cli {
#[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
pub mod run {
#[used]
#[doc(hidden)]
static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports;
use super::super::super::super::_rt;
#[doc(hidden)]
#[allow(non_snake_case, unused_unsafe)]
pub unsafe fn _export_run_cabi<T: Guest>() -> i32 {
unsafe {
#[cfg(target_arch = "wasm32")] _rt::run_ctors_once();
wit_bindgen::rt::async_support::start_task(async move {
let _task_cancel = wit_bindgen::rt::async_support::TaskCancelOnDrop::new();
let result0 = &{ T::run().await };
let result1 = match result0 {
Ok(_) => 0i32,
Err(_) => 1i32,
};
#[cfg(target_arch = "wasm32")]
#[link(
wasm_import_module = "[export]wasi:cli/run@0.3.0-rc-2026-01-06"
)]
unsafe extern "C" {
#[link_name = "[task-return]run"]
fn wit_import2(_: i32);
}
#[cfg(not(target_arch = "wasm32"))]
unsafe extern "C" fn wit_import2(_: i32) {
unreachable!()
}
_task_cancel.forget();
wit_import2(result1);
})
}
}
#[doc(hidden)]
#[allow(non_snake_case)]
pub unsafe fn __callback_run(
event0: u32,
event1: u32,
event2: u32,
) -> u32 {
unsafe {
wit_bindgen::rt::async_support::callback(event0, event1, event2)
}
}
pub trait Guest {
/// Run the program.
#[allow(async_fn_in_trait)]
async fn run() -> Result<(), ()>;
}
#[doc(hidden)]
#[macro_export]
macro_rules! __export_wasi_cli_run_0_3_0_rc_2026_01_06_cabi {
($ty:ident with_types_in $($path_to_types:tt)*) => {
const _ : () = { #[unsafe (export_name =
"[async-lift]wasi:cli/run@0.3.0-rc-2026-01-06#run")] unsafe
extern "C" fn export_run() -> i32 { unsafe { $($path_to_types)*::
_export_run_cabi::<$ty > () } } #[unsafe (export_name =
"[callback][async-lift]wasi:cli/run@0.3.0-rc-2026-01-06#run")]
unsafe extern "C" fn _callback_run(event0 : u32, event1 : u32,
event2 : u32) -> u32 { unsafe { $($path_to_types)*::
__callback_run(event0, event1, event2) } } };
};
}
#[doc(hidden)]
pub use __export_wasi_cli_run_0_3_0_rc_2026_01_06_cabi;
}
}
}
}
#[rustfmt::skip]
mod _rt {
#![allow(dead_code, unused_imports, clippy::all)]
#[cfg(target_arch = "wasm32")]
pub fn run_ctors_once() {
wit_bindgen::rt::run_ctors_once();
}
}
/// Generates `#[unsafe(no_mangle)]` functions to export the specified type as
/// the root implementation of all generated traits.
///
/// For more information see the documentation of `wit_bindgen::generate!`.
///
/// ```rust
/// # macro_rules! _export_command{ ($($t:tt)*) => (); }
/// # trait Guest {}
/// struct MyType;
///
/// impl Guest for MyType {
/// // ...
/// }
///
/// _export_command!(MyType);
/// ```
#[allow(unused_macros)]
#[doc(hidden)]
#[macro_export]
macro_rules! __export_command_impl {
($ty:ident) => {
$crate::_export_command!($ty with_types_in $crate);
};
($ty:ident with_types_in $($path_to_types_root:tt)*) => {
$($path_to_types_root)*::
exports::wasi::cli::run::__export_wasi_cli_run_0_3_0_rc_2026_01_06_cabi!($ty
with_types_in $($path_to_types_root)*:: exports::wasi::cli::run); const _ : () =
{ #[rustfmt::skip] #[cfg(target_arch = "wasm32")] #[unsafe (link_section =
"component-type:wit-bindgen:0.51.0:wasi:cli@0.3.0-rc-2026-01-06:command:imports and exportsrust-wasip3-0.4.0+wasi-0.3.0-rc-2026-01-06-from-crates-io-command-world")]
#[doc(hidden)] #[allow(clippy::octal_escapes)] pub static
__WIT_BINDGEN_COMPONENT_TYPE : [u8; 8040] = *
b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xea=\x01A\x02\x01A3\x01\
B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0fget-environment\x01\x02\x01ps\x01@\
\0\0\x03\x04\0\x0dget-arguments\x01\x04\x01ks\x01@\0\0\x05\x04\0\x0fget-initial-\
cwd\x01\x06\x03\0(wasi:cli/environment@0.3.0-rc-2026-01-06\x05\0\x01B\x03\x01j\0\
\0\x01@\x01\x06status\0\x01\0\x04\0\x04exit\x01\x01\x03\0!wasi:cli/exit@0.3.0-rc\
-2026-01-06\x05\x01\x01B\x02\x01m\x03\x02io\x15illegal-byte-sequence\x04pipe\x04\
\0\x0aerror-code\x03\0\0\x03\0\"wasi:cli/types@0.3.0-rc-2026-01-06\x05\x02\x02\x03\
\0\x02\x0aerror-code\x01B\x08\x02\x03\x02\x01\x03\x04\0\x0aerror-code\x03\0\0\x01\
f\x01}\x01j\0\x01\x01\x01e\x01\x03\x01o\x02\x02\x04\x01@\0\0\x05\x04\0\x0fread-v\
ia-stream\x01\x06\x03\0\"wasi:cli/stdin@0.3.0-rc-2026-01-06\x05\x04\x01B\x06\x02\
\x03\x02\x01\x03\x04\0\x0aerror-code\x03\0\0\x01f\x01}\x01j\0\x01\x01\x01C\x01\x04\
data\x02\0\x03\x04\0\x10write-via-stream\x01\x04\x03\0#wasi:cli/stdout@0.3.0-rc-\
2026-01-06\x05\x05\x01B\x06\x02\x03\x02\x01\x03\x04\0\x0aerror-code\x03\0\0\x01f\
\x01}\x01j\0\x01\x01\x01C\x01\x04data\x02\0\x03\x04\0\x10write-via-stream\x01\x04\
\x03\0#wasi:cli/stderr@0.3.0-rc-2026-01-06\x05\x06\x01B\x01\x04\0\x0eterminal-in\
put\x03\x01\x03\0+wasi:cli/terminal-input@0.3.0-rc-2026-01-06\x05\x07\x01B\x01\x04\
\0\x0fterminal-output\x03\x01\x03\0,wasi:cli/terminal-output@0.3.0-rc-2026-01-06\
\x05\x08\x02\x03\0\x06\x0eterminal-input\x01B\x06\x02\x03\x02\x01\x09\x04\0\x0et\
erminal-input\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x12get-terminal-stdin\
\x01\x04\x03\0+wasi:cli/terminal-stdin@0.3.0-rc-2026-01-06\x05\x0a\x02\x03\0\x07\
\x0fterminal-output\x01B\x06\x02\x03\x02\x01\x0b\x04\0\x0fterminal-output\x03\0\0\
\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stdout\x01\x04\x03\0,wasi:\
cli/terminal-stdout@0.3.0-rc-2026-01-06\x05\x0c\x01B\x06\x02\x03\x02\x01\x0b\x04\
\0\x0fterminal-output\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-termin\
al-stderr\x01\x04\x03\0,wasi:cli/terminal-stderr@0.3.0-rc-2026-01-06\x05\x0d\x01\
B\x02\x01w\x04\0\x08duration\x03\0\0\x03\0%wasi:clocks/types@0.3.0-rc-2026-01-06\
\x05\x0e\x02\x03\0\x0b\x08duration\x01B\x0c\x02\x03\x02\x01\x0f\x04\0\x08duratio\
n\x03\0\0\x01w\x04\0\x04mark\x03\0\x02\x01@\0\0\x03\x04\0\x03now\x01\x04\x01@\0\0\
\x01\x04\0\x0eget-resolution\x01\x05\x01C\x01\x04when\x03\x01\0\x04\0\x0await-un\
til\x01\x06\x01C\x01\x08how-long\x01\x01\0\x04\0\x08wait-for\x01\x07\x03\0/wasi:\
clocks/monotonic-clock@0.3.0-rc-2026-01-06\x05\x10\x01B\x08\x02\x03\x02\x01\x0f\x04\
\0\x08duration\x03\0\0\x01r\x02\x07secondsx\x0bnanosecondsy\x04\0\x07instant\x03\
\0\x02\x01@\0\0\x03\x04\0\x03now\x01\x04\x01@\0\0\x01\x04\0\x0eget-resolution\x01\
\x05\x03\0,wasi:clocks/system-clock@0.3.0-rc-2026-01-06\x05\x11\x02\x03\0\x0d\x07\
instant\x01BY\x02\x03\x02\x01\x12\x04\0\x07instant\x03\0\0\x01w\x04\0\x08filesiz\
e\x03\0\x02\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09directory\
\x04fifo\x0dsymbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-type\x03\
\0\x04\x01n\x06\x04read\x05write\x13file-integrity-sync\x13data-integrity-sync\x14\
requested-write-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\x06\x01\
n\x01\x0esymlink-follow\x04\0\x0apath-flags\x03\0\x08\x01n\x04\x06create\x09dire\
ctory\x09exclusive\x08truncate\x04\0\x0aopen-flags\x03\0\x0a\x01w\x04\0\x0alink-\
count\x03\0\x0c\x01k\x01\x01r\x06\x04type\x05\x0alink-count\x0d\x04size\x03\x15d\
ata-access-timestamp\x0e\x1bdata-modification-timestamp\x0e\x17status-change-tim\
estamp\x0e\x04\0\x0fdescriptor-stat\x03\0\x0f\x01q\x03\x09no-change\0\0\x03now\0\
\0\x09timestamp\x01\x01\0\x04\0\x0dnew-timestamp\x03\0\x11\x01r\x02\x04type\x05\x04\
names\x04\0\x0fdirectory-entry\x03\0\x13\x01m$\x06access\x07already\x0ebad-descr\
iptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-large\x15illegal-byte-se\
quence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-directory\x04loop\x0e\
too-many-links\x0cmessage-size\x0dname-too-long\x09no-device\x08no-entry\x07no-l\
ock\x13insufficient-memory\x12insufficient-space\x0dnot-directory\x09not-empty\x0f\
not-recoverable\x0bunsupported\x06no-tty\x0eno-such-device\x08overflow\x0dnot-pe\
rmitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file-busy\x0ccross-device\x04\
\0\x0aerror-code\x03\0\x15\x01m\x06\x06normal\x0asequential\x06random\x09will-ne\
ed\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x17\x01r\x02\x05lowerw\x05uppe\
rw\x04\0\x13metadata-hash-value\x03\0\x19\x04\0\x0adescriptor\x03\x01\x01h\x1b\x01\
f\x01}\x01j\0\x01\x16\x01e\x01\x1e\x01o\x02\x1d\x1f\x01@\x02\x04self\x1c\x06offs\
et\x03\0\x20\x04\0\"[method]descriptor.read-via-stream\x01!\x01C\x03\x04self\x1c\
\x04data\x1d\x06offset\x03\0\x1e\x04\0#[method]descriptor.write-via-stream\x01\"\
\x01C\x02\x04self\x1c\x04data\x1d\0\x1e\x04\0$[method]descriptor.append-via-stre\
am\x01#\x01C\x04\x04self\x1c\x06offset\x03\x06length\x03\x06advice\x18\0\x1e\x04\
\0\x19[method]descriptor.advise\x01$\x01C\x01\x04self\x1c\0\x1e\x04\0\x1c[method\
]descriptor.sync-data\x01%\x01j\x01\x07\x01\x16\x01C\x01\x04self\x1c\0&\x04\0\x1c\
[method]descriptor.get-flags\x01'\x01j\x01\x05\x01\x16\x01C\x01\x04self\x1c\0(\x04\
\0\x1b[method]descriptor.get-type\x01)\x01C\x02\x04self\x1c\x04size\x03\0\x1e\x04\
\0\x1b[method]descriptor.set-size\x01*\x01C\x03\x04self\x1c\x15data-access-times\
tamp\x12\x1bdata-modification-timestamp\x12\0\x1e\x04\0\x1c[method]descriptor.se\
t-times\x01+\x01f\x01\x14\x01o\x02,\x1f\x01C\x01\x04self\x1c\0-\x04\0![method]de\
scriptor.read-directory\x01.\x04\0\x17[method]descriptor.sync\x01%\x01C\x02\x04s\
elf\x1c\x04paths\0\x1e\x04\0&[method]descriptor.create-directory-at\x01/\x01j\x01\
\x10\x01\x16\x01C\x01\x04self\x1c\00\x04\0\x17[method]descriptor.stat\x011\x01C\x03\
\x04self\x1c\x0apath-flags\x09\x04paths\00\x04\0\x1a[method]descriptor.stat-at\x01\
2\x01C\x05\x04self\x1c\x0apath-flags\x09\x04paths\x15data-access-timestamp\x12\x1b\
data-modification-timestamp\x12\0\x1e\x04\0\x1f[method]descriptor.set-times-at\x01\
3\x01C\x05\x04self\x1c\x0eold-path-flags\x09\x08old-paths\x0enew-descriptor\x1c\x08\
new-paths\0\x1e\x04\0\x1a[method]descriptor.link-at\x014\x01i\x1b\x01j\x015\x01\x16\
\x01C\x05\x04self\x1c\x0apath-flags\x09\x04paths\x0aopen-flags\x0b\x05flags\x07\0\
6\x04\0\x1a[method]descriptor.open-at\x017\x01j\x01s\x01\x16\x01C\x02\x04self\x1c\
\x04paths\08\x04\0\x1e[method]descriptor.readlink-at\x019\x04\0&[method]descript\
or.remove-directory-at\x01/\x01C\x04\x04self\x1c\x08old-paths\x0enew-descriptor\x1c\
\x08new-paths\0\x1e\x04\0\x1c[method]descriptor.rename-at\x01:\x01C\x03\x04self\x1c\
\x08old-paths\x08new-paths\0\x1e\x04\0\x1d[method]descriptor.symlink-at\x01;\x04\
\0![method]descriptor.unlink-file-at\x01/\x01C\x02\x04self\x1c\x05other\x1c\0\x7f\
\x04\0![method]descriptor.is-same-object\x01<\x01j\x01\x1a\x01\x16\x01C\x01\x04s\
elf\x1c\0=\x04\0\x20[method]descriptor.metadata-hash\x01>\x01C\x03\x04self\x1c\x0a\
path-flags\x09\x04paths\0=\x04\0#[method]descriptor.metadata-hash-at\x01?\x03\0)\
wasi:filesystem/types@0.3.0-rc-2026-01-06\x05\x13\x02\x03\0\x0e\x0adescriptor\x01\
B\x07\x02\x03\x02\x01\x14\x04\0\x0adescriptor\x03\0\0\x01i\x01\x01o\x02\x02s\x01\
p\x03\x01@\0\0\x04\x04\0\x0fget-directories\x01\x05\x03\0,wasi:filesystem/preope\
ns@0.3.0-rc-2026-01-06\x05\x15\x01Bq\x02\x03\x02\x01\x0f\x04\0\x08duration\x03\0\
\0\x01m\x0e\x07unknown\x0daccess-denied\x0dnot-supported\x10invalid-argument\x0d\
out-of-memory\x07timeout\x0dinvalid-state\x14address-not-bindable\x0eaddress-in-\
use\x12remote-unreachable\x12connection-refused\x10connection-reset\x12connectio\
n-aborted\x12datagram-too-large\x04\0\x0aerror-code\x03\0\x02\x01m\x02\x04ipv4\x04\
ipv6\x04\0\x11ip-address-family\x03\0\x04\x01o\x04}}}}\x04\0\x0cipv4-address\x03\
\0\x06\x01o\x08{{{{{{{{\x04\0\x0cipv6-address\x03\0\x08\x01q\x02\x04ipv4\x01\x07\
\0\x04ipv6\x01\x09\0\x04\0\x0aip-address\x03\0\x0a\x01r\x02\x04port{\x07address\x07\
\x04\0\x13ipv4-socket-address\x03\0\x0c\x01r\x04\x04port{\x09flow-infoy\x07addre\
ss\x09\x08scope-idy\x04\0\x13ipv6-socket-address\x03\0\x0e\x01q\x02\x04ipv4\x01\x0d\
\0\x04ipv6\x01\x0f\0\x04\0\x11ip-socket-address\x03\0\x10\x04\0\x0atcp-socket\x03\
\x01\x04\0\x0audp-socket\x03\x01\x01i\x12\x01j\x01\x14\x01\x03\x01@\x01\x0eaddre\
ss-family\x05\0\x15\x04\0\x19[static]tcp-socket.create\x01\x16\x01h\x12\x01j\0\x01\
\x03\x01@\x02\x04self\x17\x0dlocal-address\x11\0\x18\x04\0\x17[method]tcp-socket\
.bind\x01\x19\x01C\x02\x04self\x17\x0eremote-address\x11\0\x18\x04\0\x1a[method]\
tcp-socket.connect\x01\x1a\x01f\x01\x14\x01j\x01\x1b\x01\x03\x01@\x01\x04self\x17\
\0\x1c\x04\0\x19[method]tcp-socket.listen\x01\x1d\x01f\x01}\x01C\x02\x04self\x17\
\x04data\x1e\0\x18\x04\0\x17[method]tcp-socket.send\x01\x1f\x01e\x01\x18\x01o\x02\
\x1e\x20\x01@\x01\x04self\x17\0!\x04\0\x1a[method]tcp-socket.receive\x01\"\x01j\x01\
\x11\x01\x03\x01@\x01\x04self\x17\0#\x04\0$[method]tcp-socket.get-local-address\x01\
$\x04\0%[method]tcp-socket.get-remote-address\x01$\x01@\x01\x04self\x17\0\x7f\x04\
\0#[method]tcp-socket.get-is-listening\x01%\x01@\x01\x04self\x17\0\x05\x04\0%[me\
thod]tcp-socket.get-address-family\x01&\x01@\x02\x04self\x17\x05valuew\0\x18\x04\
\0*[method]tcp-socket.set-listen-backlog-size\x01'\x01j\x01\x7f\x01\x03\x01@\x01\
\x04self\x17\0(\x04\0)[method]tcp-socket.get-keep-alive-enabled\x01)\x01@\x02\x04\
self\x17\x05value\x7f\0\x18\x04\0)[method]tcp-socket.set-keep-alive-enabled\x01*\
\x01j\x01\x01\x01\x03\x01@\x01\x04self\x17\0+\x04\0+[method]tcp-socket.get-keep-\
alive-idle-time\x01,\x01@\x02\x04self\x17\x05value\x01\0\x18\x04\0+[method]tcp-s\
ocket.set-keep-alive-idle-time\x01-\x04\0*[method]tcp-socket.get-keep-alive-inte\
rval\x01,\x04\0*[method]tcp-socket.set-keep-alive-interval\x01-\x01j\x01y\x01\x03\
\x01@\x01\x04self\x17\0.\x04\0'[method]tcp-socket.get-keep-alive-count\x01/\x01@\
\x02\x04self\x17\x05valuey\0\x18\x04\0'[method]tcp-socket.set-keep-alive-count\x01\
0\x01j\x01}\x01\x03\x01@\x01\x04self\x17\01\x04\0\x20[method]tcp-socket.get-hop-\
limit\x012\x01@\x02\x04self\x17\x05value}\0\x18\x04\0\x20[method]tcp-socket.set-\
hop-limit\x013\x01j\x01w\x01\x03\x01@\x01\x04self\x17\04\x04\0*[method]tcp-socke\
t.get-receive-buffer-size\x015\x04\0*[method]tcp-socket.set-receive-buffer-size\x01\
'\x04\0'[method]tcp-socket.get-send-buffer-size\x015\x04\0'[method]tcp-socket.se\
t-send-buffer-size\x01'\x01i\x13\x01j\x016\x01\x03\x01@\x01\x0eaddress-family\x05\
\07\x04\0\x19[static]udp-socket.create\x018\x01h\x13\x01@\x02\x04self9\x0dlocal-\
address\x11\0\x18\x04\0\x17[method]udp-socket.bind\x01:\x01@\x02\x04self9\x0erem\
ote-address\x11\0\x18\x04\0\x1a[method]udp-socket.connect\x01;\x01@\x01\x04self9\
\0\x18\x04\0\x1d[method]udp-socket.disconnect\x01<\x01p}\x01k\x11\x01C\x03\x04se\
lf9\x04data=\x0eremote-address>\0\x18\x04\0\x17[method]udp-socket.send\x01?\x01o\
\x02=\x11\x01j\x01\xc0\0\x01\x03\x01C\x01\x04self9\0\xc1\0\x04\0\x1a[method]udp-\
socket.receive\x01B\x01@\x01\x04self9\0#\x04\0$[method]udp-socket.get-local-addr\
ess\x01C\x04\0%[method]udp-socket.get-remote-address\x01C\x01@\x01\x04self9\0\x05\
\x04\0%[method]udp-socket.get-address-family\x01D\x01@\x01\x04self9\01\x04\0([me\
thod]udp-socket.get-unicast-hop-limit\x01E\x01@\x02\x04self9\x05value}\0\x18\x04\
\0([method]udp-socket.set-unicast-hop-limit\x01F\x01@\x01\x04self9\04\x04\0*[met\
hod]udp-socket.get-receive-buffer-size\x01G\x01@\x02\x04self9\x05valuew\0\x18\x04\
\0*[method]udp-socket.set-receive-buffer-size\x01H\x04\0'[method]udp-socket.get-\
send-buffer-size\x01G\x04\0'[method]udp-socket.set-send-buffer-size\x01H\x03\0&w\
asi:sockets/types@0.3.0-rc-2026-01-06\x05\x16\x02\x03\0\x10\x0aip-address\x01B\x08\
\x02\x03\x02\x01\x17\x04\0\x0aip-address\x03\0\0\x01m\x06\x07unknown\x0daccess-d\
enied\x10invalid-argument\x11name-unresolvable\x1atemporary-resolver-failure\x1a\
permanent-resolver-failure\x04\0\x0aerror-code\x03\0\x02\x01p\x01\x01j\x01\x04\x01\
\x03\x01C\x01\x04names\0\x05\x04\0\x11resolve-addresses\x01\x06\x03\0/wasi:socke\
ts/ip-name-lookup@0.3.0-rc-2026-01-06\x05\x18\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\
\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\
\0&wasi:random/random@0.3.0-rc-2026-01-06\x05\x19\x01B\x05\x01p}\x01@\x01\x03len\
w\0\0\x04\0\x19get-insecure-random-bytes\x01\x01\x01@\0\0w\x04\0\x17get-insecure\
-random-u64\x01\x02\x03\0(wasi:random/insecure@0.3.0-rc-2026-01-06\x05\x1a\x01B\x03\
\x01o\x02ww\x01@\0\0\0\x04\0\x11get-insecure-seed\x01\x01\x03\0-wasi:random/inse\
cure-seed@0.3.0-rc-2026-01-06\x05\x1b\x01B\x03\x01j\0\0\x01C\0\0\0\x04\0\x03run\x01\
\x01\x04\0\x20wasi:cli/run@0.3.0-rc-2026-01-06\x05\x1c\x04\0$wasi:cli/command@0.\
3.0-rc-2026-01-06\x04\0\x0b\x0d\x01\0\x07command\x03\0\0\0G\x09producers\x01\x0c\
processed-by\x02\x0dwit-component\x070.244.0\x10wit-bindgen-rust\x060.51.0";
};
};
}
#[doc(inline)]
pub use __export_command_impl as _export_command;
#[rustfmt::skip]
#[cfg(target_arch = "wasm32")]
#[unsafe(
link_section = "component-type:wit-bindgen:0.51.0:wasi:cli@0.3.0-rc-2026-01-06:command-with-all-of-its-exports-removed:encoded worldrust-wasip3-0.4.0+wasi-0.3.0-rc-2026-01-06-from-crates-io-command-world"
)]
#[doc(hidden)]
#[allow(clippy::octal_escapes)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 8047] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xd1=\x01A\x02\x01A1\x01\
B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0fget-environment\x01\x02\x01ps\x01@\
\0\0\x03\x04\0\x0dget-arguments\x01\x04\x01ks\x01@\0\0\x05\x04\0\x0fget-initial-\
cwd\x01\x06\x03\0(wasi:cli/environment@0.3.0-rc-2026-01-06\x05\0\x01B\x03\x01j\0\
\0\x01@\x01\x06status\0\x01\0\x04\0\x04exit\x01\x01\x03\0!wasi:cli/exit@0.3.0-rc\
-2026-01-06\x05\x01\x01B\x02\x01m\x03\x02io\x15illegal-byte-sequence\x04pipe\x04\
\0\x0aerror-code\x03\0\0\x03\0\"wasi:cli/types@0.3.0-rc-2026-01-06\x05\x02\x02\x03\
\0\x02\x0aerror-code\x01B\x08\x02\x03\x02\x01\x03\x04\0\x0aerror-code\x03\0\0\x01\
f\x01}\x01j\0\x01\x01\x01e\x01\x03\x01o\x02\x02\x04\x01@\0\0\x05\x04\0\x0fread-v\
ia-stream\x01\x06\x03\0\"wasi:cli/stdin@0.3.0-rc-2026-01-06\x05\x04\x01B\x06\x02\
\x03\x02\x01\x03\x04\0\x0aerror-code\x03\0\0\x01f\x01}\x01j\0\x01\x01\x01C\x01\x04\
data\x02\0\x03\x04\0\x10write-via-stream\x01\x04\x03\0#wasi:cli/stdout@0.3.0-rc-\
2026-01-06\x05\x05\x01B\x06\x02\x03\x02\x01\x03\x04\0\x0aerror-code\x03\0\0\x01f\
\x01}\x01j\0\x01\x01\x01C\x01\x04data\x02\0\x03\x04\0\x10write-via-stream\x01\x04\
\x03\0#wasi:cli/stderr@0.3.0-rc-2026-01-06\x05\x06\x01B\x01\x04\0\x0eterminal-in\
put\x03\x01\x03\0+wasi:cli/terminal-input@0.3.0-rc-2026-01-06\x05\x07\x01B\x01\x04\
\0\x0fterminal-output\x03\x01\x03\0,wasi:cli/terminal-output@0.3.0-rc-2026-01-06\
\x05\x08\x02\x03\0\x06\x0eterminal-input\x01B\x06\x02\x03\x02\x01\x09\x04\0\x0et\
erminal-input\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x12get-terminal-stdin\
\x01\x04\x03\0+wasi:cli/terminal-stdin@0.3.0-rc-2026-01-06\x05\x0a\x02\x03\0\x07\
\x0fterminal-output\x01B\x06\x02\x03\x02\x01\x0b\x04\0\x0fterminal-output\x03\0\0\
\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stdout\x01\x04\x03\0,wasi:\
cli/terminal-stdout@0.3.0-rc-2026-01-06\x05\x0c\x01B\x06\x02\x03\x02\x01\x0b\x04\
\0\x0fterminal-output\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-termin\
al-stderr\x01\x04\x03\0,wasi:cli/terminal-stderr@0.3.0-rc-2026-01-06\x05\x0d\x01\
B\x02\x01w\x04\0\x08duration\x03\0\0\x03\0%wasi:clocks/types@0.3.0-rc-2026-01-06\
\x05\x0e\x02\x03\0\x0b\x08duration\x01B\x0c\x02\x03\x02\x01\x0f\x04\0\x08duratio\
n\x03\0\0\x01w\x04\0\x04mark\x03\0\x02\x01@\0\0\x03\x04\0\x03now\x01\x04\x01@\0\0\
\x01\x04\0\x0eget-resolution\x01\x05\x01C\x01\x04when\x03\x01\0\x04\0\x0await-un\
til\x01\x06\x01C\x01\x08how-long\x01\x01\0\x04\0\x08wait-for\x01\x07\x03\0/wasi:\
clocks/monotonic-clock@0.3.0-rc-2026-01-06\x05\x10\x01B\x08\x02\x03\x02\x01\x0f\x04\
\0\x08duration\x03\0\0\x01r\x02\x07secondsx\x0bnanosecondsy\x04\0\x07instant\x03\
\0\x02\x01@\0\0\x03\x04\0\x03now\x01\x04\x01@\0\0\x01\x04\0\x0eget-resolution\x01\
\x05\x03\0,wasi:clocks/system-clock@0.3.0-rc-2026-01-06\x05\x11\x02\x03\0\x0d\x07\
instant\x01BY\x02\x03\x02\x01\x12\x04\0\x07instant\x03\0\0\x01w\x04\0\x08filesiz\
e\x03\0\x02\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09directory\
\x04fifo\x0dsymbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-type\x03\
\0\x04\x01n\x06\x04read\x05write\x13file-integrity-sync\x13data-integrity-sync\x14\
requested-write-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\x06\x01\
n\x01\x0esymlink-follow\x04\0\x0apath-flags\x03\0\x08\x01n\x04\x06create\x09dire\
ctory\x09exclusive\x08truncate\x04\0\x0aopen-flags\x03\0\x0a\x01w\x04\0\x0alink-\
count\x03\0\x0c\x01k\x01\x01r\x06\x04type\x05\x0alink-count\x0d\x04size\x03\x15d\
ata-access-timestamp\x0e\x1bdata-modification-timestamp\x0e\x17status-change-tim\
estamp\x0e\x04\0\x0fdescriptor-stat\x03\0\x0f\x01q\x03\x09no-change\0\0\x03now\0\
\0\x09timestamp\x01\x01\0\x04\0\x0dnew-timestamp\x03\0\x11\x01r\x02\x04type\x05\x04\
names\x04\0\x0fdirectory-entry\x03\0\x13\x01m$\x06access\x07already\x0ebad-descr\
iptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-large\x15illegal-byte-se\
quence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-directory\x04loop\x0e\
too-many-links\x0cmessage-size\x0dname-too-long\x09no-device\x08no-entry\x07no-l\
ock\x13insufficient-memory\x12insufficient-space\x0dnot-directory\x09not-empty\x0f\
not-recoverable\x0bunsupported\x06no-tty\x0eno-such-device\x08overflow\x0dnot-pe\
rmitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file-busy\x0ccross-device\x04\
\0\x0aerror-code\x03\0\x15\x01m\x06\x06normal\x0asequential\x06random\x09will-ne\
ed\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x17\x01r\x02\x05lowerw\x05uppe\
rw\x04\0\x13metadata-hash-value\x03\0\x19\x04\0\x0adescriptor\x03\x01\x01h\x1b\x01\
f\x01}\x01j\0\x01\x16\x01e\x01\x1e\x01o\x02\x1d\x1f\x01@\x02\x04self\x1c\x06offs\
et\x03\0\x20\x04\0\"[method]descriptor.read-via-stream\x01!\x01C\x03\x04self\x1c\
\x04data\x1d\x06offset\x03\0\x1e\x04\0#[method]descriptor.write-via-stream\x01\"\
\x01C\x02\x04self\x1c\x04data\x1d\0\x1e\x04\0$[method]descriptor.append-via-stre\
am\x01#\x01C\x04\x04self\x1c\x06offset\x03\x06length\x03\x06advice\x18\0\x1e\x04\
\0\x19[method]descriptor.advise\x01$\x01C\x01\x04self\x1c\0\x1e\x04\0\x1c[method\
]descriptor.sync-data\x01%\x01j\x01\x07\x01\x16\x01C\x01\x04self\x1c\0&\x04\0\x1c\
[method]descriptor.get-flags\x01'\x01j\x01\x05\x01\x16\x01C\x01\x04self\x1c\0(\x04\
\0\x1b[method]descriptor.get-type\x01)\x01C\x02\x04self\x1c\x04size\x03\0\x1e\x04\
\0\x1b[method]descriptor.set-size\x01*\x01C\x03\x04self\x1c\x15data-access-times\
tamp\x12\x1bdata-modification-timestamp\x12\0\x1e\x04\0\x1c[method]descriptor.se\
t-times\x01+\x01f\x01\x14\x01o\x02,\x1f\x01C\x01\x04self\x1c\0-\x04\0![method]de\
scriptor.read-directory\x01.\x04\0\x17[method]descriptor.sync\x01%\x01C\x02\x04s\
elf\x1c\x04paths\0\x1e\x04\0&[method]descriptor.create-directory-at\x01/\x01j\x01\
\x10\x01\x16\x01C\x01\x04self\x1c\00\x04\0\x17[method]descriptor.stat\x011\x01C\x03\
\x04self\x1c\x0apath-flags\x09\x04paths\00\x04\0\x1a[method]descriptor.stat-at\x01\
2\x01C\x05\x04self\x1c\x0apath-flags\x09\x04paths\x15data-access-timestamp\x12\x1b\
data-modification-timestamp\x12\0\x1e\x04\0\x1f[method]descriptor.set-times-at\x01\
3\x01C\x05\x04self\x1c\x0eold-path-flags\x09\x08old-paths\x0enew-descriptor\x1c\x08\
new-paths\0\x1e\x04\0\x1a[method]descriptor.link-at\x014\x01i\x1b\x01j\x015\x01\x16\
\x01C\x05\x04self\x1c\x0apath-flags\x09\x04paths\x0aopen-flags\x0b\x05flags\x07\0\
6\x04\0\x1a[method]descriptor.open-at\x017\x01j\x01s\x01\x16\x01C\x02\x04self\x1c\
\x04paths\08\x04\0\x1e[method]descriptor.readlink-at\x019\x04\0&[method]descript\
or.remove-directory-at\x01/\x01C\x04\x04self\x1c\x08old-paths\x0enew-descriptor\x1c\
\x08new-paths\0\x1e\x04\0\x1c[method]descriptor.rename-at\x01:\x01C\x03\x04self\x1c\
\x08old-paths\x08new-paths\0\x1e\x04\0\x1d[method]descriptor.symlink-at\x01;\x04\
\0![method]descriptor.unlink-file-at\x01/\x01C\x02\x04self\x1c\x05other\x1c\0\x7f\
\x04\0![method]descriptor.is-same-object\x01<\x01j\x01\x1a\x01\x16\x01C\x01\x04s\
elf\x1c\0=\x04\0\x20[method]descriptor.metadata-hash\x01>\x01C\x03\x04self\x1c\x0a\
path-flags\x09\x04paths\0=\x04\0#[method]descriptor.metadata-hash-at\x01?\x03\0)\
wasi:filesystem/types@0.3.0-rc-2026-01-06\x05\x13\x02\x03\0\x0e\x0adescriptor\x01\
B\x07\x02\x03\x02\x01\x14\x04\0\x0adescriptor\x03\0\0\x01i\x01\x01o\x02\x02s\x01\
p\x03\x01@\0\0\x04\x04\0\x0fget-directories\x01\x05\x03\0,wasi:filesystem/preope\
ns@0.3.0-rc-2026-01-06\x05\x15\x01Bq\x02\x03\x02\x01\x0f\x04\0\x08duration\x03\0\
\0\x01m\x0e\x07unknown\x0daccess-denied\x0dnot-supported\x10invalid-argument\x0d\
out-of-memory\x07timeout\x0dinvalid-state\x14address-not-bindable\x0eaddress-in-\
use\x12remote-unreachable\x12connection-refused\x10connection-reset\x12connectio\
n-aborted\x12datagram-too-large\x04\0\x0aerror-code\x03\0\x02\x01m\x02\x04ipv4\x04\
ipv6\x04\0\x11ip-address-family\x03\0\x04\x01o\x04}}}}\x04\0\x0cipv4-address\x03\
\0\x06\x01o\x08{{{{{{{{\x04\0\x0cipv6-address\x03\0\x08\x01q\x02\x04ipv4\x01\x07\
\0\x04ipv6\x01\x09\0\x04\0\x0aip-address\x03\0\x0a\x01r\x02\x04port{\x07address\x07\
\x04\0\x13ipv4-socket-address\x03\0\x0c\x01r\x04\x04port{\x09flow-infoy\x07addre\
ss\x09\x08scope-idy\x04\0\x13ipv6-socket-address\x03\0\x0e\x01q\x02\x04ipv4\x01\x0d\
\0\x04ipv6\x01\x0f\0\x04\0\x11ip-socket-address\x03\0\x10\x04\0\x0atcp-socket\x03\
\x01\x04\0\x0audp-socket\x03\x01\x01i\x12\x01j\x01\x14\x01\x03\x01@\x01\x0eaddre\
ss-family\x05\0\x15\x04\0\x19[static]tcp-socket.create\x01\x16\x01h\x12\x01j\0\x01\
\x03\x01@\x02\x04self\x17\x0dlocal-address\x11\0\x18\x04\0\x17[method]tcp-socket\
.bind\x01\x19\x01C\x02\x04self\x17\x0eremote-address\x11\0\x18\x04\0\x1a[method]\
tcp-socket.connect\x01\x1a\x01f\x01\x14\x01j\x01\x1b\x01\x03\x01@\x01\x04self\x17\
\0\x1c\x04\0\x19[method]tcp-socket.listen\x01\x1d\x01f\x01}\x01C\x02\x04self\x17\
\x04data\x1e\0\x18\x04\0\x17[method]tcp-socket.send\x01\x1f\x01e\x01\x18\x01o\x02\
\x1e\x20\x01@\x01\x04self\x17\0!\x04\0\x1a[method]tcp-socket.receive\x01\"\x01j\x01\
\x11\x01\x03\x01@\x01\x04self\x17\0#\x04\0$[method]tcp-socket.get-local-address\x01\
$\x04\0%[method]tcp-socket.get-remote-address\x01$\x01@\x01\x04self\x17\0\x7f\x04\
\0#[method]tcp-socket.get-is-listening\x01%\x01@\x01\x04self\x17\0\x05\x04\0%[me\
thod]tcp-socket.get-address-family\x01&\x01@\x02\x04self\x17\x05valuew\0\x18\x04\
\0*[method]tcp-socket.set-listen-backlog-size\x01'\x01j\x01\x7f\x01\x03\x01@\x01\
\x04self\x17\0(\x04\0)[method]tcp-socket.get-keep-alive-enabled\x01)\x01@\x02\x04\
self\x17\x05value\x7f\0\x18\x04\0)[method]tcp-socket.set-keep-alive-enabled\x01*\
\x01j\x01\x01\x01\x03\x01@\x01\x04self\x17\0+\x04\0+[method]tcp-socket.get-keep-\
alive-idle-time\x01,\x01@\x02\x04self\x17\x05value\x01\0\x18\x04\0+[method]tcp-s\
ocket.set-keep-alive-idle-time\x01-\x04\0*[method]tcp-socket.get-keep-alive-inte\
rval\x01,\x04\0*[method]tcp-socket.set-keep-alive-interval\x01-\x01j\x01y\x01\x03\
\x01@\x01\x04self\x17\0.\x04\0'[method]tcp-socket.get-keep-alive-count\x01/\x01@\
\x02\x04self\x17\x05valuey\0\x18\x04\0'[method]tcp-socket.set-keep-alive-count\x01\
0\x01j\x01}\x01\x03\x01@\x01\x04self\x17\01\x04\0\x20[method]tcp-socket.get-hop-\
limit\x012\x01@\x02\x04self\x17\x05value}\0\x18\x04\0\x20[method]tcp-socket.set-\
hop-limit\x013\x01j\x01w\x01\x03\x01@\x01\x04self\x17\04\x04\0*[method]tcp-socke\
t.get-receive-buffer-size\x015\x04\0*[method]tcp-socket.set-receive-buffer-size\x01\
'\x04\0'[method]tcp-socket.get-send-buffer-size\x015\x04\0'[method]tcp-socket.se\
t-send-buffer-size\x01'\x01i\x13\x01j\x016\x01\x03\x01@\x01\x0eaddress-family\x05\
\07\x04\0\x19[static]udp-socket.create\x018\x01h\x13\x01@\x02\x04self9\x0dlocal-\
address\x11\0\x18\x04\0\x17[method]udp-socket.bind\x01:\x01@\x02\x04self9\x0erem\
ote-address\x11\0\x18\x04\0\x1a[method]udp-socket.connect\x01;\x01@\x01\x04self9\
\0\x18\x04\0\x1d[method]udp-socket.disconnect\x01<\x01p}\x01k\x11\x01C\x03\x04se\
lf9\x04data=\x0eremote-address>\0\x18\x04\0\x17[method]udp-socket.send\x01?\x01o\
\x02=\x11\x01j\x01\xc0\0\x01\x03\x01C\x01\x04self9\0\xc1\0\x04\0\x1a[method]udp-\
socket.receive\x01B\x01@\x01\x04self9\0#\x04\0$[method]udp-socket.get-local-addr\
ess\x01C\x04\0%[method]udp-socket.get-remote-address\x01C\x01@\x01\x04self9\0\x05\
\x04\0%[method]udp-socket.get-address-family\x01D\x01@\x01\x04self9\01\x04\0([me\
thod]udp-socket.get-unicast-hop-limit\x01E\x01@\x02\x04self9\x05value}\0\x18\x04\
\0([method]udp-socket.set-unicast-hop-limit\x01F\x01@\x01\x04self9\04\x04\0*[met\
hod]udp-socket.get-receive-buffer-size\x01G\x01@\x02\x04self9\x05valuew\0\x18\x04\
\0*[method]udp-socket.set-receive-buffer-size\x01H\x04\0'[method]udp-socket.get-\
send-buffer-size\x01G\x04\0'[method]udp-socket.set-send-buffer-size\x01H\x03\0&w\
asi:sockets/types@0.3.0-rc-2026-01-06\x05\x16\x02\x03\0\x10\x0aip-address\x01B\x08\
\x02\x03\x02\x01\x17\x04\0\x0aip-address\x03\0\0\x01m\x06\x07unknown\x0daccess-d\
enied\x10invalid-argument\x11name-unresolvable\x1atemporary-resolver-failure\x1a\
permanent-resolver-failure\x04\0\x0aerror-code\x03\0\x02\x01p\x01\x01j\x01\x04\x01\
\x03\x01C\x01\x04names\0\x05\x04\0\x11resolve-addresses\x01\x06\x03\0/wasi:socke\
ts/ip-name-lookup@0.3.0-rc-2026-01-06\x05\x18\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\
\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\
\0&wasi:random/random@0.3.0-rc-2026-01-06\x05\x19\x01B\x05\x01p}\x01@\x01\x03len\
w\0\0\x04\0\x19get-insecure-random-bytes\x01\x01\x01@\0\0w\x04\0\x17get-insecure\
-random-u64\x01\x02\x03\0(wasi:random/insecure@0.3.0-rc-2026-01-06\x05\x1a\x01B\x03\
\x01o\x02ww\x01@\0\0\0\x04\0\x11get-insecure-seed\x01\x01\x03\0-wasi:random/inse\
cure-seed@0.3.0-rc-2026-01-06\x05\x1b\x04\0Dwasi:cli/command-with-all-of-its-exp\
orts-removed@0.3.0-rc-2026-01-06\x04\0\x0b-\x01\0'command-with-all-of-its-export\
s-removed\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.\
244.0\x10wit-bindgen-rust\x060.51.0";
#[inline(never)]
#[doc(hidden)]
pub fn __link_custom_section_describing_imports() {
wit_bindgen::rt::maybe_link_cabi_realloc();
}

View File

@@ -0,0 +1,145 @@
use crate::{
http::types::{ErrorCode, HeaderError, Trailers},
wit_bindgen::{FutureReader, FutureWriter, StreamReader, StreamWriter},
wit_future, wit_stream,
};
use http::HeaderMap;
use http_body::{Body as _, Frame};
use std::future::poll_fn;
use std::{fmt::Debug, pin};
type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;
pub type BodyResult = Result<Option<Trailers>, ErrorCode>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// The [`http_body::Body`] returned an error.
#[error("body error: {0}")]
HttpBody(#[source] BoxError),
/// Received trailers were rejected by [`Trailers::from_list`].
#[error("invalid trailers: {0}")]
InvalidTrailers(#[source] HeaderError),
/// The result future reader end was closed (dropped).
///
/// The result that couldn't be written is returned.
#[error("result future reader closed")]
ResultReaderClosed(BodyResult),
/// The stream reader end was closed (dropped).
///
/// The number of bytes written successfully is returned as `written` and
/// the bytes that couldn't be written are returned as `unwritten`.
#[error("stream reader closed")]
StreamReaderClosed { written: usize, unwritten: Vec<u8> },
}
/// BodyWriter coordinates a [`StreamWriter`] and [`FutureWriter`] associated
/// with the write end of a `wasi:http` `Request` or `Response` body.
pub struct BodyWriter {
pub stream_writer: StreamWriter<u8>,
pub result_writer: FutureWriter<BodyResult>,
pub trailers: HeaderMap,
}
impl BodyWriter {
/// Returns a new writer and the matching stream and result future readers,
/// which will typically be used to create a `wasi:http` `Request` or
/// `Response`.
pub fn new() -> (Self, StreamReader<u8>, FutureReader<BodyResult>) {
let (stream_writer, stream_reader) = wit_stream::new();
let (result_writer, result_reader) =
// TODO: is there a more appropriate ErrorCode?
wit_future::new(|| Err(ErrorCode::InternalError(Some("body writer dropped".into()))));
(
Self {
stream_writer,
result_writer,
trailers: Default::default(),
},
stream_reader,
result_reader,
)
}
/// Sends the given [`http_body::Body`] to this writer.
///
/// This copies all data frames from the body to this writer's stream and
/// then writes any trailers from the body to the result future. On success
/// the number of data bytes written to the stream (which does not including
/// trailers) is returned.
///
/// If there is an error it is written to the result future.
pub async fn send_http_body<T>(mut self, mut body: &mut T) -> Result<u64, Error>
where
T: http_body::Body + Unpin,
T::Data: Into<Vec<u8>>,
T::Error: Into<BoxError>,
{
let mut total_written = 0;
loop {
let frame = poll_fn(|cx| pin::Pin::new(&mut body).poll_frame(cx)).await;
match frame {
Some(Ok(frame)) => {
let written = self.send_frame(frame).await?;
total_written += written as u64;
}
Some(Err(err)) => {
let err = err.into();
// TODO: consider if there are better ErrorCode mappings
let error_code = ErrorCode::InternalError(Some(err.to_string()));
// TODO: log result_writer.write errors?
_ = self.result_writer.write(Err(error_code)).await;
return Err(Error::HttpBody(err));
}
None => break,
}
}
drop(self.stream_writer);
let maybe_trailers = if self.trailers.is_empty() {
None
} else {
Some(self.trailers.try_into().map_err(Error::InvalidTrailers)?)
};
match self.result_writer.write(Ok(maybe_trailers)).await {
Ok(()) => Ok(total_written),
Err(err) => Err(Error::ResultReaderClosed(err.value)),
}
}
/// Sends a [`http_body::Frame`].
///
/// - If the frame contains data, the data is written to this writer's
/// stream and the size of the written data is returned.
/// - If the frame contains trailers they are added to [`Self::trailers`]
/// and `Ok(0)` is returned.
pub async fn send_frame<T>(&mut self, frame: Frame<T>) -> Result<usize, Error>
where
T: Into<Vec<u8>>,
{
// Frame is a pseudo-enum which is either 'data' or 'trailers'
if frame.is_data() {
let data = frame.into_data().unwrap_or_else(|_| unreachable!()).into();
let data_len = data.len();
// write_all returns any unwritten data if the read end is dropped
let unwritten = self.stream_writer.write_all(data).await;
if !unwritten.is_empty() {
return Err(Error::StreamReaderClosed {
written: data_len - unwritten.len(),
unwritten,
});
}
Ok(data_len)
} else if frame.is_trailers() {
let trailers = frame.into_trailers().unwrap_or_else(|_| unreachable!());
self.trailers.extend(trailers);
Ok(0)
} else {
unreachable!("Frames are data or trailers");
}
}
}

View File

@@ -0,0 +1,307 @@
use super::{
to_internal_error_code,
RequestOptionsExtension,
IncomingRequestBody,
IncomingResponseBody,
Request as HttpRequest,
Response as HttpResponse,
body_writer::BodyWriter,
};
use crate::http::types::{
ErrorCode,
Fields,
HeaderError,
Headers,
Method,
Scheme,
Request as WasiHttpRequest,
Response as WasiHttpResponse,
};
use std::{
any::Any,
convert::TryFrom,
};
/// Converts a host-side HTTP response (`HttpResponse<T>`) into a WASI HTTP response (`WasiHttpResponse`).
///
/// This function bridges standard Rust `http` responses with the WASI HTTP model,
/// serializing status codes, headers, and body data into their WebAssembly-compatible
/// representations. It supports generic response body types and streams the response
/// asynchronously into the WASI environment.
///
/// # See Also
///
/// - [`http_from_wasi_response`] — converts a WASI response back into a host-side HTTP response.
/// - [`BodyWriter`] — for streaming body data into WASI.
/// - [`IncomingResponseBody`] — for handling pending or unstarted response states.
pub fn http_into_wasi_response<T>(mut resp: HttpResponse<T>) -> Result<WasiHttpResponse, ErrorCode>
where
T: http_body::Body + Any,
T::Data: Into<Vec<u8>>,
T::Error: Into<Box<dyn std::error::Error + Send + Sync + 'static>>
{
if let Some(incoming_body) = (&mut resp as &mut dyn Any).downcast_mut::<IncomingResponseBody>()
{
if let Some(response) = incoming_body.take_unstarted() {
return Ok(response);
}
}
let headers = resp
.headers()
.clone()
.try_into()
.map_err(to_internal_error_code)?;
let (body_writer, body_rx, body_result_rx) = BodyWriter::new();
let (response, _future_result) =
WasiHttpResponse::new(headers, Some(body_rx), body_result_rx);
_ = response.set_status_code(resp.status().as_u16());
wit_bindgen::spawn(async move {
let mut body = std::pin::pin!(resp.into_body());
_ = body_writer.send_http_body(&mut body).await;
});
Ok(response)
}
/// Converts a WASI HTTP response (`WasiHttpResponse`) into a standard host-side
/// [`http::Response`] suitable for use with Rusts `http` ecosystem.
///
/// This function performs the reverse operation of [`http_into_wasi_response`], translating
/// the fields and body of a response from the WASI HTTP model into the conventional Rust
/// `http` crate representation.
///
/// # See Also
///
/// - [`http_into_wasi_response`] — the inverse conversion.
/// - [`IncomingResponseBody`] — for handling WASI-to-host body streams.
/// - [`ErrorCode`] — for standardized error reporting.
pub fn http_from_wasi_response(resp: WasiHttpResponse) -> Result<HttpResponse, ErrorCode> {
let mut builder = http::Response::builder().status(resp.get_status_code());
for (k, v) in resp.get_headers().copy_all() {
builder = builder.header(k, v);
}
let body = IncomingResponseBody::new(resp)?;
builder.body(body).map_err(to_internal_error_code) // TODO: downcast to more specific http error codes
}
/// Converts a host-side HTTP request (`HttpRequest<T>`) into a WASI HTTP request (`WasiHttpRequest`).
///
/// This function bridges between the standard Rust `http` crate request types and the WASI HTTP
/// request model used in WebAssembly components. It serializes headers, method, URI components,
/// and body streams into their WASI equivalents while preserving request metadata.
///
/// # See Also
///
/// - [`http_from_wasi_response`] — for converting WASI responses back into standard HTTP responses.
/// - [`http_into_wasi_response`] — for converting HTTP responses into WASI format.
/// - [`BodyWriter`] — for streaming request bodies to WASI.
/// - [`IncomingRequestBody`] — for managing unstarted or in-progress request states.
pub fn http_into_wasi_request<T>(mut req: HttpRequest<T>) -> Result<WasiHttpRequest, ErrorCode>
where
T: http_body::Body + Any,
T::Data: Into<Vec<u8>>,
T::Error: Into<Box<dyn std::error::Error + Send + Sync + 'static>>
{
if let Some(incoming_body) = (&mut req as &mut dyn Any).downcast_mut::<IncomingRequestBody>()
{
if let Some(request) = incoming_body.take_unstarted() {
return Ok(request);
}
}
let (parts, body) = req.into_parts();
let options = parts
.extensions
.get::<RequestOptionsExtension>()
.cloned()
.map(|o| o.0);
let headers = parts
.headers
.try_into()
.map_err(to_internal_error_code)?;
let (body_writer, contents_rx, trailers_rx) = BodyWriter::new();
let (req, _result) = WasiHttpRequest::new(headers, Some(contents_rx), trailers_rx, options);
req.set_method(&parts.method.into())
.map_err(|()| ErrorCode::HttpRequestMethodInvalid)?;
let scheme = parts.uri.scheme().map(Into::into);
req.set_scheme(scheme.as_ref())
.map_err(|()| ErrorCode::HttpProtocolError)?;
req.set_authority(parts.uri.authority().map(|a| a.as_str()))
.map_err(|()| ErrorCode::HttpRequestUriInvalid)?;
req.set_path_with_query(parts.uri.path_and_query().map(|pq| pq.as_str()))
.map_err(|()| ErrorCode::HttpRequestUriInvalid)?;
wit_bindgen::spawn(async move {
let mut body = std::pin::pin!(body);
_ = body_writer.send_http_body(&mut body).await;
});
Ok(req)
}
/// Converts a WASI HTTP request (`WasiHttpRequest`) into a standard host-side
/// [`http::Request`].
///
/// This function performs the reverse of [`http_into_wasi_request`], translating a request
/// from the WASI HTTP model into a conventional Rust `http` request type. It reconstructs
/// the URI, method, headers, extensions, and body so that the request can be used directly
/// by host HTTP clients, servers, or middleware.
///
/// # See Also
///
/// - [`http_into_wasi_request`] — converts from host HTTP requests into WASI requests.
/// - [`http_from_wasi_request`] — converts from WASI responses into host responses.
/// - [`IncomingRequestBody`] — for streaming WASI request bodies into host code.
/// - [`RequestOptionsExtension`] — for carrying optional request metadata.
pub fn http_from_wasi_request(req: WasiHttpRequest) -> Result<HttpRequest, ErrorCode> {
let uri = {
let mut builder = http::Uri::builder();
if let Some(scheme) = req.get_scheme() {
builder = builder.scheme(scheme);
}
if let Some(authority) = req.get_authority() {
builder = builder.authority(authority);
}
if let Some(path_and_query) = req.get_path_with_query() {
builder = builder.path_and_query(path_and_query);
}
builder
.build()
.map_err(|_| ErrorCode::HttpRequestUriInvalid)?
};
let mut builder = http::Request::builder()
.method(req.get_method())
.uri(uri);
if let Some(options) = req.get_options().map(RequestOptionsExtension) {
builder = builder.extension(options);
}
for (k, v) in req.get_headers().copy_all() {
builder = builder.header(k, v);
}
let body = IncomingRequestBody::new(req)?;
builder.body(body).map_err(to_internal_error_code) // TODO: downcast to more specific http error codes
}
impl TryFrom<Scheme> for http::uri::Scheme {
type Error = http::uri::InvalidUri;
fn try_from(scheme: Scheme) -> Result<Self, Self::Error> {
match scheme {
Scheme::Http => Ok(http::uri::Scheme::HTTP),
Scheme::Https => Ok(http::uri::Scheme::HTTPS),
Scheme::Other(s) => s.parse(),
}
}
}
impl From<&http::uri::Scheme> for Scheme {
fn from(scheme: &http::uri::Scheme) -> Self {
match scheme {
s if s == &http::uri::Scheme::HTTP => Scheme::Http,
s if s == &http::uri::Scheme::HTTPS => Scheme::Https,
other => Scheme::Other(other.to_string()),
}
}
}
impl TryFrom<Method> for http::Method {
type Error = http::method::InvalidMethod;
fn try_from(method: Method) -> Result<Self, Self::Error> {
match method {
Method::Get => Ok(http::Method::GET),
Method::Post => Ok(http::Method::POST),
Method::Put => Ok(http::Method::PUT),
Method::Delete => Ok(http::Method::DELETE),
Method::Patch => Ok(http::Method::PATCH),
Method::Head => Ok(http::Method::HEAD),
Method::Options => Ok(http::Method::OPTIONS),
Method::Connect => Ok(http::Method::CONNECT),
Method::Trace => Ok(http::Method::TRACE),
Method::Other(o) => http::Method::from_bytes(o.as_bytes()),
}
}
}
impl From<&http::Method> for Method {
fn from(method: &http::Method) -> Self {
match method {
&http::Method::GET => Method::Get,
&http::Method::POST => Method::Post,
&http::Method::PUT => Method::Put,
&http::Method::DELETE => Method::Delete,
&http::Method::PATCH => Method::Patch,
&http::Method::HEAD => Method::Head,
&http::Method::OPTIONS => Method::Options,
&http::Method::CONNECT => Method::Connect,
&http::Method::TRACE => Method::Trace,
other => Method::Other(other.to_string()),
}
}
}
impl From<http::Method> for Method {
fn from(method: http::Method) -> Self {
(&method).into()
}
}
impl TryFrom<Headers> for http::HeaderMap {
type Error = ErrorCode;
fn try_from(headers: Headers) -> Result<Self, Self::Error> {
headers
.copy_all()
.into_iter()
.try_fold(http::HeaderMap::new(), |mut map, (k, v)| {
let v = http::HeaderValue::from_bytes(&v).map_err(to_internal_error_code)?;
let k: http::HeaderName = k.parse().map_err(to_internal_error_code)?;
map.append(k, v);
Ok(map)
})
}
}
impl TryFrom<http::HeaderMap> for Fields {
type Error = HeaderError;
fn try_from(map: http::HeaderMap) -> Result<Self, Self::Error> {
// https://docs.rs/http/1.3.1/http/header/struct.HeaderMap.html#method.into_iter-2
// For each yielded item that has None provided for the HeaderName, then
// the associated header name is the same as that of the previously
// yielded item. The first yielded item will have HeaderName set.
let mut last_name = None;
let iter = map.into_iter().map(move |(name, value)| {
if name.is_some() {
last_name = name;
}
let name = last_name
.as_ref()
.expect("HeaderMap::into_iter always returns Some(name) before None");
let value = bytes::Bytes::from_owner(value).to_vec();
(name.as_str().into(), value)
});
let entries = Vec::from_iter(iter);
Fields::from_list(&entries)
}
}

314
vendor/wasip3/src/http_compat/mod.rs vendored Normal file
View File

@@ -0,0 +1,314 @@
//! Extension types for wasip3::http
pub use body_writer::*;
mod body_writer;
pub use conversions::*;
mod conversions;
use crate::{
http::types::{self, ErrorCode},
wit_bindgen::{self, StreamResult},
wit_future,
};
use bytes::Bytes;
use http_body::SizeHint;
use std::{
pin::Pin,
task::{self, Poll},
};
const READ_FRAME_SIZE: usize = 16 * 1024;
/// The body type used for incoming HTTP requests.
///
/// This is a type alias for [`IncomingBody`] specialized with
/// [`types::Request`], representing the structured payload of an
/// inbound request as it is received and processed.
///
/// This type is typically used by components that consume HTTP
/// requests and need to read or stream the request body.
pub type IncomingRequestBody = IncomingBody<types::Request>;
/// The body type used for incoming HTTP responses.
///
/// This is a type alias for [`IncomingBody`] specialized with
/// [`types::Response`], representing the structured payload of an
/// inbound response as it is received and processed.
///
/// This type is typically used by components that handle HTTP
/// responses and need to read or stream the response body.
pub type IncomingResponseBody = IncomingBody<types::Response>;
/// A type alias for an HTTP request with a customizable body type.
///
/// This is a convenience wrapper around [`http::Request`], parameterized
/// by the body type `T`. By default, it uses [`IncomingRequestBody`],
/// which represents the standard incoming body used by this runtime.
///
/// # See also
/// - [`IncomingRequestBody`]: The body type for inbound HTTP requests.
/// - [`http::Request`]: The standard HTTP request type from the `http` crate.
pub type Request<T = IncomingRequestBody> = http::Request<T>;
/// A type alias for an HTTP response with a customizable body type.
///
/// This is a convenience wrapper around [`http::Response`], parameterized
/// by the body type `T`. By default, it uses [`IncomingResponseBody`],
/// which represents the standard incoming body type used by this runtime.
///
/// # See also
/// - [`IncomingResponseBody`]: The body type for inbound HTTP responses.
/// - [`http::Response`]: The standard HTTP response type from the `http` crate.
pub type Response<T = IncomingResponseBody> = http::Response<T>;
/// A wrapper around [`types::RequestOptions`] that implements [`Clone`]
pub struct RequestOptionsExtension(pub types::RequestOptions);
impl Clone for RequestOptionsExtension {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
/// Internal trait representing a readable inbound HTTP message.
///
/// Implemented by types that expose request or response headers
/// and provide mechanisms to consume the message body.
pub trait IncomingMessage: Unpin {
fn get_headers(&self) -> types::Headers;
fn consume_body(
self,
res: wit_bindgen::FutureReader<Result<(), ErrorCode>>,
) -> (
wit_bindgen::StreamReader<u8>,
wit_bindgen::FutureReader<Result<Option<types::Trailers>, ErrorCode>>,
);
}
impl IncomingMessage for types::Request {
fn get_headers(&self) -> types::Headers {
self.get_headers()
}
fn consume_body(
self,
res: wit_bindgen::FutureReader<Result<(), ErrorCode>>,
) -> (
wit_bindgen::StreamReader<u8>,
wit_bindgen::FutureReader<Result<Option<types::Trailers>, ErrorCode>>,
) {
Self::consume_body(self, res)
}
}
impl IncomingMessage for types::Response {
fn get_headers(&self) -> types::Headers {
self.get_headers()
}
fn consume_body(
self,
res: wit_bindgen::FutureReader<Result<(), ErrorCode>>,
) -> (
wit_bindgen::StreamReader<u8>,
wit_bindgen::FutureReader<Result<Option<types::Trailers>, ErrorCode>>,
) {
Self::consume_body(self, res)
}
}
/// A stream of Bytes, used when receiving bodies from the network.
pub struct IncomingBody<T> {
state: StartedState<T>,
content_length: Option<u64>,
}
enum StartedState<T> {
Unstarted(T),
Started {
#[allow(dead_code)]
result: wit_bindgen::FutureWriter<Result<(), ErrorCode>>,
state: IncomingState,
},
Empty,
}
impl<T: IncomingMessage> IncomingBody<T> {
/// Creates a new [`IncomingBody`] from the given incoming message.
///
/// This initializes the body in an *unstarted* state and extracts the
/// `Content-Length` header if present. The resulting instance can later
/// transition into a streaming or consumed state.
///
/// Returns an [`ErrorCode`] if the content length is invalid or cannot
/// be determined.
pub fn new(msg: T) -> Result<Self, ErrorCode> {
let content_length = get_content_length(msg.get_headers())?;
Ok(Self {
state: StartedState::Unstarted(msg),
content_length,
})
}
/// Takes ownership of the inner message if the body has not yet been started.
///
/// This method replaces the internal state with [`StartedState::Empty`]
/// and returns the contained message if it was still in the
/// *unstarted* state. Returns `None` otherwise.
pub fn take_unstarted(&mut self) -> Option<T> {
match self.state {
StartedState::Unstarted(_) => {
let StartedState::Unstarted(msg) =
std::mem::replace(&mut self.state, StartedState::Empty)
else {
unreachable!();
};
Some(msg)
}
_ => None,
}
}
fn ensure_started(&mut self) -> Result<&mut IncomingState, ErrorCode> {
if let StartedState::Unstarted(_) = self.state {
let msg = self.take_unstarted().unwrap();
let (result, reader) = wit_future::new(|| Ok(()));
let (stream, trailers) = msg.consume_body(reader);
self.state = StartedState::Started {
result,
state: IncomingState::Ready { stream, trailers },
};
};
match &mut self.state {
StartedState::Started { state, .. } => Ok(state),
StartedState::Unstarted(_) => unreachable!(),
StartedState::Empty => Err(to_internal_error_code(
"cannot use IncomingBody after call to take_unstarted",
)),
}
}
}
enum IncomingState {
Ready {
stream: wit_bindgen::StreamReader<u8>,
trailers: wit_bindgen::FutureReader<Result<Option<types::Trailers>, ErrorCode>>,
},
Reading(Pin<Box<dyn std::future::Future<Output = ReadResult> + 'static + Send>>),
Done,
}
enum ReadResult {
Trailers(Result<Option<types::Trailers>, ErrorCode>),
BodyChunk {
chunk: Vec<u8>,
stream: wit_bindgen::StreamReader<u8>,
trailers: wit_bindgen::FutureReader<Result<Option<types::Trailers>, ErrorCode>>,
},
}
impl<T: IncomingMessage> http_body::Body for IncomingBody<T> {
type Data = Bytes;
type Error = ErrorCode;
fn poll_frame(
mut self: Pin<&mut Self>,
cx: &mut task::Context<'_>,
) -> Poll<Option<Result<http_body::Frame<Self::Data>, Self::Error>>> {
let state = self.ensure_started()?;
loop {
match state {
IncomingState::Ready { .. } => {
let IncomingState::Ready {
mut stream,
trailers,
} = std::mem::replace(state, IncomingState::Done)
else {
unreachable!();
};
*state = IncomingState::Reading(Box::pin(async move {
let (result, chunk) =
stream.read(Vec::with_capacity(READ_FRAME_SIZE)).await;
match result {
StreamResult::Complete(_n) => ReadResult::BodyChunk {
chunk,
stream,
trailers,
},
StreamResult::Cancelled => unreachable!(),
StreamResult::Dropped => ReadResult::Trailers(trailers.await),
}
}));
}
IncomingState::Reading(future) => {
match std::task::ready!(future.as_mut().poll(cx)) {
ReadResult::BodyChunk {
chunk,
stream,
trailers,
} => {
*state = IncomingState::Ready { stream, trailers };
break Poll::Ready(Some(Ok(http_body::Frame::data(chunk.into()))));
}
ReadResult::Trailers(trailers) => {
*state = IncomingState::Done;
match trailers {
Ok(Some(fields)) => {
let trailers = fields.try_into()?;
break Poll::Ready(Some(Ok(http_body::Frame::trailers(
trailers,
))));
}
Ok(None) => {}
Err(e) => {
break Poll::Ready(Some(Err(e)));
}
}
}
}
}
IncomingState::Done => break Poll::Ready(None),
}
}
}
fn is_end_stream(&self) -> bool {
matches!(
self.state,
StartedState::Started {
state: IncomingState::Done,
..
}
)
}
fn size_hint(&self) -> SizeHint {
let Some(n) = self.content_length else {
return SizeHint::default();
};
let mut size_hint = SizeHint::new();
size_hint.set_lower(0);
size_hint.set_upper(n);
size_hint
}
}
fn get_content_length(headers: types::Headers) -> Result<Option<u64>, ErrorCode> {
let values = headers.get(http::header::CONTENT_LENGTH.as_str());
if values.len() > 1 {
return Err(to_internal_error_code("multiple content-length values"));
}
let Some(value_bytes) = values.into_iter().next() else {
return Ok(None);
};
let value_str = std::str::from_utf8(&value_bytes).map_err(to_internal_error_code)?;
let value_i64: i64 = value_str.parse().map_err(to_internal_error_code)?;
let value = value_i64.try_into().map_err(to_internal_error_code)?;
Ok(Some(value))
}
fn to_internal_error_code(e: impl ::std::fmt::Display) -> ErrorCode {
ErrorCode::InternalError(Some(e.to_string()))
}

10543
vendor/wasip3/src/imports.rs vendored Normal file

File diff suppressed because it is too large Load Diff

280
vendor/wasip3/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,280 @@
//! Raw API bindings to the [WebAssembly System Interface p3 (WASIp3)][WASIp3]
//!
//! [WASIp3]: https://github.com/WebAssembly/WASI
//!
//! This crate provides Rust API bindings to the imports of [WASIp3] [worlds]
//! such as:
//!
//! * [`wasi:cli/command`]
//! * [`wasi:http/proxy`]
//!
//! This crate is procedurally generated with the [`wit-bindgen`] bindings
//! generator. Note that generated code is published to crates.io to slim this
//! crate down in terms of build dependencies and resources.
//!
//! # What is WASIp3?
//!
//! [WASIp3] is a set of APIs defined for the WebAssembly [Component Model] to
//! help components interact with the outside world. Core WebAssembly has no
//! intrinsic ability to access the host, for example `println!` don't work, but
//! [WASIp3] defines how to do so with the [`wasi:cli/stdio`] package.
//!
//! [WASIp3] is defined by an IDL called [WIT] using files that have the extension
//! `*.wit`. [WASIp3] and [WIT] are themselves then both defined in terms of the
//! [Component Model] in terms of types available and base semantics for APIs.
//!
//! [WASIp3] defines a number of standard "worlds" which are a description of a
//! what a WebAssembly component can import from an embedding and must export to
//! an embedding. An example world is [`wasi:cli/command`] which is a world for
//! running CLI applications. This world provides basic system utilities such as
//! clocks, a filesystem, CLI arguments, etc. The one required export is a main
//! function.
//!
//! The purpose of this crate is to provide pregenerated bindings to access
//! [WASIp3]-defined imports available to components.
//!
//! # What is a Component?
//!
//! An important aspect of [WASIp3] is that it is defined in terms of the
//! [Component Model]. The [Component Model] is a proposal for WebAssembly which
//! is a new format for wasm binaries, a component. A component contains "core"
//! WebAssembly modules (which are [standard WebAssembly modules]) but also has
//! the ability to do more:
//!
//! * A component can contain multiple core WebAssembly modules.
//! * Types used with component imports and exports are more comprehensive than
//! core WebAssembly. Core WebAssembly provides integers and floats, for
//! example, and components build on this and add strings, records (aka a Rust
//! `struct`), variants (aka a Rust `enum`), and resources (think a file
//! descriptor on Unix).
//! * A component provides procedural instructions of how to instantiate its
//! internal core WebAssembly modules with the imports it has.
//!
//! A full description of the component model is out of scope for this crate's
//! documentation but it suffices to say that [WASIp3], and this crate, are
//! intended to target components. Components use core WebAssembly modules as an
//! important technical detail, but the final output of this crate is intended
//! to be a component.
//!
//! # What are generated bindings?
//!
//! Above it was seen that [WASIp3] is defined with [WIT]. These programmatic
//! descriptions of [WASIp3] APIs are not suitable for use directly in Rust,
//! however these descriptions define how Rust can use them. Each [WIT] function
//! has a defined meaning in core WebAssembly via the [Canonical ABI]. This is a
//! lower level than most users want to operate at, however, so the generated
//! bindings in this crate serve as the bridge.
//!
//! More specifically the generated functions in this crate take the [Canonical
//! ABI] format of [WIT] functions and provide idiomatic Rust functions to call.
//! For example the [`wasi:cli/environment`] definition includes:
//!
//! ```wit
//! interface environment {
//! // ...
//! get-environment: func() -> list<tuple<string, string>>;
//! // ...
//! }
//! ```
//!
//! This corresponds to
//! [`wasi::cli::environment::get_environment`](crate::cli::environment::get_environment).
//!
//! Bindings are pre-generated in this crate with the [`wit-bindgen`] tool. You
//! can also generate your own bindings with [`wit-bindgen`] and [WASIp3] [WIT]
//! files too, but that's not covered by this crate.
//!
//! # WASIp3, WASIp2, and WASIp1
//!
//! The [WASIp3] version of the WASI standard is not yet complete nor stable. It
//! is under development and this crate represents a snapshot in time of what
//! the APIs may eventually look like.
//!
//! Users looking for stability should use WASIp2 (the `wasip2` crate) instead.
//! Users looking for core wasm, not components, should use the `wasip1` crate.
//!
//! # Crate Organization
//!
//! This crate is currently entirely generated by [`wit-bindgen`] which has the
//! following structure:
//!
//! * Each [WIT] package with bindings corresponds to a top-level module. For
//! example [`wasi:random`] can be found in the [`random`] module.
//! * Each [WIT] interface then corresponds to a submodule of its package's
//! module. For example [`wasi:random/insecure`] can be found in the
//! [`random::insecure`] module.
//! * Each [WIT] function has a Rust function with an idiomatic signature.
//! module. For example [`random::insecure::get_insecure_random_u64`].
//!
//! Note that [WIT] documentation is rendered as rustdoc documentation in these
//! APIs as well.
//!
//! # Using this Crate
//!
//! This crate is intended to be used with the `wasm32-wasip2` target to the
//! Rust compiler. You can compile your code as:
//!
//! ```sh
//! $ cargo build --target wasm32-wasip2
//! ```
//!
//! Eventually a `wasm32-wasip3` target will be added to the Rust compiler but
//! in the meantime the `wasm32-wasip2` target suffices. Using a WASIp2 target
//! means that the standard library will use WASIp2, but users of this crate
//! will use WASIp3.
//!
//! ## Export Macros
//!
//! In addition to providing bindings for imports this crate also provides
//! macros to export the `wasi:cli/run` and `wasi:http/proxy` worlds, see their
//! respective documentation for more information:
//!
//! - [`wasi::cli::command::export!`](crate::cli::command::export)
//! - [`wasi::http::proxy::export!`](crate::http::proxy::export)
//!
//! [worlds]: https://component-model.bytecodealliance.org/design/worlds.html
//! [`wasi:cli/command`]: https://github.com/WebAssembly/wasi-cli/
//! [`wasi:http/proxy`]: https://github.com/WebAssembly/wasi-http
//! [`wasi:cli/stdio`]: https://github.com/WebAssembly/wasi-cli/blob/main/wit-0.3.0-draft/stdio.wit
//! [`wit-bindgen`]: https://github.com/bytecodealliance/wit-bindgen/
//! [Component Model]: https://component-model.bytecodealliance.org/
//! [WIT]: https://component-model.bytecodealliance.org/design/wit.html
//! [standard WebAssembly modules]: https://webassembly.github.io/spec/
//! [Wasmtime]: https://github.com/bytecodealliance/wasmtime
//! [jco]: https://github.com/bytecodealliance/jco
//! [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md
//! [`wasi:cli/environment`]: https://github.com/WebAssembly/wasi-cli/blob/main/wit-0.3.0-draft/environment.wit
//! [`wasi:random`]: https://github.com/WebAssembly/wasi-random
//! [`wasi:random/insecure`]: https://github.com/WebAssembly/wasi-random/blob/main/wit-0.3.0-draft/insecure.wit
//! [`wasm-tools`]: https://github.com/bytecodealliance/wasm-tools
//! [adapters]: https://github.com/bytecodealliance/wasmtime/releases
// These modules are all auto-generated by `./ci/regenerate.sh`
#[allow(unused_imports)]
mod command;
mod imports;
#[allow(unused_imports)]
mod service;
// generated bindings start with the package namespace, which in this case is
// `wasi`, but the crate is already called wasi, so lift everything up one level
// to the root of this crate.
pub use imports::wasi::*;
pub use imports::{wit_future, wit_stream};
// Forward one `wit_future` impl for another as there's a few extra types in the
// `proxy::wit_future` type. This might need changes if wit-bindgen's internal
// implementation here changes.
impl<T> wit_future::FuturePayload for T
where
T: service::wit_future::FuturePayload,
{
const VTABLE: &'static wit_bindgen::rt::async_support::FutureVtable<Self> = T::VTABLE;
}
// Reexport wit-bindgen to downstream users don't have to depend on it.
pub use wit_bindgen;
// Expand the `cli` and `http` modules with `export!` macros for the
// command/proxy worlds, but also retain all the contents defined in the
// `bindings` module as well.
pub mod cli {
pub use super::imports::wasi::cli::*;
pub mod command {
/// Generate an exported instance of the `wasi:cli/command` world.
///
/// This macro generate the `#[no_mangle]` functions necessary to
/// export this interface. It takes an argument which is a type that
/// must implement the
/// [`exports::cli::run::Guest`](crate::exports::cli::run::Guest)
/// trait.
///
/// ```
/// struct MyCliRunner;
///
/// impl wasip3::exports::cli::run::Guest for MyCliRunner {
/// async fn run() -> Result<(), ()> {
/// // ...
/// # panic!();
/// }
/// }
///
/// wasip3::cli::command::export!(MyCliRunner);
/// ```
///
/// ## Incompatibility with `bin` target
///
/// This macro is not compatible with the Rust `bin` crate target
/// which instead use a `fn main()`. This macro can, however, be used
/// with the `cdylib` crate target.
///
/// <!--
/// The marker above hides the generated documentation by wit-bindgen for this
/// macro.
#[doc(inline)]
pub use crate::command::_export_command as export;
}
}
#[cfg(feature = "http-compat")]
pub mod http_compat;
pub mod http {
pub use super::service::wasi::http::*;
pub mod service {
/// Generate an exported instance of the `wasi:http/service` world.
///
/// This macro will generate `#[no_mangle]` functions as necessary to
/// export an implementation of the
/// [`exports::http::handler::Guest`](crate::exports::http::handler::Guest)
/// trait. This macro takes an argument which is a type that implements
/// this trait:
///
/// ```
/// use wasip3::http::types::{Request, Response, ErrorCode};
///
/// struct MyIncomingHandler;
///
/// impl wasip3::exports::http::handler::Guest for MyIncomingHandler {
/// async fn handle(request: Request) -> Result<Response, ErrorCode> {
/// // ...
/// # panic!();
/// }
/// }
///
/// wasip3::http::service::export!(MyIncomingHandler);
/// ```
///
/// <!--
/// The marker above hides the generated documentation by wit-bindgen
/// for this macro.
#[doc(inline)]
pub use crate::service::_export_service as export;
}
}
pub mod exports {
// This is required by the `export!` macros of this crate which assume that
// the types it's referring to show up as `exports::wasi::...`.
//
// This isn't part of the public interface, though, so hide this.
#[doc(hidden)]
pub mod wasi {
pub use crate::command::exports::wasi::*;
pub use crate::service::exports::wasi::*;
}
// These are the restructured public interface of this crate.
pub use crate::command::exports::wasi::cli;
pub use crate::service::exports::wasi::http;
}
// These macros are used by recursive invocations of the macro, but they're
// `#[doc(hidden)]` as it's not part of the public interface.
#[doc(hidden)]
pub use crate::command::_export_command;
#[doc(hidden)]
pub use crate::service::_export_service;

7274
vendor/wasip3/src/service.rs vendored Normal file

File diff suppressed because it is too large Load Diff