From da010b2177636cdf953a6be833a96b1a9c87bcf9 Mon Sep 17 00:00:00 2001 From: Brian H Date: Thu, 19 Dec 2024 14:34:41 -0700 Subject: [PATCH] Fix deny-all adapter for socket imports Signed-off-by: Brian H --- crates/compose/deny-all/src/bindings.rs | 11494 ++++++++++++---------- crates/compose/deny-all/src/wasi.rs | 29 +- crates/compose/deny-all/wit/world.wit | 2 + crates/compose/deny_all.wasm | Bin 134176 -> 130714 bytes 4 files changed, 6472 insertions(+), 5053 deletions(-) diff --git a/crates/compose/deny-all/src/bindings.rs b/crates/compose/deny-all/src/bindings.rs index ad3b2ebbc4..e8fc41397e 100644 --- a/crates/compose/deny-all/src/bindings.rs +++ b/crates/compose/deny-all/src/bindings.rs @@ -1,5 +1,3 @@ -// Generated by `wit-bindgen` 0.25.0. DO NOT EDIT! -// Options used: #[allow(dead_code)] pub mod wasi { #[allow(dead_code)] @@ -8,9 +6,7 @@ pub mod wasi { pub mod wall_clock { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; #[repr(C)] #[derive(Clone, Copy)] pub struct Datetime { @@ -18,7 +14,10 @@ pub mod wasi { pub nanoseconds: u32, } impl ::core::fmt::Debug for Datetime { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("Datetime") .field("seconds", &self.seconds) .field("nanoseconds", &self.nanoseconds) @@ -38,7 +37,6 @@ pub mod wasi { #[link_name = "now"] fn wit_import(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: *mut u8) { unreachable!() @@ -65,7 +63,6 @@ pub mod wasi { #[link_name = "resolution"] fn wit_import(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: *mut u8) { unreachable!() @@ -80,14 +77,11 @@ pub mod wasi { } } } - #[allow(dead_code, clippy::all)] pub mod monotonic_clock { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type Pollable = super::super::super::wasi::io0_2_0::poll::Pollable; pub type Instant = u64; @@ -101,7 +95,6 @@ pub mod wasi { #[link_name = "now"] fn wit_import() -> i64; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import() -> i64 { unreachable!() @@ -119,7 +112,6 @@ pub mod wasi { #[link_name = "resolution"] fn wit_import() -> i64; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import() -> i64 { unreachable!() @@ -137,13 +129,14 @@ pub mod wasi { #[link_name = "subscribe-instant"] fn wit_import(_: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i64) -> i32 { unreachable!() } let ret = wit_import(_rt::as_i64(when)); - super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle( + ret as u32, + ) } } #[allow(unused_unsafe, clippy::all)] @@ -155,13 +148,14 @@ pub mod wasi { #[link_name = "subscribe-duration"] fn wit_import(_: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i64) -> i32 { unreachable!() } let ret = wit_import(_rt::as_i64(when)); - super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle( + ret as u32, + ) } } } @@ -172,29 +166,43 @@ pub mod wasi { pub mod types { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type InputStream = super::super::super::wasi::io0_2_0::streams::InputStream; pub type OutputStream = super::super::super::wasi::io0_2_0::streams::OutputStream; pub type Error = super::super::super::wasi::io0_2_0::streams::Error; pub type Datetime = super::super::super::wasi::clocks0_2_0::wall_clock::Datetime; + /// File size or length of a region within a file. pub type Filesize = u64; + /// The type of a filesystem object referenced by a descriptor. + /// + /// Note: This was called `filetype` in earlier versions of WASI. #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum DescriptorType { + /// The type of the descriptor or file is unknown or is different from + /// any of the other types specified. Unknown, + /// The descriptor refers to a block device inode. BlockDevice, + /// The descriptor refers to a character device inode. CharacterDevice, + /// The descriptor refers to a directory inode. Directory, + /// The descriptor refers to a named pipe. Fifo, + /// The file refers to a symbolic link inode. SymbolicLink, + /// The descriptor refers to a regular file inode. RegularFile, + /// The descriptor refers to a socket. Socket, } impl ::core::fmt::Debug for DescriptorType { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { DescriptorType::Unknown => { f.debug_tuple("DescriptorType::Unknown").finish() @@ -208,25 +216,27 @@ pub mod wasi { DescriptorType::Directory => { f.debug_tuple("DescriptorType::Directory").finish() } - DescriptorType::Fifo => f.debug_tuple("DescriptorType::Fifo").finish(), + DescriptorType::Fifo => { + f.debug_tuple("DescriptorType::Fifo").finish() + } DescriptorType::SymbolicLink => { f.debug_tuple("DescriptorType::SymbolicLink").finish() } DescriptorType::RegularFile => { f.debug_tuple("DescriptorType::RegularFile").finish() } - DescriptorType::Socket => f.debug_tuple("DescriptorType::Socket").finish(), + DescriptorType::Socket => { + f.debug_tuple("DescriptorType::Socket").finish() + } } } } - impl DescriptorType { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> DescriptorType { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => DescriptorType::Unknown, 1 => DescriptorType::BlockDevice, @@ -236,51 +246,110 @@ pub mod wasi { 5 => DescriptorType::SymbolicLink, 6 => DescriptorType::RegularFile, 7 => DescriptorType::Socket, - _ => panic!("invalid enum discriminant"), } } } - wit_bindgen_rt::bitflags::bitflags! { - #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] - pub struct DescriptorFlags: u8 { - const READ = 1 << 0; - const WRITE = 1 << 1; - const FILE_INTEGRITY_SYNC = 1 << 2; - const DATA_INTEGRITY_SYNC = 1 << 3; - const REQUESTED_WRITE_SYNC = 1 << 4; - const MUTATE_DIRECTORY = 1 << 5; - } + #[doc = " Descriptor flags."] #[doc = ""] #[doc = + " Note: This was called `fdflags` in earlier versions of WASI."] + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub + struct DescriptorFlags : u8 { #[doc = " Read mode: Data can be read."] + const READ = 1 << 0; #[doc = " Write mode: Data can be written to."] + const WRITE = 1 << 1; #[doc = + " Request that writes be performed according to synchronized I/O file"] + #[doc = + " integrity completion. The data stored in the file and the file's"] + #[doc = + " metadata are synchronized. This is similar to `O_SYNC` in POSIX."] + #[doc = ""] #[doc = + " The precise semantics of this operation have not yet been defined for"] + #[doc = + " WASI. At this time, it should be interpreted as a request, and not a"] + #[doc = " requirement."] const FILE_INTEGRITY_SYNC = 1 << 2; #[doc = + " Request that writes be performed according to synchronized I/O data"] + #[doc = " integrity completion. Only the data stored in the file is"] + #[doc = " synchronized. This is similar to `O_DSYNC` in POSIX."] #[doc = + ""] #[doc = + " The precise semantics of this operation have not yet been defined for"] + #[doc = + " WASI. At this time, it should be interpreted as a request, and not a"] + #[doc = " requirement."] const DATA_INTEGRITY_SYNC = 1 << 3; #[doc = + " Requests that reads be performed at the same level of integrety"] #[doc + = " requested for writes. This is similar to `O_RSYNC` in POSIX."] #[doc + = ""] #[doc = + " The precise semantics of this operation have not yet been defined for"] + #[doc = + " WASI. At this time, it should be interpreted as a request, and not a"] + #[doc = " requirement."] const REQUESTED_WRITE_SYNC = 1 << 4; #[doc = + " Mutating directories mode: Directory contents may be mutated."] #[doc = + ""] #[doc = + " When this flag is unset on a descriptor, operations using the"] #[doc = + " descriptor which would create, rename, delete, modify the data or"] + #[doc = + " metadata of filesystem objects, or obtain another handle which"] #[doc + = + " would permit any of those, shall fail with `error-code::read-only` if"] + #[doc = " they would otherwise succeed."] #[doc = ""] #[doc = + " This may only be set on directories."] const MUTATE_DIRECTORY = 1 << 5; + } } wit_bindgen_rt::bitflags::bitflags! { - #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] - pub struct PathFlags: u8 { - const SYMLINK_FOLLOW = 1 << 0; - } + #[doc = " Flags determining the method of how paths are resolved."] + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub + struct PathFlags : u8 { #[doc = + " As long as the resolved path corresponds to a symbolic link, it is"] + #[doc = " expanded."] const SYMLINK_FOLLOW = 1 << 0; } } wit_bindgen_rt::bitflags::bitflags! { - #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] - pub struct OpenFlags: u8 { - const CREATE = 1 << 0; - const DIRECTORY = 1 << 1; - const EXCLUSIVE = 1 << 2; - const TRUNCATE = 1 << 3; - } + #[doc = " Open flags used by `open-at`."] #[derive(PartialEq, Eq, + PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub struct OpenFlags : u8 { + #[doc = + " Create file if it does not exist, similar to `O_CREAT` in POSIX."] + const CREATE = 1 << 0; #[doc = + " Fail if not a directory, similar to `O_DIRECTORY` in POSIX."] const + DIRECTORY = 1 << 1; #[doc = + " Fail if file already exists, similar to `O_EXCL` in POSIX."] const + EXCLUSIVE = 1 << 2; #[doc = + " Truncate file to size 0, similar to `O_TRUNC` in POSIX."] const + TRUNCATE = 1 << 3; } } + /// Number of hard links to an inode. pub type LinkCount = u64; + /// File attributes. + /// + /// Note: This was called `filestat` in earlier versions of WASI. #[repr(C)] #[derive(Clone, Copy)] pub struct DescriptorStat { + /// File type. pub type_: DescriptorType, + /// Number of hard links to the file. pub link_count: LinkCount, + /// For regular files, the file size in bytes. For symbolic links, the + /// length in bytes of the pathname contained in the symbolic link. pub size: Filesize, + /// Last data access timestamp. + /// + /// If the `option` is none, the platform doesn't maintain an access + /// timestamp for this file. pub data_access_timestamp: Option, + /// Last data modification timestamp. + /// + /// If the `option` is none, the platform doesn't maintain a + /// modification timestamp for this file. pub data_modification_timestamp: Option, + /// Last file status-change timestamp. + /// + /// If the `option` is none, the platform doesn't maintain a + /// status-change timestamp for this file. pub status_change_timestamp: Option, } impl ::core::fmt::Debug for DescriptorStat { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("DescriptorStat") .field("type", &self.type_) .field("link-count", &self.link_count) @@ -294,16 +363,26 @@ pub mod wasi { .finish() } } + /// When setting a timestamp, this gives the value to set it to. #[derive(Clone, Copy)] pub enum NewTimestamp { + /// Leave the timestamp set to its previous value. NoChange, + /// Set the timestamp to the current time of the system clock associated + /// with the filesystem. Now, + /// Set the timestamp to the given value. Timestamp(Datetime), } impl ::core::fmt::Debug for NewTimestamp { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - NewTimestamp::NoChange => f.debug_tuple("NewTimestamp::NoChange").finish(), + NewTimestamp::NoChange => { + f.debug_tuple("NewTimestamp::NoChange").finish() + } NewTimestamp::Now => f.debug_tuple("NewTimestamp::Now").finish(), NewTimestamp::Timestamp(e) => { f.debug_tuple("NewTimestamp::Timestamp").field(e).finish() @@ -311,58 +390,105 @@ pub mod wasi { } } } + /// A directory entry. #[derive(Clone)] pub struct DirectoryEntry { + /// The type of the file referred to by this directory entry. pub type_: DescriptorType, + /// The name of the object. pub name: _rt::String, } impl ::core::fmt::Debug for DirectoryEntry { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("DirectoryEntry") .field("type", &self.type_) .field("name", &self.name) .finish() } } + /// Error codes returned by functions, similar to `errno` in POSIX. + /// Not all of these error codes are returned by the functions provided by this + /// API; some are used in higher-level library layers, and others are provided + /// merely for alignment with POSIX. #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum ErrorCode { + /// Permission denied, similar to `EACCES` in POSIX. Access, + /// Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX. WouldBlock, + /// Connection already in progress, similar to `EALREADY` in POSIX. Already, + /// Bad descriptor, similar to `EBADF` in POSIX. BadDescriptor, + /// Device or resource busy, similar to `EBUSY` in POSIX. Busy, + /// Resource deadlock would occur, similar to `EDEADLK` in POSIX. Deadlock, + /// Storage quota exceeded, similar to `EDQUOT` in POSIX. Quota, + /// File exists, similar to `EEXIST` in POSIX. Exist, + /// File too large, similar to `EFBIG` in POSIX. FileTooLarge, + /// Illegal byte sequence, similar to `EILSEQ` in POSIX. IllegalByteSequence, + /// Operation in progress, similar to `EINPROGRESS` in POSIX. InProgress, + /// Interrupted function, similar to `EINTR` in POSIX. Interrupted, + /// Invalid argument, similar to `EINVAL` in POSIX. Invalid, + /// I/O error, similar to `EIO` in POSIX. Io, + /// Is a directory, similar to `EISDIR` in POSIX. IsDirectory, + /// Too many levels of symbolic links, similar to `ELOOP` in POSIX. Loop, + /// Too many links, similar to `EMLINK` in POSIX. TooManyLinks, + /// Message too large, similar to `EMSGSIZE` in POSIX. MessageSize, + /// Filename too long, similar to `ENAMETOOLONG` in POSIX. NameTooLong, + /// No such device, similar to `ENODEV` in POSIX. NoDevice, + /// No such file or directory, similar to `ENOENT` in POSIX. NoEntry, + /// No locks available, similar to `ENOLCK` in POSIX. NoLock, + /// Not enough space, similar to `ENOMEM` in POSIX. InsufficientMemory, + /// No space left on device, similar to `ENOSPC` in POSIX. InsufficientSpace, + /// Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX. NotDirectory, + /// Directory not empty, similar to `ENOTEMPTY` in POSIX. NotEmpty, + /// State not recoverable, similar to `ENOTRECOVERABLE` in POSIX. NotRecoverable, + /// Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX. Unsupported, + /// Inappropriate I/O control operation, similar to `ENOTTY` in POSIX. NoTty, + /// No such device or address, similar to `ENXIO` in POSIX. NoSuchDevice, + /// Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX. Overflow, + /// Operation not permitted, similar to `EPERM` in POSIX. NotPermitted, + /// Broken pipe, similar to `EPIPE` in POSIX. Pipe, + /// Read-only file system, similar to `EROFS` in POSIX. ReadOnly, + /// Invalid seek, similar to `ESPIPE` in POSIX. InvalidSeek, + /// Text file busy, similar to `ETXTBSY` in POSIX. TextFileBusy, + /// Cross-device link, similar to `EXDEV` in POSIX. CrossDevice, } impl ErrorCode { @@ -409,48 +535,119 @@ pub mod wasi { } pub fn message(&self) -> &'static str { match self { - ErrorCode::Access => "", - ErrorCode::WouldBlock => "", - ErrorCode::Already => "", - ErrorCode::BadDescriptor => "", - ErrorCode::Busy => "", - ErrorCode::Deadlock => "", - ErrorCode::Quota => "", - ErrorCode::Exist => "", - ErrorCode::FileTooLarge => "", - ErrorCode::IllegalByteSequence => "", - ErrorCode::InProgress => "", - ErrorCode::Interrupted => "", - ErrorCode::Invalid => "", - ErrorCode::Io => "", - ErrorCode::IsDirectory => "", - ErrorCode::Loop => "", - ErrorCode::TooManyLinks => "", - ErrorCode::MessageSize => "", - ErrorCode::NameTooLong => "", - ErrorCode::NoDevice => "", - ErrorCode::NoEntry => "", - ErrorCode::NoLock => "", - ErrorCode::InsufficientMemory => "", - ErrorCode::InsufficientSpace => "", - ErrorCode::NotDirectory => "", - ErrorCode::NotEmpty => "", - ErrorCode::NotRecoverable => "", - ErrorCode::Unsupported => "", - ErrorCode::NoTty => "", - ErrorCode::NoSuchDevice => "", - ErrorCode::Overflow => "", - ErrorCode::NotPermitted => "", - ErrorCode::Pipe => "", - ErrorCode::ReadOnly => "", - ErrorCode::InvalidSeek => "", - ErrorCode::TextFileBusy => "", - ErrorCode::CrossDevice => "", + ErrorCode::Access => { + "Permission denied, similar to `EACCES` in POSIX." + } + ErrorCode::WouldBlock => { + "Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX." + } + ErrorCode::Already => { + "Connection already in progress, similar to `EALREADY` in POSIX." + } + ErrorCode::BadDescriptor => { + "Bad descriptor, similar to `EBADF` in POSIX." + } + ErrorCode::Busy => { + "Device or resource busy, similar to `EBUSY` in POSIX." + } + ErrorCode::Deadlock => { + "Resource deadlock would occur, similar to `EDEADLK` in POSIX." + } + ErrorCode::Quota => { + "Storage quota exceeded, similar to `EDQUOT` in POSIX." + } + ErrorCode::Exist => "File exists, similar to `EEXIST` in POSIX.", + ErrorCode::FileTooLarge => { + "File too large, similar to `EFBIG` in POSIX." + } + ErrorCode::IllegalByteSequence => { + "Illegal byte sequence, similar to `EILSEQ` in POSIX." + } + ErrorCode::InProgress => { + "Operation in progress, similar to `EINPROGRESS` in POSIX." + } + ErrorCode::Interrupted => { + "Interrupted function, similar to `EINTR` in POSIX." + } + ErrorCode::Invalid => { + "Invalid argument, similar to `EINVAL` in POSIX." + } + ErrorCode::Io => "I/O error, similar to `EIO` in POSIX.", + ErrorCode::IsDirectory => { + "Is a directory, similar to `EISDIR` in POSIX." + } + ErrorCode::Loop => { + "Too many levels of symbolic links, similar to `ELOOP` in POSIX." + } + ErrorCode::TooManyLinks => { + "Too many links, similar to `EMLINK` in POSIX." + } + ErrorCode::MessageSize => { + "Message too large, similar to `EMSGSIZE` in POSIX." + } + ErrorCode::NameTooLong => { + "Filename too long, similar to `ENAMETOOLONG` in POSIX." + } + ErrorCode::NoDevice => { + "No such device, similar to `ENODEV` in POSIX." + } + ErrorCode::NoEntry => { + "No such file or directory, similar to `ENOENT` in POSIX." + } + ErrorCode::NoLock => { + "No locks available, similar to `ENOLCK` in POSIX." + } + ErrorCode::InsufficientMemory => { + "Not enough space, similar to `ENOMEM` in POSIX." + } + ErrorCode::InsufficientSpace => { + "No space left on device, similar to `ENOSPC` in POSIX." + } + ErrorCode::NotDirectory => { + "Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX." + } + ErrorCode::NotEmpty => { + "Directory not empty, similar to `ENOTEMPTY` in POSIX." + } + ErrorCode::NotRecoverable => { + "State not recoverable, similar to `ENOTRECOVERABLE` in POSIX." + } + ErrorCode::Unsupported => { + "Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX." + } + ErrorCode::NoTty => { + "Inappropriate I/O control operation, similar to `ENOTTY` in POSIX." + } + ErrorCode::NoSuchDevice => { + "No such device or address, similar to `ENXIO` in POSIX." + } + ErrorCode::Overflow => { + "Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX." + } + ErrorCode::NotPermitted => { + "Operation not permitted, similar to `EPERM` in POSIX." + } + ErrorCode::Pipe => "Broken pipe, similar to `EPIPE` in POSIX.", + ErrorCode::ReadOnly => { + "Read-only file system, similar to `EROFS` in POSIX." + } + ErrorCode::InvalidSeek => { + "Invalid seek, similar to `ESPIPE` in POSIX." + } + ErrorCode::TextFileBusy => { + "Text file busy, similar to `ETXTBSY` in POSIX." + } + ErrorCode::CrossDevice => { + "Cross-device link, similar to `EXDEV` in POSIX." + } } } } impl ::core::fmt::Debug for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("ErrorCode") .field("code", &(*self as i32)) .field("name", &self.name()) @@ -459,20 +656,20 @@ pub mod wasi { } } impl ::core::fmt::Display for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - write!(f, "{} (error {})", self.name(), *self as i32) + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { + write!(f, "{} (error {})", self.name(), * self as i32) } } - impl std::error::Error for ErrorCode {} - impl ErrorCode { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> ErrorCode { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => ErrorCode::Access, 1 => ErrorCode::WouldBlock, @@ -511,27 +708,43 @@ pub mod wasi { 34 => ErrorCode::InvalidSeek, 35 => ErrorCode::TextFileBusy, 36 => ErrorCode::CrossDevice, - _ => panic!("invalid enum discriminant"), } } } - + /// File or memory access pattern advisory information. #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum Advice { + /// The application has no advice to give on its behavior with respect + /// to the specified data. Normal, + /// The application expects to access the specified data sequentially + /// from lower offsets to higher offsets. Sequential, + /// The application expects to access the specified data in a random + /// order. Random, + /// The application expects to access the specified data in the near + /// future. WillNeed, + /// The application expects that it will not access the specified data + /// in the near future. DontNeed, + /// The application expects to access the specified data once and then + /// not reuse it thereafter. NoReuse, } impl ::core::fmt::Debug for Advice { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Advice::Normal => f.debug_tuple("Advice::Normal").finish(), - Advice::Sequential => f.debug_tuple("Advice::Sequential").finish(), + Advice::Sequential => { + f.debug_tuple("Advice::Sequential").finish() + } Advice::Random => f.debug_tuple("Advice::Random").finish(), Advice::WillNeed => f.debug_tuple("Advice::WillNeed").finish(), Advice::DontNeed => f.debug_tuple("Advice::DontNeed").finish(), @@ -539,14 +752,12 @@ pub mod wasi { } } } - impl Advice { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> Advice { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => Advice::Normal, 1 => Advice::Sequential, @@ -554,33 +765,39 @@ pub mod wasi { 3 => Advice::WillNeed, 4 => Advice::DontNeed, 5 => Advice::NoReuse, - _ => panic!("invalid enum discriminant"), } } } - + /// A 128-bit hash value, split into parts because wasm doesn't have a + /// 128-bit integer type. #[repr(C)] #[derive(Clone, Copy)] pub struct MetadataHashValue { + /// 64 bits of a 128-bit hash value. pub lower: u64, + /// Another 64 bits of a 128-bit hash value. pub upper: u64, } impl ::core::fmt::Debug for MetadataHashValue { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("MetadataHashValue") .field("lower", &self.lower) .field("upper", &self.upper) .finish() } } - + /// A descriptor is a reference to a filesystem object, which may be a file, + /// directory, named pipe, special file, or other object on which filesystem + /// calls may be made. #[derive(Debug)] #[repr(transparent)] pub struct Descriptor { handle: _rt::Resource, } - impl Descriptor { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -588,24 +805,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for Descriptor { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -613,18 +826,16 @@ pub mod wasi { #[link_name = "[resource-drop]descriptor"] fn drop(_: u32); } - drop(_handle); } } } - + /// A stream of directory entries. #[derive(Debug)] #[repr(transparent)] pub struct DirectoryEntryStream { handle: _rt::Resource, } - impl DirectoryEntryStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -632,24 +843,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for DirectoryEntryStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -657,19 +864,30 @@ pub mod wasi { #[link_name = "[resource-drop]directory-entry-stream"] fn drop(_: u32); } - drop(_handle); } } } - impl Descriptor { #[allow(unused_unsafe, clippy::all)] - pub fn read_via_stream(&self, offset: Filesize) -> Result { + /// Return a stream for reading from a file, if available. + /// + /// May fail with an error-code describing why the file cannot be read. + /// + /// Multiple read, write, and append streams may be active on the same open + /// file and they do not interfere with each other. + /// + /// Note: This allows using `read-stream`, which is similar to `read` in POSIX. + pub fn read_via_stream( + &self, + offset: Filesize, + ) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -677,7 +895,6 @@ pub mod wasi { #[link_name = "[method]descriptor.read-via-stream"] fn wit_import(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() @@ -688,15 +905,15 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::io0_2_0::streams::InputStream::from_handle(l2 as u32) + super::super::super::wasi::io0_2_0::streams::InputStream::from_handle( + l2 as u32, + ) }; Ok(e) } 1 => { let e = { let l3 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l3 as u8) }; Err(e) @@ -708,6 +925,12 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Return a stream for writing to a file, if available. + /// + /// May fail with an error-code describing why the file cannot be written. + /// + /// Note: This allows using `write-stream`, which is similar to `write` in + /// POSIX. pub fn write_via_stream( &self, offset: Filesize, @@ -715,7 +938,9 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -723,7 +948,6 @@ pub mod wasi { #[link_name = "[method]descriptor.write-via-stream"] fn wit_import(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() @@ -734,15 +958,15 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::io0_2_0::streams::OutputStream::from_handle(l2 as u32) + super::super::super::wasi::io0_2_0::streams::OutputStream::from_handle( + l2 as u32, + ) }; Ok(e) } 1 => { let e = { let l3 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l3 as u8) }; Err(e) @@ -754,11 +978,19 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Return a stream for appending to a file, if available. + /// + /// May fail with an error-code describing why the file cannot be appended. + /// + /// Note: This allows using `write-stream`, which is similar to `write` with + /// `O_APPEND` in in POSIX. pub fn append_via_stream(&self) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -766,7 +998,6 @@ pub mod wasi { #[link_name = "[method]descriptor.append-via-stream"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -777,15 +1008,15 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::io0_2_0::streams::OutputStream::from_handle(l2 as u32) + super::super::super::wasi::io0_2_0::streams::OutputStream::from_handle( + l2 as u32, + ) }; Ok(e) } 1 => { let e = { let l3 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l3 as u8) }; Err(e) @@ -797,6 +1028,9 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Provide file advisory information on a descriptor. + /// + /// This is similar to `posix_fadvise` in POSIX. pub fn advise( &self, offset: Filesize, @@ -806,7 +1040,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -814,7 +1050,6 @@ pub mod wasi { #[link_name = "[method]descriptor.advise"] fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8) { unreachable!() @@ -835,7 +1070,6 @@ pub mod wasi { 1 => { let e = { let l2 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l2 as u8) }; Err(e) @@ -847,11 +1081,19 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Synchronize the data of a file to disk. + /// + /// This function succeeds with no effect if the file descriptor is not + /// opened for writing. + /// + /// Note: This is similar to `fdatasync` in POSIX. pub fn sync_data(&self) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -859,7 +1101,6 @@ pub mod wasi { #[link_name = "[method]descriptor.sync-data"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -874,7 +1115,6 @@ pub mod wasi { 1 => { let e = { let l2 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l2 as u8) }; Err(e) @@ -886,11 +1126,19 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Get flags associated with a descriptor. + /// + /// Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX. + /// + /// Note: This returns the value that was the `fs_flags` value returned + /// from `fdstat_get` in earlier versions of WASI. pub fn get_flags(&self) -> Result { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -898,7 +1146,6 @@ pub mod wasi { #[link_name = "[method]descriptor.get-flags"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -909,7 +1156,6 @@ pub mod wasi { 0 => { let e = { let l2 = i32::from(*ptr0.add(1).cast::()); - DescriptorFlags::empty() | DescriptorFlags::from_bits_retain(((l2 as u8) << 0) as _) }; @@ -918,7 +1164,6 @@ pub mod wasi { 1 => { let e = { let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) }; Err(e) @@ -930,11 +1175,23 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Get the dynamic type of a descriptor. + /// + /// Note: This returns the same value as the `type` field of the `fd-stat` + /// returned by `stat`, `stat-at` and similar. + /// + /// Note: This returns similar flags to the `st_mode & S_IFMT` value provided + /// by `fstat` in POSIX. + /// + /// Note: This returns the value that was the `fs_filetype` value returned + /// from `fdstat_get` in earlier versions of WASI. pub fn get_type(&self) -> Result { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -942,7 +1199,6 @@ pub mod wasi { #[link_name = "[method]descriptor.get-type"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -953,7 +1209,6 @@ pub mod wasi { 0 => { let e = { let l2 = i32::from(*ptr0.add(1).cast::()); - DescriptorType::_lift(l2 as u8) }; Ok(e) @@ -961,7 +1216,6 @@ pub mod wasi { 1 => { let e = { let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) }; Err(e) @@ -973,11 +1227,17 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Adjust the size of an open file. If this increases the file's size, the + /// extra bytes are filled with zeros. + /// + /// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. pub fn set_size(&self, size: Filesize) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -985,7 +1245,6 @@ pub mod wasi { #[link_name = "[method]descriptor.set-size"] fn wit_import(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() @@ -1000,7 +1259,6 @@ pub mod wasi { 1 => { let e = { let l2 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l2 as u8) }; Err(e) @@ -1012,6 +1270,11 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Adjust the timestamps of an open file or directory. + /// + /// Note: This is similar to `futimens` in POSIX. + /// + /// Note: This was called `fd_filestat_set_times` in earlier versions of WASI. pub fn set_times( &self, data_access_timestamp: NewTimestamp, @@ -1020,7 +1283,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let (result1_0, result1_1, result1_2) = match data_access_timestamp { NewTimestamp::NoChange => (0i32, 0i64, 0i32), NewTimestamp::Now => (1i32, 0i64, 0i32), @@ -1029,7 +1294,6 @@ pub mod wasi { seconds: seconds0, nanoseconds: nanoseconds0, } = e; - (2i32, _rt::as_i64(seconds0), _rt::as_i32(nanoseconds0)) } }; @@ -1041,7 +1305,6 @@ pub mod wasi { seconds: seconds2, nanoseconds: nanoseconds2, } = e; - (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2)) } }; @@ -1061,7 +1324,6 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import( _: i32, @@ -1094,7 +1356,6 @@ pub mod wasi { 1 => { let e = { let l6 = i32::from(*ptr4.add(1).cast::()); - ErrorCode::_lift(l6 as u8) }; Err(e) @@ -1106,6 +1367,17 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Read from a descriptor, without using and updating the descriptor's offset. + /// + /// This function returns a list of bytes containing the data that was + /// read, along with a bool which, when true, indicates that the end of the + /// file was reached. The returned list will contain up to `length` bytes; it + /// may return fewer than requested, if the end of the file is reached or + /// if the I/O operation is interrupted. + /// + /// In the future, this may change to return a `stream`. + /// + /// Note: This is similar to `pread` in POSIX. pub fn read( &self, length: Filesize, @@ -1114,7 +1386,9 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -1122,7 +1396,6 @@ pub mod wasi { #[link_name = "[method]descriptor.read"] fn wit_import(_: i32, _: i64, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: i64, _: *mut u8) { unreachable!() @@ -1141,7 +1414,6 @@ pub mod wasi { let l3 = *ptr0.add(8).cast::(); let len4 = l3; let l5 = i32::from(*ptr0.add(12).cast::()); - ( _rt::Vec::from_raw_parts(l2.cast(), len4, len4), _rt::bool_lift(l5 as u8), @@ -1152,7 +1424,6 @@ pub mod wasi { 1 => { let e = { let l6 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l6 as u8) }; Err(e) @@ -1164,6 +1435,15 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Write to a descriptor, without using and updating the descriptor's offset. + /// + /// It is valid to write past the end of a file; the file is extended to the + /// extent of the write, with bytes between the previous end and the start of + /// the write set to zero. + /// + /// In the future, this may change to take a `stream`. + /// + /// Note: This is similar to `pwrite` in POSIX. pub fn write( &self, buffer: &[u8], @@ -1172,7 +1452,9 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let vec0 = buffer; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -1181,9 +1463,14 @@ pub mod wasi { #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.write"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8); + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: i64, + _: *mut u8, + ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8) { unreachable!() @@ -1200,7 +1487,6 @@ pub mod wasi { 0 => { let e = { let l3 = *ptr1.add(8).cast::(); - l3 as u64 }; Ok(e) @@ -1208,7 +1494,6 @@ pub mod wasi { 1 => { let e = { let l4 = i32::from(*ptr1.add(8).cast::()); - ErrorCode::_lift(l4 as u8) }; Err(e) @@ -1220,11 +1505,22 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Read directory entries from a directory. + /// + /// On filesystems where directories contain entries referring to themselves + /// and their parents, often named `.` and `..` respectively, these entries + /// are omitted. + /// + /// This always returns a new stream which starts at the beginning of the + /// directory. Multiple streams may be active on the same directory, and they + /// do not interfere with each other. pub fn read_directory(&self) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -1232,7 +1528,6 @@ pub mod wasi { #[link_name = "[method]descriptor.read-directory"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -1243,7 +1538,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - DirectoryEntryStream::from_handle(l2 as u32) }; Ok(e) @@ -1251,7 +1545,6 @@ pub mod wasi { 1 => { let e = { let l3 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l3 as u8) }; Err(e) @@ -1263,11 +1556,19 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Synchronize the data and metadata of a file to disk. + /// + /// This function succeeds with no effect if the file descriptor is not + /// opened for writing. + /// + /// Note: This is similar to `fsync` in POSIX. pub fn sync(&self) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -1275,7 +1576,6 @@ pub mod wasi { #[link_name = "[method]descriptor.sync"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -1290,7 +1590,6 @@ pub mod wasi { 1 => { let e = { let l2 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l2 as u8) }; Err(e) @@ -1302,11 +1601,16 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Create a directory. + /// + /// Note: This is similar to `mkdirat` in POSIX. pub fn create_directory_at(&self, path: &str) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -1317,7 +1621,6 @@ pub mod wasi { #[link_name = "[method]descriptor.create-directory-at"] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -1332,7 +1635,6 @@ pub mod wasi { 1 => { let e = { let l3 = i32::from(*ptr1.add(1).cast::()); - ErrorCode::_lift(l3 as u8) }; Err(e) @@ -1344,11 +1646,22 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Return the attributes of an open file or directory. + /// + /// Note: This is similar to `fstat` in POSIX, except that it does not return + /// device and inode information. For testing whether two descriptors refer to + /// the same underlying filesystem object, use `is-same-object`. To obtain + /// additional data that can be used do determine whether a file has been + /// modified, use `metadata-hash`. + /// + /// Note: This was called `fd_filestat_get` in earlier versions of WASI. pub fn stat(&self) -> Result { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 104]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 104]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 104], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -1356,7 +1669,6 @@ pub mod wasi { #[link_name = "[method]descriptor.stat"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -1372,7 +1684,6 @@ pub mod wasi { let l5 = i32::from(*ptr0.add(32).cast::()); let l8 = i32::from(*ptr0.add(56).cast::()); let l11 = i32::from(*ptr0.add(80).cast::()); - DescriptorStat { type_: DescriptorType::_lift(l2 as u8), link_count: l3 as u64, @@ -1383,11 +1694,10 @@ pub mod wasi { let e = { let l6 = *ptr0.add(40).cast::(); let l7 = *ptr0.add(48).cast::(); - - super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ - seconds: l6 as u64, - nanoseconds: l7 as u32, - } + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: l6 as u64, + nanoseconds: l7 as u32, + } }; Some(e) } @@ -1399,11 +1709,10 @@ pub mod wasi { let e = { let l9 = *ptr0.add(64).cast::(); let l10 = *ptr0.add(72).cast::(); - - super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ - seconds: l9 as u64, - nanoseconds: l10 as u32, - } + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: l9 as u64, + nanoseconds: l10 as u32, + } }; Some(e) } @@ -1415,11 +1724,10 @@ pub mod wasi { let e = { let l12 = *ptr0.add(88).cast::(); let l13 = *ptr0.add(96).cast::(); - - super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ - seconds: l12 as u64, - nanoseconds: l13 as u32, - } + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: l12 as u64, + nanoseconds: l13 as u32, + } }; Some(e) } @@ -1432,7 +1740,6 @@ pub mod wasi { 1 => { let e = { let l14 = i32::from(*ptr0.add(8).cast::()); - ErrorCode::_lift(l14 as u8) }; Err(e) @@ -1444,6 +1751,13 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Return the attributes of a file or directory. + /// + /// Note: This is similar to `fstatat` in POSIX, except that it does not + /// return device and inode information. See the `stat` description for a + /// discussion of alternatives. + /// + /// Note: This was called `path_filestat_get` in earlier versions of WASI. pub fn stat_at( &self, path_flags: PathFlags, @@ -1452,7 +1766,9 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 104]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 104]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 104], + ); let flags0 = path_flags; let vec1 = path; let ptr1 = vec1.as_ptr().cast::(); @@ -1462,9 +1778,14 @@ pub mod wasi { #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.stat-at"] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -1486,7 +1807,6 @@ pub mod wasi { let l7 = i32::from(*ptr2.add(32).cast::()); let l10 = i32::from(*ptr2.add(56).cast::()); let l13 = i32::from(*ptr2.add(80).cast::()); - DescriptorStat { type_: DescriptorType::_lift(l4 as u8), link_count: l5 as u64, @@ -1497,11 +1817,10 @@ pub mod wasi { let e = { let l8 = *ptr2.add(40).cast::(); let l9 = *ptr2.add(48).cast::(); - - super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ - seconds: l8 as u64, - nanoseconds: l9 as u32, - } + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: l8 as u64, + nanoseconds: l9 as u32, + } }; Some(e) } @@ -1513,11 +1832,10 @@ pub mod wasi { let e = { let l11 = *ptr2.add(64).cast::(); let l12 = *ptr2.add(72).cast::(); - - super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ - seconds: l11 as u64, - nanoseconds: l12 as u32, - } + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: l11 as u64, + nanoseconds: l12 as u32, + } }; Some(e) } @@ -1529,11 +1847,10 @@ pub mod wasi { let e = { let l14 = *ptr2.add(88).cast::(); let l15 = *ptr2.add(96).cast::(); - - super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ - seconds: l14 as u64, - nanoseconds: l15 as u32, - } + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: l14 as u64, + nanoseconds: l15 as u32, + } }; Some(e) } @@ -1546,7 +1863,6 @@ pub mod wasi { 1 => { let e = { let l16 = i32::from(*ptr2.add(8).cast::()); - ErrorCode::_lift(l16 as u8) }; Err(e) @@ -1558,6 +1874,12 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Adjust the timestamps of a file or directory. + /// + /// Note: This is similar to `utimensat` in POSIX. + /// + /// Note: This was called `path_filestat_set_times` in earlier versions of + /// WASI. pub fn set_times_at( &self, path_flags: PathFlags, @@ -1568,7 +1890,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let flags0 = path_flags; let vec1 = path; let ptr1 = vec1.as_ptr().cast::(); @@ -1581,7 +1905,6 @@ pub mod wasi { seconds: seconds2, nanoseconds: nanoseconds2, } = e; - (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2)) } }; @@ -1593,7 +1916,6 @@ pub mod wasi { seconds: seconds4, nanoseconds: nanoseconds4, } = e; - (2i32, _rt::as_i64(seconds4), _rt::as_i32(nanoseconds4)) } }; @@ -1616,7 +1938,6 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import( _: i32, @@ -1655,7 +1976,6 @@ pub mod wasi { 1 => { let e = { let l8 = i32::from(*ptr6.add(1).cast::()); - ErrorCode::_lift(l8 as u8) }; Err(e) @@ -1667,6 +1987,9 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Create a hard link. + /// + /// Note: This is similar to `linkat` in POSIX. pub fn link_at( &self, old_path_flags: PathFlags, @@ -1677,7 +2000,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let flags0 = old_path_flags; let vec1 = old_path; let ptr1 = vec1.as_ptr().cast::(); @@ -1701,7 +2026,6 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import( _: i32, @@ -1734,7 +2058,6 @@ pub mod wasi { 1 => { let e = { let l5 = i32::from(*ptr3.add(1).cast::()); - ErrorCode::_lift(l5 as u8) }; Err(e) @@ -1746,6 +2069,24 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Open a file or directory. + /// + /// The returned descriptor is not guaranteed to be the lowest-numbered + /// descriptor not currently open/ it is randomized to prevent applications + /// from depending on making assumptions about indexes, since this is + /// error-prone in multi-threaded contexts. The returned descriptor is + /// guaranteed to be less than 2**31. + /// + /// If `flags` contains `descriptor-flags::mutate-directory`, and the base + /// descriptor doesn't have `descriptor-flags::mutate-directory` set, + /// `open-at` fails with `error-code::read-only`. + /// + /// If `flags` contains `write` or `mutate-directory`, or `open-flags` + /// contains `truncate` or `create`, and the base descriptor doesn't have + /// `descriptor-flags::mutate-directory` set, `open-at` fails with + /// `error-code::read-only`. + /// + /// Note: This is similar to `openat` in POSIX. pub fn open_at( &self, path_flags: PathFlags, @@ -1756,7 +2097,9 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let flags0 = path_flags; let vec1 = path; let ptr1 = vec1.as_ptr().cast::(); @@ -1778,7 +2121,6 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import( _: i32, @@ -1805,7 +2147,6 @@ pub mod wasi { 0 => { let e = { let l6 = *ptr4.add(4).cast::(); - Descriptor::from_handle(l6 as u32) }; Ok(e) @@ -1813,7 +2154,6 @@ pub mod wasi { 1 => { let e = { let l7 = i32::from(*ptr4.add(4).cast::()); - ErrorCode::_lift(l7 as u8) }; Err(e) @@ -1825,11 +2165,19 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Read the contents of a symbolic link. + /// + /// If the contents contain an absolute or rooted path in the underlying + /// filesystem, this function fails with `error-code::not-permitted`. + /// + /// Note: This is similar to `readlinkat` in POSIX. pub fn readlink_at(&self, path: &str) -> Result<_rt::String, ErrorCode> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let vec0 = path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -1840,7 +2188,6 @@ pub mod wasi { #[link_name = "[method]descriptor.readlink-at"] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -1853,8 +2200,11 @@ pub mod wasi { let l3 = *ptr1.add(4).cast::<*mut u8>(); let l4 = *ptr1.add(8).cast::(); let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); _rt::string_lift(bytes5) }; Ok(e) @@ -1862,7 +2212,6 @@ pub mod wasi { 1 => { let e = { let l6 = i32::from(*ptr1.add(4).cast::()); - ErrorCode::_lift(l6 as u8) }; Err(e) @@ -1874,11 +2223,18 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Remove a directory. + /// + /// Return `error-code::not-empty` if the directory is not empty. + /// + /// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. pub fn remove_directory_at(&self, path: &str) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -1889,7 +2245,6 @@ pub mod wasi { #[link_name = "[method]descriptor.remove-directory-at"] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -1904,7 +2259,6 @@ pub mod wasi { 1 => { let e = { let l3 = i32::from(*ptr1.add(1).cast::()); - ErrorCode::_lift(l3 as u8) }; Err(e) @@ -1916,6 +2270,9 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Rename a filesystem object. + /// + /// Note: This is similar to `renameat` in POSIX. pub fn rename_at( &self, old_path: &str, @@ -1925,7 +2282,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = old_path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -1947,7 +2306,6 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import( _: i32, @@ -1978,7 +2336,6 @@ pub mod wasi { 1 => { let e = { let l4 = i32::from(*ptr2.add(1).cast::()); - ErrorCode::_lift(l4 as u8) }; Err(e) @@ -1990,11 +2347,23 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] - pub fn symlink_at(&self, old_path: &str, new_path: &str) -> Result<(), ErrorCode> { + /// Create a symbolic link (also known as a "symlink"). + /// + /// If `old-path` starts with `/`, the function fails with + /// `error-code::not-permitted`. + /// + /// Note: This is similar to `symlinkat` in POSIX. + pub fn symlink_at( + &self, + old_path: &str, + new_path: &str, + ) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = old_path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -2015,7 +2384,6 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import( _: i32, @@ -2044,7 +2412,6 @@ pub mod wasi { 1 => { let e = { let l4 = i32::from(*ptr2.add(1).cast::()); - ErrorCode::_lift(l4 as u8) }; Err(e) @@ -2056,11 +2423,17 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Unlink a filesystem object that is not a directory. + /// + /// Return `error-code::is-directory` if the path refers to a directory. + /// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. pub fn unlink_file_at(&self, path: &str) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -2071,7 +2444,6 @@ pub mod wasi { #[link_name = "[method]descriptor.unlink-file-at"] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -2086,7 +2458,6 @@ pub mod wasi { 1 => { let e = { let l3 = i32::from(*ptr1.add(1).cast::()); - ErrorCode::_lift(l3 as u8) }; Err(e) @@ -2098,6 +2469,12 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Test whether two descriptors refer to the same filesystem object. + /// + /// In POSIX, this corresponds to testing whether the two descriptors have the + /// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers. + /// wasi-filesystem does not expose device and inode numbers, so this function + /// may be used instead. pub fn is_same_object(&self, other: &Descriptor) -> bool { unsafe { #[cfg(target_arch = "wasm32")] @@ -2106,23 +2483,46 @@ pub mod wasi { #[link_name = "[method]descriptor.is-same-object"] fn wit_import(_: i32, _: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, (other).handle() as i32); + let ret = wit_import( + (self).handle() as i32, + (other).handle() as i32, + ); _rt::bool_lift(ret as u8) } } } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Return a hash of the metadata associated with a filesystem object referred + /// to by a descriptor. + /// + /// This returns a hash of the last-modification timestamp and file size, and + /// may also include the inode number, device number, birth timestamp, and + /// other metadata fields that may change when the file is modified or + /// replaced. It may also include a secret value chosen by the + /// implementation and not otherwise exposed. + /// + /// Implementations are encourated to provide the following properties: + /// + /// - If the file is not modified or replaced, the computed hash value should + /// usually not change. + /// - If the object is modified or replaced, the computed hash value should + /// usually change. + /// - The inputs to the hash should not be easily computable from the + /// computed hash. + /// + /// However, none of these is required. pub fn metadata_hash(&self) -> Result { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 24]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 24]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 24], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -2130,7 +2530,6 @@ pub mod wasi { #[link_name = "[method]descriptor.metadata-hash"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -2142,7 +2541,6 @@ pub mod wasi { let e = { let l2 = *ptr0.add(8).cast::(); let l3 = *ptr0.add(16).cast::(); - MetadataHashValue { lower: l2 as u64, upper: l3 as u64, @@ -2153,7 +2551,6 @@ pub mod wasi { 1 => { let e = { let l4 = i32::from(*ptr0.add(8).cast::()); - ErrorCode::_lift(l4 as u8) }; Err(e) @@ -2165,6 +2562,10 @@ pub mod wasi { } impl Descriptor { #[allow(unused_unsafe, clippy::all)] + /// Return a hash of the metadata associated with a filesystem object referred + /// to by a directory descriptor and a relative path. + /// + /// This performs the same hash computation as `metadata-hash`. pub fn metadata_hash_at( &self, path_flags: PathFlags, @@ -2173,7 +2574,9 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 24]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 24]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 24], + ); let flags0 = path_flags; let vec1 = path; let ptr1 = vec1.as_ptr().cast::(); @@ -2183,9 +2586,14 @@ pub mod wasi { #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.metadata-hash-at"] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -2203,7 +2611,6 @@ pub mod wasi { let e = { let l4 = *ptr2.add(8).cast::(); let l5 = *ptr2.add(16).cast::(); - MetadataHashValue { lower: l4 as u64, upper: l5 as u64, @@ -2214,7 +2621,6 @@ pub mod wasi { 1 => { let e = { let l6 = i32::from(*ptr2.add(8).cast::()); - ErrorCode::_lift(l6 as u8) }; Err(e) @@ -2226,11 +2632,16 @@ pub mod wasi { } impl DirectoryEntryStream { #[allow(unused_unsafe, clippy::all)] - pub fn read_directory_entry(&self) -> Result, ErrorCode> { + /// Read a single directory entry from a `directory-entry-stream`. + pub fn read_directory_entry( + &self, + ) -> Result, ErrorCode> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 20]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 20]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 20], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -2238,7 +2649,6 @@ pub mod wasi { #[link_name = "[method]directory-entry-stream.read-directory-entry"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -2249,7 +2659,6 @@ pub mod wasi { 0 => { let e = { let l2 = i32::from(*ptr0.add(4).cast::()); - match l2 { 0 => None, 1 => { @@ -2258,9 +2667,11 @@ pub mod wasi { let l4 = *ptr0.add(12).cast::<*mut u8>(); let l5 = *ptr0.add(16).cast::(); let len6 = l5; - let bytes6 = - _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - + let bytes6 = _rt::Vec::from_raw_parts( + l4.cast(), + len6, + len6, + ); DirectoryEntry { type_: DescriptorType::_lift(l3 as u8), name: _rt::string_lift(bytes6), @@ -2276,7 +2687,6 @@ pub mod wasi { 1 => { let e = { let l7 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l7 as u8) }; Err(e) @@ -2287,6 +2697,16 @@ pub mod wasi { } } #[allow(unused_unsafe, clippy::all)] + /// Attempts to extract a filesystem-related `error-code` from the stream + /// `error` provided. + /// + /// Stream operations which return `stream-error::last-operation-failed` + /// have a payload with more information about the operation that failed. + /// This payload can be passed through to this function to see if there's + /// filesystem-related information about the error to return. + /// + /// Note that this function is fallible because not all stream-related + /// errors are filesystem-related errors. pub fn filesystem_error_code(err: &Error) -> Option { unsafe { #[repr(align(1))] @@ -2299,7 +2719,6 @@ pub mod wasi { #[link_name = "filesystem-error-code"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -2311,7 +2730,6 @@ pub mod wasi { 1 => { let e = { let l2 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l2 as u8) }; Some(e) @@ -2328,15 +2746,14 @@ pub mod wasi { pub mod types { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type Duration = super::super::super::wasi::clocks0_2_0::monotonic_clock::Duration; pub type InputStream = super::super::super::wasi::io0_2_0::streams::InputStream; pub type OutputStream = super::super::super::wasi::io0_2_0::streams::OutputStream; pub type IoError = super::super::super::wasi::io0_2_0::error::Error; pub type Pollable = super::super::super::wasi::io0_2_0::poll::Pollable; + /// This type corresponds to HTTP standard Methods. #[derive(Clone)] pub enum Method { Get, @@ -2351,7 +2768,10 @@ pub mod wasi { Other(_rt::String), } impl ::core::fmt::Debug for Method { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Method::Get => f.debug_tuple("Method::Get").finish(), Method::Head => f.debug_tuple("Method::Head").finish(), @@ -2362,10 +2782,13 @@ pub mod wasi { Method::Options => f.debug_tuple("Method::Options").finish(), Method::Trace => f.debug_tuple("Method::Trace").finish(), Method::Patch => f.debug_tuple("Method::Patch").finish(), - Method::Other(e) => f.debug_tuple("Method::Other").field(e).finish(), + Method::Other(e) => { + f.debug_tuple("Method::Other").field(e).finish() + } } } } + /// This type corresponds to HTTP standard Related Schemes. #[derive(Clone)] pub enum Scheme { Http, @@ -2373,53 +2796,72 @@ pub mod wasi { Other(_rt::String), } impl ::core::fmt::Debug for Scheme { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Scheme::Http => f.debug_tuple("Scheme::Http").finish(), Scheme::Https => f.debug_tuple("Scheme::Https").finish(), - Scheme::Other(e) => f.debug_tuple("Scheme::Other").field(e).finish(), + Scheme::Other(e) => { + f.debug_tuple("Scheme::Other").field(e).finish() + } } } } + /// Defines the case payload type for `DNS-error` above: #[derive(Clone)] pub struct DnsErrorPayload { pub rcode: Option<_rt::String>, pub info_code: Option, } impl ::core::fmt::Debug for DnsErrorPayload { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("DnsErrorPayload") .field("rcode", &self.rcode) .field("info-code", &self.info_code) .finish() } } + /// Defines the case payload type for `TLS-alert-received` above: #[derive(Clone)] pub struct TlsAlertReceivedPayload { pub alert_id: Option, pub alert_message: Option<_rt::String>, } impl ::core::fmt::Debug for TlsAlertReceivedPayload { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("TlsAlertReceivedPayload") .field("alert-id", &self.alert_id) .field("alert-message", &self.alert_message) .finish() } } + /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: #[derive(Clone)] pub struct FieldSizePayload { pub field_name: Option<_rt::String>, pub field_size: Option, } impl ::core::fmt::Debug for FieldSizePayload { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("FieldSizePayload") .field("field-name", &self.field_name) .field("field-size", &self.field_size) .finish() } } + /// These cases are inspired by the IANA HTTP Proxy Error Types: + /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types #[derive(Clone)] pub enum ErrorCode { DnsTimeout, @@ -2460,12 +2902,22 @@ pub mod wasi { HttpProtocolError, LoopDetected, ConfigurationError, + /// This is a catch-all error for anything that doesn't fit cleanly into a + /// more specific case. It also includes an optional string for an + /// unstructured description of the error. Users should not depend on the + /// string for diagnosing errors, as it's not required to be consistent + /// between implementations. InternalError(Option<_rt::String>), } impl ::core::fmt::Debug for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - ErrorCode::DnsTimeout => f.debug_tuple("ErrorCode::DnsTimeout").finish(), + ErrorCode::DnsTimeout => { + f.debug_tuple("ErrorCode::DnsTimeout").finish() + } ErrorCode::DnsError(e) => { f.debug_tuple("ErrorCode::DnsError").field(e).finish() } @@ -2505,80 +2957,94 @@ pub mod wasi { ErrorCode::TlsCertificateError => { f.debug_tuple("ErrorCode::TlsCertificateError").finish() } - ErrorCode::TlsAlertReceived(e) => f - .debug_tuple("ErrorCode::TlsAlertReceived") - .field(e) - .finish(), + ErrorCode::TlsAlertReceived(e) => { + f.debug_tuple("ErrorCode::TlsAlertReceived") + .field(e) + .finish() + } ErrorCode::HttpRequestDenied => { f.debug_tuple("ErrorCode::HttpRequestDenied").finish() } - ErrorCode::HttpRequestLengthRequired => f - .debug_tuple("ErrorCode::HttpRequestLengthRequired") - .finish(), - ErrorCode::HttpRequestBodySize(e) => f - .debug_tuple("ErrorCode::HttpRequestBodySize") - .field(e) - .finish(), - ErrorCode::HttpRequestMethodInvalid => f - .debug_tuple("ErrorCode::HttpRequestMethodInvalid") - .finish(), + ErrorCode::HttpRequestLengthRequired => { + f.debug_tuple("ErrorCode::HttpRequestLengthRequired") + .finish() + } + ErrorCode::HttpRequestBodySize(e) => { + f.debug_tuple("ErrorCode::HttpRequestBodySize") + .field(e) + .finish() + } + ErrorCode::HttpRequestMethodInvalid => { + f.debug_tuple("ErrorCode::HttpRequestMethodInvalid").finish() + } ErrorCode::HttpRequestUriInvalid => { f.debug_tuple("ErrorCode::HttpRequestUriInvalid").finish() } ErrorCode::HttpRequestUriTooLong => { f.debug_tuple("ErrorCode::HttpRequestUriTooLong").finish() } - ErrorCode::HttpRequestHeaderSectionSize(e) => f - .debug_tuple("ErrorCode::HttpRequestHeaderSectionSize") - .field(e) - .finish(), - ErrorCode::HttpRequestHeaderSize(e) => f - .debug_tuple("ErrorCode::HttpRequestHeaderSize") - .field(e) - .finish(), - ErrorCode::HttpRequestTrailerSectionSize(e) => f - .debug_tuple("ErrorCode::HttpRequestTrailerSectionSize") - .field(e) - .finish(), - ErrorCode::HttpRequestTrailerSize(e) => f - .debug_tuple("ErrorCode::HttpRequestTrailerSize") - .field(e) - .finish(), - ErrorCode::HttpResponseIncomplete => { - f.debug_tuple("ErrorCode::HttpResponseIncomplete").finish() + ErrorCode::HttpRequestHeaderSectionSize(e) => { + f.debug_tuple("ErrorCode::HttpRequestHeaderSectionSize") + .field(e) + .finish() } - ErrorCode::HttpResponseHeaderSectionSize(e) => f - .debug_tuple("ErrorCode::HttpResponseHeaderSectionSize") - .field(e) - .finish(), - ErrorCode::HttpResponseHeaderSize(e) => f - .debug_tuple("ErrorCode::HttpResponseHeaderSize") - .field(e) - .finish(), - ErrorCode::HttpResponseBodySize(e) => f - .debug_tuple("ErrorCode::HttpResponseBodySize") - .field(e) - .finish(), - ErrorCode::HttpResponseTrailerSectionSize(e) => f - .debug_tuple("ErrorCode::HttpResponseTrailerSectionSize") - .field(e) - .finish(), - ErrorCode::HttpResponseTrailerSize(e) => f - .debug_tuple("ErrorCode::HttpResponseTrailerSize") - .field(e) - .finish(), - ErrorCode::HttpResponseTransferCoding(e) => f - .debug_tuple("ErrorCode::HttpResponseTransferCoding") - .field(e) - .finish(), - ErrorCode::HttpResponseContentCoding(e) => f - .debug_tuple("ErrorCode::HttpResponseContentCoding") - .field(e) - .finish(), - ErrorCode::HttpResponseTimeout => { - f.debug_tuple("ErrorCode::HttpResponseTimeout").finish() + ErrorCode::HttpRequestHeaderSize(e) => { + f.debug_tuple("ErrorCode::HttpRequestHeaderSize") + .field(e) + .finish() } - ErrorCode::HttpUpgradeFailed => { + ErrorCode::HttpRequestTrailerSectionSize(e) => { + f.debug_tuple("ErrorCode::HttpRequestTrailerSectionSize") + .field(e) + .finish() + } + ErrorCode::HttpRequestTrailerSize(e) => { + f.debug_tuple("ErrorCode::HttpRequestTrailerSize") + .field(e) + .finish() + } + ErrorCode::HttpResponseIncomplete => { + f.debug_tuple("ErrorCode::HttpResponseIncomplete").finish() + } + ErrorCode::HttpResponseHeaderSectionSize(e) => { + f.debug_tuple("ErrorCode::HttpResponseHeaderSectionSize") + .field(e) + .finish() + } + ErrorCode::HttpResponseHeaderSize(e) => { + f.debug_tuple("ErrorCode::HttpResponseHeaderSize") + .field(e) + .finish() + } + ErrorCode::HttpResponseBodySize(e) => { + f.debug_tuple("ErrorCode::HttpResponseBodySize") + .field(e) + .finish() + } + ErrorCode::HttpResponseTrailerSectionSize(e) => { + f.debug_tuple("ErrorCode::HttpResponseTrailerSectionSize") + .field(e) + .finish() + } + ErrorCode::HttpResponseTrailerSize(e) => { + f.debug_tuple("ErrorCode::HttpResponseTrailerSize") + .field(e) + .finish() + } + ErrorCode::HttpResponseTransferCoding(e) => { + f.debug_tuple("ErrorCode::HttpResponseTransferCoding") + .field(e) + .finish() + } + ErrorCode::HttpResponseContentCoding(e) => { + f.debug_tuple("ErrorCode::HttpResponseContentCoding") + .field(e) + .finish() + } + ErrorCode::HttpResponseTimeout => { + f.debug_tuple("ErrorCode::HttpResponseTimeout").finish() + } + ErrorCode::HttpUpgradeFailed => { f.debug_tuple("ErrorCode::HttpUpgradeFailed").finish() } ErrorCode::HttpProtocolError => { @@ -2597,45 +3063,77 @@ pub mod wasi { } } impl ::core::fmt::Display for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for ErrorCode {} + /// This type enumerates the different kinds of errors that may occur when + /// setting or appending to a `fields` resource. #[derive(Clone, Copy)] pub enum HeaderError { + /// This error indicates that a `field-key` or `field-value` was + /// syntactically invalid when used with an operation that sets headers in a + /// `fields`. InvalidSyntax, + /// This error indicates that a forbidden `field-key` was used when trying + /// to set a header in a `fields`. Forbidden, + /// This error indicates that the operation on the `fields` was not + /// permitted because the fields are immutable. Immutable, } impl ::core::fmt::Debug for HeaderError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { HeaderError::InvalidSyntax => { f.debug_tuple("HeaderError::InvalidSyntax").finish() } - HeaderError::Forbidden => f.debug_tuple("HeaderError::Forbidden").finish(), - HeaderError::Immutable => f.debug_tuple("HeaderError::Immutable").finish(), + HeaderError::Forbidden => { + f.debug_tuple("HeaderError::Forbidden").finish() + } + HeaderError::Immutable => { + f.debug_tuple("HeaderError::Immutable").finish() + } } } } impl ::core::fmt::Display for HeaderError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for HeaderError {} + /// Field keys are always strings. pub type FieldKey = _rt::String; + /// Field values should always be ASCII strings. However, in + /// reality, HTTP implementations often have to interpret malformed values, + /// so they are provided as a list of bytes. pub type FieldValue = _rt::Vec; - + /// This following block defines the `fields` resource which corresponds to + /// HTTP standard Fields. Fields are a common representation used for both + /// Headers and Trailers. + /// + /// A `fields` may be mutable or immutable. A `fields` created using the + /// constructor, `from-list`, or `clone` will be mutable, but a `fields` + /// resource given by other means (including, but not limited to, + /// `incoming-request.headers`, `outgoing-request.headers`) might be be + /// immutable. In an immutable fields, the `set`, `append`, and `delete` + /// operations will fail with `header-error.immutable`. #[derive(Debug)] #[repr(transparent)] pub struct Fields { handle: _rt::Resource, } - impl Fields { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -2643,24 +3141,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for Fields { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -2668,21 +3162,20 @@ pub mod wasi { #[link_name = "[resource-drop]fields"] fn drop(_: u32); } - drop(_handle); } } } - + /// Headers is an alias for Fields. pub type Headers = Fields; + /// Trailers is an alias for Fields. pub type Trailers = Fields; - + /// Represents an incoming HTTP Request. #[derive(Debug)] #[repr(transparent)] pub struct IncomingRequest { handle: _rt::Resource, } - impl IncomingRequest { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -2690,24 +3183,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for IncomingRequest { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -2715,18 +3204,16 @@ pub mod wasi { #[link_name = "[resource-drop]incoming-request"] fn drop(_: u32); } - drop(_handle); } } } - + /// Represents an outgoing HTTP Request. #[derive(Debug)] #[repr(transparent)] pub struct OutgoingRequest { handle: _rt::Resource, } - impl OutgoingRequest { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -2734,24 +3221,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for OutgoingRequest { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -2759,18 +3242,21 @@ pub mod wasi { #[link_name = "[resource-drop]outgoing-request"] fn drop(_: u32); } - drop(_handle); } } } - + /// Parameters for making an HTTP Request. Each of these parameters is + /// currently an optional timeout applicable to the transport layer of the + /// HTTP protocol. + /// + /// These timeouts are separate from any the user may use to bound a + /// blocking call to `wasi:io/poll.poll`. #[derive(Debug)] #[repr(transparent)] pub struct RequestOptions { handle: _rt::Resource, } - impl RequestOptions { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -2778,24 +3264,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for RequestOptions { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -2803,18 +3285,20 @@ pub mod wasi { #[link_name = "[resource-drop]request-options"] fn drop(_: u32); } - drop(_handle); } } } - + /// Represents the ability to send an HTTP Response. + /// + /// This resource is used by the `wasi:http/incoming-handler` interface to + /// allow a Response to be sent corresponding to the Request provided as the + /// other argument to `incoming-handler.handle`. #[derive(Debug)] #[repr(transparent)] pub struct ResponseOutparam { handle: _rt::Resource, } - impl ResponseOutparam { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -2822,24 +3306,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for ResponseOutparam { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -2847,20 +3327,18 @@ pub mod wasi { #[link_name = "[resource-drop]response-outparam"] fn drop(_: u32); } - drop(_handle); } } } - + /// This type corresponds to the HTTP standard Status Code. pub type StatusCode = u16; - + /// Represents an incoming HTTP Response. #[derive(Debug)] #[repr(transparent)] pub struct IncomingResponse { handle: _rt::Resource, } - impl IncomingResponse { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -2868,24 +3346,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for IncomingResponse { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -2893,18 +3367,23 @@ pub mod wasi { #[link_name = "[resource-drop]incoming-response"] fn drop(_: u32); } - drop(_handle); } } } - + /// Represents an incoming HTTP Request or Response's Body. + /// + /// A body has both its contents - a stream of bytes - and a (possibly + /// empty) set of trailers, indicating that the full contents of the + /// body have been received. This resource represents the contents as + /// an `input-stream` and the delivery of trailers as a `future-trailers`, + /// and ensures that the user of this interface may only be consuming either + /// the body contents or waiting on trailers at any given time. #[derive(Debug)] #[repr(transparent)] pub struct IncomingBody { handle: _rt::Resource, } - impl IncomingBody { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -2912,24 +3391,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for IncomingBody { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -2937,18 +3412,20 @@ pub mod wasi { #[link_name = "[resource-drop]incoming-body"] fn drop(_: u32); } - drop(_handle); } } } - + /// Represents a future which may eventaully return trailers, or an error. + /// + /// In the case that the incoming HTTP Request or Response did not have any + /// trailers, this future will resolve to the empty set of trailers once the + /// complete Request or Response body has been received. #[derive(Debug)] #[repr(transparent)] pub struct FutureTrailers { handle: _rt::Resource, } - impl FutureTrailers { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -2956,24 +3433,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for FutureTrailers { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -2981,18 +3454,16 @@ pub mod wasi { #[link_name = "[resource-drop]future-trailers"] fn drop(_: u32); } - drop(_handle); } } } - + /// Represents an outgoing HTTP Response. #[derive(Debug)] #[repr(transparent)] pub struct OutgoingResponse { handle: _rt::Resource, } - impl OutgoingResponse { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3000,24 +3471,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for OutgoingResponse { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3025,18 +3492,31 @@ pub mod wasi { #[link_name = "[resource-drop]outgoing-response"] fn drop(_: u32); } - drop(_handle); } } } - + /// Represents an outgoing HTTP Request or Response's Body. + /// + /// A body has both its contents - a stream of bytes - and a (possibly + /// empty) set of trailers, inducating the full contents of the body + /// have been sent. This resource represents the contents as an + /// `output-stream` child resource, and the completion of the body (with + /// optional trailers) with a static function that consumes the + /// `outgoing-body` resource, and ensures that the user of this interface + /// may not write to the body contents after the body has been finished. + /// + /// If the user code drops this resource, as opposed to calling the static + /// method `finish`, the implementation should treat the body as incomplete, + /// and that an error has occured. The implementation should propogate this + /// error to the HTTP protocol by whatever means it has available, + /// including: corrupting the body on the wire, aborting the associated + /// Request, or sending a late status code for the Response. #[derive(Debug)] #[repr(transparent)] pub struct OutgoingBody { handle: _rt::Resource, } - impl OutgoingBody { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3044,24 +3524,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for OutgoingBody { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3069,18 +3545,20 @@ pub mod wasi { #[link_name = "[resource-drop]outgoing-body"] fn drop(_: u32); } - drop(_handle); } } } - + /// Represents a future which may eventaully return an incoming HTTP + /// Response, or an error. + /// + /// This resource is returned by the `wasi:http/outgoing-handler` interface to + /// provide the HTTP Response corresponding to the sent Request. #[derive(Debug)] #[repr(transparent)] pub struct FutureIncomingResponse { handle: _rt::Resource, } - impl FutureIncomingResponse { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3088,24 +3566,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for FutureIncomingResponse { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3113,14 +3587,15 @@ pub mod wasi { #[link_name = "[resource-drop]future-incoming-response"] fn drop(_: u32); } - drop(_handle); } } } - impl Fields { #[allow(unused_unsafe, clippy::all)] + /// Construct an empty HTTP Fields. + /// + /// The resulting `fields` is mutable. pub fn new() -> Self { unsafe { #[cfg(target_arch = "wasm32")] @@ -3129,7 +3604,6 @@ pub mod wasi { #[link_name = "[constructor]fields"] fn wit_import() -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import() -> i32 { unreachable!() @@ -3141,17 +3615,34 @@ pub mod wasi { } impl Fields { #[allow(unused_unsafe, clippy::all)] + /// Construct an HTTP Fields. + /// + /// The resulting `fields` is mutable. + /// + /// The list represents each key-value pair in the Fields. Keys + /// which have multiple values are represented by multiple entries in this + /// list with the same key. + /// + /// The tuple is a pair of the field key, represented as a string, and + /// Value, represented as a list of bytes. + /// + /// An error result will be returned if any `field-key` or `field-value` is + /// syntactically invalid, or if a field is forbidden. pub fn from_list( entries: &[(FieldKey, FieldValue)], ) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let vec3 = entries; let len3 = vec3.len(); - let layout3 = - _rt::alloc::Layout::from_size_align_unchecked(vec3.len() * 16, 4); + let layout3 = _rt::alloc::Layout::from_size_align_unchecked( + vec3.len() * 16, + 4, + ); let result3 = if layout3.size() != 0 { let ptr = _rt::alloc::alloc(layout3).cast::(); if ptr.is_null() { @@ -3159,9 +3650,7 @@ pub mod wasi { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec3.into_iter().enumerate() { let base = result3.add(i * 16); @@ -3186,7 +3675,6 @@ pub mod wasi { #[link_name = "[static]fields.from-list"] fn wit_import(_: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -3200,7 +3688,6 @@ pub mod wasi { 0 => { let e = { let l6 = *ptr4.add(4).cast::(); - Fields::from_handle(l6 as u32) }; Ok(e) @@ -3216,7 +3703,6 @@ pub mod wasi { HeaderError::Immutable } }; - v8 }; Err(e) @@ -3228,11 +3714,17 @@ pub mod wasi { } impl Fields { #[allow(unused_unsafe, clippy::all)] + /// Get all of the values corresponding to a key. If the key is not present + /// in this `fields` or is syntactically invalid, an empty list is returned. + /// However, if the key is present but empty, this is represented by a list + /// with one or more empty field-values present. pub fn get(&self, name: &FieldKey) -> _rt::Vec { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -3243,7 +3735,6 @@ pub mod wasi { #[link_name = "[method]fields.get"] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -3260,7 +3751,6 @@ pub mod wasi { let l4 = *base.add(0).cast::<*mut u8>(); let l5 = *base.add(4).cast::(); let len6 = l5; - _rt::Vec::from_raw_parts(l4.cast(), len6, len6) }; result7.push(e7); @@ -3272,30 +3762,41 @@ pub mod wasi { } impl Fields { #[allow(unused_unsafe, clippy::all)] + /// Returns `true` when the key is present in this `fields`. If the key is + /// syntactically invalid, `false` is returned. pub fn has(&self, name: &FieldKey) -> bool { unsafe { let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]fields.has"] fn wit_import(_: i32, _: *mut u8, _: usize) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, ptr0.cast_mut(), len0); + let ret = wit_import( + (self).handle() as i32, + ptr0.cast_mut(), + len0, + ); _rt::bool_lift(ret as u8) } } } impl Fields { #[allow(unused_unsafe, clippy::all)] + /// Set all of the values for a key. Clears any existing values for that + /// key, if they have been set. + /// + /// Fails with `header-error.immutable` if the `fields` are immutable. + /// + /// Fails with `header-error.invalid-syntax` if the `field-key` or any of + /// the `field-value`s are syntactically invalid. pub fn set( &self, name: &FieldKey, @@ -3304,14 +3805,18 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let vec2 = value; let len2 = vec2.len(); - let layout2 = - _rt::alloc::Layout::from_size_align_unchecked(vec2.len() * 8, 4); + let layout2 = _rt::alloc::Layout::from_size_align_unchecked( + vec2.len() * 8, + 4, + ); let result2 = if layout2.size() != 0 { let ptr = _rt::alloc::alloc(layout2).cast::(); if ptr.is_null() { @@ -3319,9 +3824,7 @@ pub mod wasi { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec2.into_iter().enumerate() { let base = result2.add(i * 8); @@ -3347,7 +3850,6 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import( _: i32, @@ -3387,7 +3889,6 @@ pub mod wasi { HeaderError::Immutable } }; - v6 }; Err(e) @@ -3399,11 +3900,20 @@ pub mod wasi { } impl Fields { #[allow(unused_unsafe, clippy::all)] + /// Delete all values for a key. Does nothing if no values for the key + /// exist. + /// + /// Fails with `header-error.immutable` if the `fields` are immutable. + /// + /// Fails with `header-error.invalid-syntax` if the `field-key` is + /// syntactically invalid. pub fn delete(&self, name: &FieldKey) -> Result<(), HeaderError> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -3414,7 +3924,6 @@ pub mod wasi { #[link_name = "[method]fields.delete"] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -3437,7 +3946,6 @@ pub mod wasi { HeaderError::Immutable } }; - v4 }; Err(e) @@ -3449,6 +3957,13 @@ pub mod wasi { } impl Fields { #[allow(unused_unsafe, clippy::all)] + /// Append a value for a key. Does not change or delete any existing + /// values for that key. + /// + /// Fails with `header-error.immutable` if the `fields` are immutable. + /// + /// Fails with `header-error.invalid-syntax` if the `field-key` or + /// `field-value` are syntactically invalid. pub fn append( &self, name: &FieldKey, @@ -3457,7 +3972,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -3478,7 +3995,6 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import( _: i32, @@ -3515,7 +4031,6 @@ pub mod wasi { HeaderError::Immutable } }; - v5 }; Err(e) @@ -3527,11 +4042,19 @@ pub mod wasi { } impl Fields { #[allow(unused_unsafe, clippy::all)] + /// Retrieve the full set of keys and values in the Fields. Like the + /// constructor, the list represents each key-value pair. + /// + /// The outer list represents each key-value pair in the Fields. Keys + /// which have multiple values are represented by multiple entries in this + /// list with the same key. pub fn entries(&self) -> _rt::Vec<(FieldKey, FieldValue)> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3539,7 +4062,6 @@ pub mod wasi { #[link_name = "[method]fields.entries"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -3556,11 +4078,14 @@ pub mod wasi { let l3 = *base.add(0).cast::<*mut u8>(); let l4 = *base.add(4).cast::(); let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); let l6 = *base.add(8).cast::<*mut u8>(); let l7 = *base.add(12).cast::(); let len8 = l7; - ( _rt::string_lift(bytes5), _rt::Vec::from_raw_parts(l6.cast(), len8, len8), @@ -3575,6 +4100,9 @@ pub mod wasi { } impl Fields { #[allow(unused_unsafe, clippy::all)] + /// Make a deep copy of the Fields. Equivelant in behavior to calling the + /// `fields` constructor on the return value of `entries`. The resulting + /// `fields` is mutable. pub fn clone(&self) -> Fields { unsafe { #[cfg(target_arch = "wasm32")] @@ -3583,7 +4111,6 @@ pub mod wasi { #[link_name = "[method]fields.clone"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -3595,11 +4122,14 @@ pub mod wasi { } impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] + /// Returns the method of the incoming request. pub fn method(&self) -> Method { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3607,7 +4137,6 @@ pub mod wasi { #[link_name = "[method]incoming-request.method"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -3630,8 +4159,11 @@ pub mod wasi { let l2 = *ptr0.add(4).cast::<*mut u8>(); let l3 = *ptr0.add(8).cast::(); let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - + let bytes4 = _rt::Vec::from_raw_parts( + l2.cast(), + len4, + len4, + ); _rt::string_lift(bytes4) }; Method::Other(e5) @@ -3643,11 +4175,14 @@ pub mod wasi { } impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] + /// Returns the path with query parameters from the request, as a string. pub fn path_with_query(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3655,7 +4190,6 @@ pub mod wasi { #[link_name = "[method]incoming-request.path-with-query"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -3669,8 +4203,11 @@ pub mod wasi { let l2 = *ptr0.add(4).cast::<*mut u8>(); let l3 = *ptr0.add(8).cast::(); let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - + let bytes4 = _rt::Vec::from_raw_parts( + l2.cast(), + len4, + len4, + ); _rt::string_lift(bytes4) }; Some(e) @@ -3682,11 +4219,14 @@ pub mod wasi { } impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] + /// Returns the protocol scheme from the request. pub fn scheme(&self) -> Option { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3694,7 +4234,6 @@ pub mod wasi { #[link_name = "[method]incoming-request.scheme"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -3715,15 +4254,16 @@ pub mod wasi { let l3 = *ptr0.add(8).cast::<*mut u8>(); let l4 = *ptr0.add(12).cast::(); let len5 = l4; - let bytes5 = - _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); _rt::string_lift(bytes5) }; Scheme::Other(e6) } }; - v6 }; Some(e) @@ -3735,11 +4275,14 @@ pub mod wasi { } impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] + /// Returns the authority from the request, if it was present. pub fn authority(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3747,7 +4290,6 @@ pub mod wasi { #[link_name = "[method]incoming-request.authority"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -3761,8 +4303,11 @@ pub mod wasi { let l2 = *ptr0.add(4).cast::<*mut u8>(); let l3 = *ptr0.add(8).cast::(); let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - + let bytes4 = _rt::Vec::from_raw_parts( + l2.cast(), + len4, + len4, + ); _rt::string_lift(bytes4) }; Some(e) @@ -3774,6 +4319,14 @@ pub mod wasi { } impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] + /// Get the `headers` associated with the request. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// The `headers` returned are a child resource: it must be dropped before + /// the parent `incoming-request` is dropped. Dropping this + /// `incoming-request` before all children are dropped will trap. pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] @@ -3782,7 +4335,6 @@ pub mod wasi { #[link_name = "[method]incoming-request.headers"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -3794,11 +4346,15 @@ pub mod wasi { } impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] + /// Gives the `incoming-body` associated with this request. Will only + /// return success at most once, and subsequent calls will return error. pub fn consume(&self) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3806,7 +4362,6 @@ pub mod wasi { #[link_name = "[method]incoming-request.consume"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -3817,7 +4372,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - IncomingBody::from_handle(l2 as u32) }; Ok(e) @@ -3833,6 +4387,16 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Construct a new `outgoing-request` with a default `method` of `GET`, and + /// `none` values for `path-with-query`, `scheme`, and `authority`. + /// + /// * `headers` is the HTTP Headers for the Request. + /// + /// It is possible to construct, or manipulate with the accessor functions + /// below, an `outgoing-request` with an invalid combination of `scheme` + /// and `authority`, or `headers` which are not permitted to be sent. + /// It is the obligation of the `outgoing-handler.handle` implementation + /// to reject invalid constructions of `outgoing-request`. pub fn new(headers: Headers) -> Self { unsafe { #[cfg(target_arch = "wasm32")] @@ -3841,7 +4405,6 @@ pub mod wasi { #[link_name = "[constructor]outgoing-request"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -3853,11 +4416,19 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Returns the resource corresponding to the outgoing Body for this + /// Request. + /// + /// Returns success on the first call: the `outgoing-body` resource for + /// this `outgoing-request` can be retrieved at most once. Subsequent + /// calls will return error. pub fn body(&self) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3865,7 +4436,6 @@ pub mod wasi { #[link_name = "[method]outgoing-request.body"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -3876,7 +4446,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - OutgoingBody::from_handle(l2 as u32) }; Ok(e) @@ -3892,11 +4461,14 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Get the Method for the Request. pub fn method(&self) -> Method { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -3904,7 +4476,6 @@ pub mod wasi { #[link_name = "[method]outgoing-request.method"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -3927,8 +4498,11 @@ pub mod wasi { let l2 = *ptr0.add(4).cast::<*mut u8>(); let l3 = *ptr0.add(8).cast::(); let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - + let bytes4 = _rt::Vec::from_raw_parts( + l2.cast(), + len4, + len4, + ); _rt::string_lift(bytes4) }; Method::Other(e5) @@ -3940,6 +4514,8 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Set the Method for the Request. Fails if the string present in a + /// `method.other` argument is not a syntactically valid method. pub fn set_method(&self, method: &Method) -> Result<(), ()> { unsafe { let (result1_0, result1_1, result1_2) = match method { @@ -3956,24 +4532,25 @@ pub mod wasi { let vec0 = e; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - (9i32, ptr0.cast_mut(), len0) } }; - #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]outgoing-request.set-method"] fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } - let ret = - wit_import((self).handle() as i32, result1_0, result1_1, result1_2); + let ret = wit_import( + (self).handle() as i32, + result1_0, + result1_1, + result1_2, + ); match ret { 0 => { let e = (); @@ -3990,11 +4567,15 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Get the combination of the HTTP Path and Query for the Request. + /// When `none`, this represents an empty Path and empty Query. pub fn path_with_query(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -4002,7 +4583,6 @@ pub mod wasi { #[link_name = "[method]outgoing-request.path-with-query"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -4016,8 +4596,11 @@ pub mod wasi { let l2 = *ptr0.add(4).cast::<*mut u8>(); let l3 = *ptr0.add(8).cast::(); let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - + let bytes4 = _rt::Vec::from_raw_parts( + l2.cast(), + len4, + len4, + ); _rt::string_lift(bytes4) }; Some(e) @@ -4029,14 +4612,19 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] - pub fn set_path_with_query(&self, path_with_query: Option<&str>) -> Result<(), ()> { + /// Set the combination of the HTTP Path and Query for the Request. + /// When `none`, this represents an empty Path and empty Query. Fails is the + /// string given is not a syntactically valid path and query uri component. + pub fn set_path_with_query( + &self, + path_with_query: Option<&str>, + ) -> Result<(), ()> { unsafe { let (result1_0, result1_1, result1_2) = match path_with_query { Some(e) => { let vec0 = e; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - (1i32, ptr0.cast_mut(), len0) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -4047,13 +4635,16 @@ pub mod wasi { #[link_name = "[method]outgoing-request.set-path-with-query"] fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } - let ret = - wit_import((self).handle() as i32, result1_0, result1_1, result1_2); + let ret = wit_import( + (self).handle() as i32, + result1_0, + result1_1, + result1_2, + ); match ret { 0 => { let e = (); @@ -4070,11 +4661,15 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Get the HTTP Related Scheme for the Request. When `none`, the + /// implementation may choose an appropriate default scheme. pub fn scheme(&self) -> Option { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -4082,7 +4677,6 @@ pub mod wasi { #[link_name = "[method]outgoing-request.scheme"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -4103,15 +4697,16 @@ pub mod wasi { let l3 = *ptr0.add(8).cast::<*mut u8>(); let l4 = *ptr0.add(12).cast::(); let len5 = l4; - let bytes5 = - _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); _rt::string_lift(bytes5) }; Scheme::Other(e6) } }; - v6 }; Some(e) @@ -4123,6 +4718,9 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Set the HTTP Related Scheme for the Request. When `none`, the + /// implementation may choose an appropriate default scheme. Fails if the + /// string given is not a syntactically valid uri scheme. pub fn set_scheme(&self, scheme: Option<&Scheme>) -> Result<(), ()> { unsafe { let (result2_0, result2_1, result2_2, result2_3) = match scheme { @@ -4134,11 +4732,9 @@ pub mod wasi { let vec0 = e; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - (2i32, ptr0.cast_mut(), len0) } }; - (1i32, result1_0, result1_1, result1_2) } None => (0i32, 0i32, ::core::ptr::null_mut(), 0usize), @@ -4147,11 +4743,22 @@ pub mod wasi { #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]outgoing-request.set-scheme"] - fn wit_import(_: i32, _: i32, _: i32, _: *mut u8, _: usize) -> i32; + fn wit_import( + _: i32, + _: i32, + _: i32, + _: *mut u8, + _: usize, + ) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: *mut u8, _: usize) -> i32 { + fn wit_import( + _: i32, + _: i32, + _: i32, + _: *mut u8, + _: usize, + ) -> i32 { unreachable!() } let ret = wit_import( @@ -4177,11 +4784,16 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Get the HTTP Authority for the Request. A value of `none` may be used + /// with Related Schemes which do not require an Authority. The HTTP and + /// HTTPS schemes always require an authority. pub fn authority(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -4189,7 +4801,6 @@ pub mod wasi { #[link_name = "[method]outgoing-request.authority"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -4203,8 +4814,11 @@ pub mod wasi { let l2 = *ptr0.add(4).cast::<*mut u8>(); let l3 = *ptr0.add(8).cast::(); let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - + let bytes4 = _rt::Vec::from_raw_parts( + l2.cast(), + len4, + len4, + ); _rt::string_lift(bytes4) }; Some(e) @@ -4216,6 +4830,10 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Set the HTTP Authority for the Request. A value of `none` may be used + /// with Related Schemes which do not require an Authority. The HTTP and + /// HTTPS schemes always require an authority. Fails if the string given is + /// not a syntactically valid uri authority. pub fn set_authority(&self, authority: Option<&str>) -> Result<(), ()> { unsafe { let (result1_0, result1_1, result1_2) = match authority { @@ -4223,7 +4841,6 @@ pub mod wasi { let vec0 = e; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - (1i32, ptr0.cast_mut(), len0) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -4234,13 +4851,16 @@ pub mod wasi { #[link_name = "[method]outgoing-request.set-authority"] fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } - let ret = - wit_import((self).handle() as i32, result1_0, result1_1, result1_2); + let ret = wit_import( + (self).handle() as i32, + result1_0, + result1_1, + result1_2, + ); match ret { 0 => { let e = (); @@ -4257,6 +4877,14 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] + /// Get the headers associated with the Request. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// This headers resource is a child: it must be dropped before the parent + /// `outgoing-request` is dropped, or its ownership is transfered to + /// another component by e.g. `outgoing-handler.handle`. pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] @@ -4265,7 +4893,6 @@ pub mod wasi { #[link_name = "[method]outgoing-request.headers"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -4277,6 +4904,7 @@ pub mod wasi { } impl RequestOptions { #[allow(unused_unsafe, clippy::all)] + /// Construct a default `request-options` value. pub fn new() -> Self { unsafe { #[cfg(target_arch = "wasm32")] @@ -4285,7 +4913,6 @@ pub mod wasi { #[link_name = "[constructor]request-options"] fn wit_import() -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import() -> i32 { unreachable!() @@ -4297,11 +4924,14 @@ pub mod wasi { } impl RequestOptions { #[allow(unused_unsafe, clippy::all)] + /// The timeout for the initial connect to the HTTP Server. pub fn connect_timeout(&self) -> Option { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -4309,7 +4939,6 @@ pub mod wasi { #[link_name = "[method]request-options.connect-timeout"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -4321,7 +4950,6 @@ pub mod wasi { 1 => { let e = { let l2 = *ptr0.add(8).cast::(); - l2 as u64 }; Some(e) @@ -4333,7 +4961,12 @@ pub mod wasi { } impl RequestOptions { #[allow(unused_unsafe, clippy::all)] - pub fn set_connect_timeout(&self, duration: Option) -> Result<(), ()> { + /// Set the timeout for the initial connect to the HTTP Server. An error + /// return value indicates that this timeout is not supported. + pub fn set_connect_timeout( + &self, + duration: Option, + ) -> Result<(), ()> { unsafe { let (result0_0, result0_1) = match duration { Some(e) => (1i32, _rt::as_i64(e)), @@ -4345,12 +4978,15 @@ pub mod wasi { #[link_name = "[method]request-options.set-connect-timeout"] fn wit_import(_: i32, _: i32, _: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: i64) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, result0_0, result0_1); + let ret = wit_import( + (self).handle() as i32, + result0_0, + result0_1, + ); match ret { 0 => { let e = (); @@ -4367,11 +5003,14 @@ pub mod wasi { } impl RequestOptions { #[allow(unused_unsafe, clippy::all)] + /// The timeout for receiving the first byte of the Response body. pub fn first_byte_timeout(&self) -> Option { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -4379,7 +5018,6 @@ pub mod wasi { #[link_name = "[method]request-options.first-byte-timeout"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -4391,7 +5029,6 @@ pub mod wasi { 1 => { let e = { let l2 = *ptr0.add(8).cast::(); - l2 as u64 }; Some(e) @@ -4403,7 +5040,12 @@ pub mod wasi { } impl RequestOptions { #[allow(unused_unsafe, clippy::all)] - pub fn set_first_byte_timeout(&self, duration: Option) -> Result<(), ()> { + /// Set the timeout for receiving the first byte of the Response body. An + /// error return value indicates that this timeout is not supported. + pub fn set_first_byte_timeout( + &self, + duration: Option, + ) -> Result<(), ()> { unsafe { let (result0_0, result0_1) = match duration { Some(e) => (1i32, _rt::as_i64(e)), @@ -4415,12 +5057,15 @@ pub mod wasi { #[link_name = "[method]request-options.set-first-byte-timeout"] fn wit_import(_: i32, _: i32, _: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: i64) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, result0_0, result0_1); + let ret = wit_import( + (self).handle() as i32, + result0_0, + result0_1, + ); match ret { 0 => { let e = (); @@ -4437,11 +5082,15 @@ pub mod wasi { } impl RequestOptions { #[allow(unused_unsafe, clippy::all)] + /// The timeout for receiving subsequent chunks of bytes in the Response + /// body stream. pub fn between_bytes_timeout(&self) -> Option { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -4449,7 +5098,6 @@ pub mod wasi { #[link_name = "[method]request-options.between-bytes-timeout"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -4461,7 +5109,6 @@ pub mod wasi { 1 => { let e = { let l2 = *ptr0.add(8).cast::(); - l2 as u64 }; Some(e) @@ -4473,6 +5120,9 @@ pub mod wasi { } impl RequestOptions { #[allow(unused_unsafe, clippy::all)] + /// Set the timeout for receiving subsequent chunks of bytes in the Response + /// body stream. An error return value indicates that this timeout is not + /// supported. pub fn set_between_bytes_timeout( &self, duration: Option, @@ -4488,12 +5138,15 @@ pub mod wasi { #[link_name = "[method]request-options.set-between-bytes-timeout"] fn wit_import(_: i32, _: i32, _: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: i64) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, result0_0, result0_1); + let ret = wit_import( + (self).handle() as i32, + result0_0, + result0_1, + ); match ret { 0 => { let e = (); @@ -4510,7 +5163,19 @@ pub mod wasi { } impl ResponseOutparam { #[allow(unused_unsafe, clippy::all)] - pub fn set(param: ResponseOutparam, response: Result) { + /// Set the value of the `response-outparam` to either send a response, + /// or indicate an error. + /// + /// This method consumes the `response-outparam` to ensure that it is + /// called at most once. If it is never called, the implementation + /// will respond with an error. + /// + /// The user may provide an `error` to `response` to allow the + /// implementation determine how to respond with an HTTP error response. + pub fn set( + param: ResponseOutparam, + response: Result, + ) { unsafe { let ( result38_0, @@ -4522,16 +5187,18 @@ pub mod wasi { result38_6, result38_7, ) = match &response { - Ok(e) => ( - 0i32, - (e).take_handle() as i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + Ok(e) => { + ( + 0i32, + (e).take_handle() as i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } Err(e) => { let ( result37_0, @@ -4542,15 +5209,17 @@ pub mod wasi { result37_5, result37_6, ) = match e { - ErrorCode::DnsTimeout => ( - 0i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::DnsTimeout => { + ( + 0i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::DnsError(e) => { let DnsErrorPayload { rcode: rcode0, @@ -4561,7 +5230,6 @@ pub mod wasi { let vec1 = e; let ptr1 = vec1.as_ptr().cast::(); let len1 = vec1.len(); - (1i32, ptr1.cast_mut(), len1) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -4574,8 +5242,7 @@ pub mod wasi { 1i32, result2_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result2_1); t }, @@ -4585,114 +5252,138 @@ pub mod wasi { 0i32, ) } - ErrorCode::DestinationNotFound => ( - 2i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::DestinationUnavailable => ( - 3i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::DestinationIpProhibited => ( - 4i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::DestinationIpUnroutable => ( - 5i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionRefused => ( - 6i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionTerminated => ( - 7i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionTimeout => ( - 8i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionReadTimeout => ( - 9i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionWriteTimeout => ( - 10i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionLimitReached => ( - 11i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::TlsProtocolError => ( - 12i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::TlsCertificateError => ( - 13i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::DestinationNotFound => { + ( + 2i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::DestinationUnavailable => { + ( + 3i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::DestinationIpProhibited => { + ( + 4i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::DestinationIpUnroutable => { + ( + 5i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionRefused => { + ( + 6i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionTerminated => { + ( + 7i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionTimeout => { + ( + 8i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionReadTimeout => { + ( + 9i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionWriteTimeout => { + ( + 10i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionLimitReached => { + ( + 11i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::TlsProtocolError => { + ( + 12i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::TlsCertificateError => { + ( + 13i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::TlsAlertReceived(e) => { let TlsAlertReceivedPayload { alert_id: alert_id4, @@ -4702,13 +5393,11 @@ pub mod wasi { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; - let (result7_0, result7_1, result7_2) = match alert_message4 - { + let (result7_0, result7_1, result7_2) = match alert_message4 { Some(e) => { let vec6 = e; let ptr6 = vec6.as_ptr().cast::(); let len6 = vec6.len(); - (1i32, ptr6.cast_mut(), len6) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -4716,33 +5405,35 @@ pub mod wasi { ( 14i32, result5_0, - ::core::mem::MaybeUninit::new( - i64::from(result5_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result5_1) as u64), result7_0 as *mut u8, result7_1, result7_2, 0i32, ) } - ErrorCode::HttpRequestDenied => ( - 15i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpRequestLengthRequired => ( - 16i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::HttpRequestDenied => { + ( + 15i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpRequestLengthRequired => { + ( + 16i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::HttpRequestBodySize(e) => { let (result8_0, result8_1) = match e { Some(e) => (1i32, _rt::as_i64(e)), @@ -4758,33 +5449,39 @@ pub mod wasi { 0i32, ) } - ErrorCode::HttpRequestMethodInvalid => ( - 18i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpRequestUriInvalid => ( - 19i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpRequestUriTooLong => ( - 20i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::HttpRequestMethodInvalid => { + ( + 18i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpRequestUriInvalid => { + ( + 19i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpRequestUriTooLong => { + ( + 20i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::HttpRequestHeaderSectionSize(e) => { let (result9_0, result9_1) = match e { Some(e) => (1i32, _rt::as_i32(e)), @@ -4793,9 +5490,7 @@ pub mod wasi { ( 21i32, result9_0, - ::core::mem::MaybeUninit::new( - i64::from(result9_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result9_1) as u64), ::core::ptr::null_mut(), ::core::ptr::null_mut(), 0usize, @@ -4816,43 +5511,36 @@ pub mod wasi { field_name: field_name10, field_size: field_size10, } = e; - let (result12_0, result12_1, result12_2) = - match field_name10 { - Some(e) => { - let vec11 = e; - let ptr11 = vec11.as_ptr().cast::(); - let len11 = vec11.len(); - - (1i32, ptr11.cast_mut(), len11) - } - None => { - (0i32, ::core::ptr::null_mut(), 0usize) - } - }; + let (result12_0, result12_1, result12_2) = match field_name10 { + Some(e) => { + let vec11 = e; + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); + (1i32, ptr11.cast_mut(), len11) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; let (result13_0, result13_1) = match field_size10 { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( - 1i32, result12_0, result12_1, result12_2, - result13_0, result13_1, + 1i32, + result12_0, + result12_1, + result12_2, + result13_0, + result13_1, ) } - None => ( - 0i32, - 0i32, - ::core::ptr::null_mut(), - 0usize, - 0i32, - 0i32, - ), + None => { + (0i32, 0i32, ::core::ptr::null_mut(), 0usize, 0i32, 0i32) + } }; ( 22i32, result14_0, - ::core::mem::MaybeUninit::new( - i64::from(result14_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result14_1) as u64), result14_2, result14_3 as *mut u8, result14_4 as usize, @@ -4867,9 +5555,7 @@ pub mod wasi { ( 23i32, result15_0, - ::core::mem::MaybeUninit::new( - i64::from(result15_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result15_1) as u64), ::core::ptr::null_mut(), ::core::ptr::null_mut(), 0usize, @@ -4881,17 +5567,15 @@ pub mod wasi { field_name: field_name16, field_size: field_size16, } = e; - let (result18_0, result18_1, result18_2) = - match field_name16 { - Some(e) => { - let vec17 = e; - let ptr17 = vec17.as_ptr().cast::(); - let len17 = vec17.len(); - - (1i32, ptr17.cast_mut(), len17) - } - None => (0i32, ::core::ptr::null_mut(), 0usize), - }; + let (result18_0, result18_1, result18_2) = match field_name16 { + Some(e) => { + let vec17 = e; + let ptr17 = vec17.as_ptr().cast::(); + let len17 = vec17.len(); + (1i32, ptr17.cast_mut(), len17) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; let (result19_0, result19_1) = match field_size16 { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), @@ -4900,8 +5584,7 @@ pub mod wasi { 24i32, result18_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result18_1); t }, @@ -4911,15 +5594,17 @@ pub mod wasi { 0i32, ) } - ErrorCode::HttpResponseIncomplete => ( - 25i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::HttpResponseIncomplete => { + ( + 25i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::HttpResponseHeaderSectionSize(e) => { let (result20_0, result20_1) = match e { Some(e) => (1i32, _rt::as_i32(e)), @@ -4928,9 +5613,7 @@ pub mod wasi { ( 26i32, result20_0, - ::core::mem::MaybeUninit::new( - i64::from(result20_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result20_1) as u64), ::core::ptr::null_mut(), ::core::ptr::null_mut(), 0usize, @@ -4942,17 +5625,15 @@ pub mod wasi { field_name: field_name21, field_size: field_size21, } = e; - let (result23_0, result23_1, result23_2) = - match field_name21 { - Some(e) => { - let vec22 = e; - let ptr22 = vec22.as_ptr().cast::(); - let len22 = vec22.len(); - - (1i32, ptr22.cast_mut(), len22) - } - None => (0i32, ::core::ptr::null_mut(), 0usize), - }; + let (result23_0, result23_1, result23_2) = match field_name21 { + Some(e) => { + let vec22 = e; + let ptr22 = vec22.as_ptr().cast::(); + let len22 = vec22.len(); + (1i32, ptr22.cast_mut(), len22) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; let (result24_0, result24_1) = match field_size21 { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), @@ -4961,8 +5642,7 @@ pub mod wasi { 27i32, result23_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result23_1); t }, @@ -4995,9 +5675,7 @@ pub mod wasi { ( 29i32, result26_0, - ::core::mem::MaybeUninit::new( - i64::from(result26_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result26_1) as u64), ::core::ptr::null_mut(), ::core::ptr::null_mut(), 0usize, @@ -5009,17 +5687,15 @@ pub mod wasi { field_name: field_name27, field_size: field_size27, } = e; - let (result29_0, result29_1, result29_2) = - match field_name27 { - Some(e) => { - let vec28 = e; - let ptr28 = vec28.as_ptr().cast::(); - let len28 = vec28.len(); - - (1i32, ptr28.cast_mut(), len28) - } - None => (0i32, ::core::ptr::null_mut(), 0usize), - }; + let (result29_0, result29_1, result29_2) = match field_name27 { + Some(e) => { + let vec28 = e; + let ptr28 = vec28.as_ptr().cast::(); + let len28 = vec28.len(); + (1i32, ptr28.cast_mut(), len28) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; let (result30_0, result30_1) = match field_size27 { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), @@ -5028,8 +5704,7 @@ pub mod wasi { 30i32, result29_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result29_1); t }, @@ -5045,7 +5720,6 @@ pub mod wasi { let vec31 = e; let ptr31 = vec31.as_ptr().cast::(); let len31 = vec31.len(); - (1i32, ptr31.cast_mut(), len31) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -5054,8 +5728,7 @@ pub mod wasi { 31i32, result32_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result32_1); t }, @@ -5071,7 +5744,6 @@ pub mod wasi { let vec33 = e; let ptr33 = vec33.as_ptr().cast::(); let len33 = vec33.len(); - (1i32, ptr33.cast_mut(), len33) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -5080,8 +5752,7 @@ pub mod wasi { 32i32, result34_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result34_1); t }, @@ -5091,58 +5762,67 @@ pub mod wasi { 0i32, ) } - ErrorCode::HttpResponseTimeout => ( - 33i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpUpgradeFailed => ( - 34i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpProtocolError => ( - 35i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::LoopDetected => ( - 36i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConfigurationError => ( - 37i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::HttpResponseTimeout => { + ( + 33i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpUpgradeFailed => { + ( + 34i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpProtocolError => { + ( + 35i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::LoopDetected => { + ( + 36i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConfigurationError => { + ( + 37i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::InternalError(e) => { let (result36_0, result36_1, result36_2) = match e { Some(e) => { let vec35 = e; let ptr35 = vec35.as_ptr().cast::(); let len35 = vec35.len(); - (1i32, ptr35.cast_mut(), len35) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -5151,8 +5831,7 @@ pub mod wasi { 38i32, result36_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result36_1); t }, @@ -5163,10 +5842,15 @@ pub mod wasi { ) } }; - ( - 1i32, result37_0, result37_1, result37_2, result37_3, - result37_4, result37_5, result37_6, + 1i32, + result37_0, + result37_1, + result37_2, + result37_3, + result37_4, + result37_5, + result37_6, ) } }; @@ -5186,7 +5870,6 @@ pub mod wasi { _: i32, ); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import( _: i32, @@ -5217,6 +5900,7 @@ pub mod wasi { } impl IncomingResponse { #[allow(unused_unsafe, clippy::all)] + /// Returns the status code from the incoming response. pub fn status(&self) -> StatusCode { unsafe { #[cfg(target_arch = "wasm32")] @@ -5225,7 +5909,6 @@ pub mod wasi { #[link_name = "[method]incoming-response.status"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -5237,6 +5920,13 @@ pub mod wasi { } impl IncomingResponse { #[allow(unused_unsafe, clippy::all)] + /// Returns the headers from the incoming response. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// This headers resource is a child: it must be dropped before the parent + /// `incoming-response` is dropped. pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] @@ -5245,7 +5935,6 @@ pub mod wasi { #[link_name = "[method]incoming-response.headers"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -5257,11 +5946,15 @@ pub mod wasi { } impl IncomingResponse { #[allow(unused_unsafe, clippy::all)] + /// Returns the incoming body. May be called at most once. Returns error + /// if called additional times. pub fn consume(&self) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -5269,7 +5962,6 @@ pub mod wasi { #[link_name = "[method]incoming-response.consume"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -5280,7 +5972,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - IncomingBody::from_handle(l2 as u32) }; Ok(e) @@ -5296,11 +5987,28 @@ pub mod wasi { } impl IncomingBody { #[allow(unused_unsafe, clippy::all)] + /// Returns the contents of the body, as a stream of bytes. + /// + /// Returns success on first call: the stream representing the contents + /// can be retrieved at most once. Subsequent calls will return error. + /// + /// The returned `input-stream` resource is a child: it must be dropped + /// before the parent `incoming-body` is dropped, or consumed by + /// `incoming-body.finish`. + /// + /// This invariant ensures that the implementation can determine whether + /// the user is consuming the contents of the body, waiting on the + /// `future-trailers` to be ready, or neither. This allows for network + /// backpressure is to be applied when the user is consuming the body, + /// and for that backpressure to not inhibit delivery of the trailers if + /// the user does not read the entire body. pub fn stream(&self) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -5308,7 +6016,6 @@ pub mod wasi { #[link_name = "[method]incoming-body.stream"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -5319,8 +6026,9 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::io0_2_0::streams::InputStream::from_handle(l2 as u32) + super::super::super::wasi::io0_2_0::streams::InputStream::from_handle( + l2 as u32, + ) }; Ok(e) } @@ -5335,6 +6043,8 @@ pub mod wasi { } impl IncomingBody { #[allow(unused_unsafe, clippy::all)] + /// Takes ownership of `incoming-body`, and returns a `future-trailers`. + /// This function will trap if the `input-stream` child is still alive. pub fn finish(this: IncomingBody) -> FutureTrailers { unsafe { #[cfg(target_arch = "wasm32")] @@ -5343,7 +6053,6 @@ pub mod wasi { #[link_name = "[static]incoming-body.finish"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -5355,6 +6064,9 @@ pub mod wasi { } impl FutureTrailers { #[allow(unused_unsafe, clippy::all)] + /// Returns a pollable which becomes ready when either the trailers have + /// been received, or an error has occured. When this pollable is ready, + /// the `get` method will return `some`. pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] @@ -5363,23 +6075,47 @@ pub mod wasi { #[link_name = "[method]future-trailers.subscribe"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() } let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle( + ret as u32, + ) } } } impl FutureTrailers { #[allow(unused_unsafe, clippy::all)] - pub fn get(&self) -> Option, ErrorCode>, ()>> { + /// Returns the contents of the trailers, or an error which occured, + /// once the future is ready. + /// + /// The outer `option` represents future readiness. Users can wait on this + /// `option` to become `some` using the `subscribe` method. + /// + /// The outer `result` is used to retrieve the trailers or error at most + /// once. It will be success on the first call in which the outer option + /// is `some`, and error on subsequent calls. + /// + /// The inner `result` represents that either the HTTP Request or Response + /// body, as well as any trailers, were received successfully, or that an + /// error occured receiving them. The optional `trailers` indicates whether + /// or not trailers were present in the body. + /// + /// When some `trailers` are returned by this method, the `trailers` + /// resource is immutable, and a child. Use of the `set`, `append`, or + /// `delete` methods will return an error, and the resource must be + /// dropped before the parent `future-trailers` is dropped. + pub fn get( + &self, + ) -> Option, ErrorCode>, ()>> { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 56]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 56]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 56], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -5387,7 +6123,6 @@ pub mod wasi { #[link_name = "[method]future-trailers.get"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -5399,529 +6134,470 @@ pub mod wasi { 1 => { let e = { let l2 = i32::from(*ptr0.add(8).cast::()); - match l2 { 0 => { let e = { let l3 = i32::from(*ptr0.add(16).cast::()); - match l3 { 0 => { - let e = - { - let l4 = i32::from( - *ptr0.add(24).cast::(), - ); - - match l4 { - 0 => None, - 1 => { - let e = { - let l5 = *ptr0.add(28).cast::(); - - Fields::from_handle(l5 as u32) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; + let e = { + let l4 = i32::from(*ptr0.add(24).cast::()); + match l4 { + 0 => None, + 1 => { + let e = { + let l5 = *ptr0.add(28).cast::(); + Fields::from_handle(l5 as u32) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; Ok(e) } 1 => { let e = { - let l6 = i32::from( - *ptr0.add(24).cast::(), - ); + let l6 = i32::from(*ptr0.add(24).cast::()); let v68 = match l6 { - 0 => { - ErrorCode::DnsTimeout - } - 1 => { - let e68 = { - let l7 = i32::from(*ptr0.add(32).cast::()); - let l11 = i32::from(*ptr0.add(44).cast::()); - - DnsErrorPayload{ - rcode: match l7 { - 0 => None, - 1 => { - let e = { - let l8 = *ptr0.add(36).cast::<*mut u8>(); - let l9 = *ptr0.add(40).cast::(); - let len10 = l9; - let bytes10 = _rt::Vec::from_raw_parts(l8.cast(), len10, len10); - - _rt::string_lift(bytes10) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = i32::from(*ptr0.add(46).cast::()); - - l12 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::DnsError(e68) - } - 2 => { - ErrorCode::DestinationNotFound - } - 3 => { - ErrorCode::DestinationUnavailable - } - 4 => { - ErrorCode::DestinationIpProhibited - } - 5 => { - ErrorCode::DestinationIpUnroutable - } - 6 => { - ErrorCode::ConnectionRefused - } - 7 => { - ErrorCode::ConnectionTerminated - } - 8 => { - ErrorCode::ConnectionTimeout - } - 9 => { - ErrorCode::ConnectionReadTimeout - } - 10 => { - ErrorCode::ConnectionWriteTimeout - } - 11 => { - ErrorCode::ConnectionLimitReached - } - 12 => { - ErrorCode::TlsProtocolError - } - 13 => { - ErrorCode::TlsCertificateError - } - 14 => { - let e68 = { - let l13 = i32::from(*ptr0.add(32).cast::()); - let l15 = i32::from(*ptr0.add(36).cast::()); - - TlsAlertReceivedPayload{ - alert_id: match l13 { - 0 => None, - 1 => { - let e = { - let l14 = i32::from(*ptr0.add(33).cast::()); - - l14 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l15 { - 0 => None, - 1 => { - let e = { - let l16 = *ptr0.add(40).cast::<*mut u8>(); - let l17 = *ptr0.add(44).cast::(); - let len18 = l17; - let bytes18 = _rt::Vec::from_raw_parts(l16.cast(), len18, len18); - - _rt::string_lift(bytes18) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::TlsAlertReceived(e68) - } - 15 => { - ErrorCode::HttpRequestDenied - } - 16 => { - ErrorCode::HttpRequestLengthRequired - } - 17 => { - let e68 = { - let l19 = i32::from(*ptr0.add(32).cast::()); - - match l19 { - 0 => None, - 1 => { - let e = { - let l20 = *ptr0.add(40).cast::(); - - l20 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestBodySize(e68) - } - 18 => { - ErrorCode::HttpRequestMethodInvalid - } - 19 => { - ErrorCode::HttpRequestUriInvalid - } - 20 => { - ErrorCode::HttpRequestUriTooLong - } - 21 => { - let e68 = { - let l21 = i32::from(*ptr0.add(32).cast::()); - - match l21 { - 0 => None, - 1 => { - let e = { - let l22 = *ptr0.add(36).cast::(); - - l22 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e68) - } - 22 => { - let e68 = { - let l23 = i32::from(*ptr0.add(32).cast::()); - - match l23 { - 0 => None, - 1 => { - let e = { - let l24 = i32::from(*ptr0.add(36).cast::()); - let l28 = i32::from(*ptr0.add(48).cast::()); - - FieldSizePayload{ - field_name: match l24 { - 0 => None, - 1 => { - let e = { - let l25 = *ptr0.add(40).cast::<*mut u8>(); - let l26 = *ptr0.add(44).cast::(); - let len27 = l26; - let bytes27 = _rt::Vec::from_raw_parts(l25.cast(), len27, len27); - - _rt::string_lift(bytes27) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l28 { - 0 => None, - 1 => { - let e = { - let l29 = *ptr0.add(52).cast::(); - - l29 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSize(e68) - } - 23 => { - let e68 = { - let l30 = i32::from(*ptr0.add(32).cast::()); - - match l30 { - 0 => None, - 1 => { - let e = { - let l31 = *ptr0.add(36).cast::(); - - l31 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e68) - } - 24 => { - let e68 = { - let l32 = i32::from(*ptr0.add(32).cast::()); - let l36 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l32 { - 0 => None, - 1 => { - let e = { - let l33 = *ptr0.add(36).cast::<*mut u8>(); - let l34 = *ptr0.add(40).cast::(); - let len35 = l34; - let bytes35 = _rt::Vec::from_raw_parts(l33.cast(), len35, len35); - - _rt::string_lift(bytes35) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l36 { - 0 => None, - 1 => { - let e = { - let l37 = *ptr0.add(48).cast::(); - - l37 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e68) - } - 25 => { - ErrorCode::HttpResponseIncomplete - } - 26 => { - let e68 = { - let l38 = i32::from(*ptr0.add(32).cast::()); - - match l38 { - 0 => None, - 1 => { - let e = { - let l39 = *ptr0.add(36).cast::(); - - l39 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e68) - } - 27 => { - let e68 = { - let l40 = i32::from(*ptr0.add(32).cast::()); - let l44 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l40 { - 0 => None, - 1 => { - let e = { - let l41 = *ptr0.add(36).cast::<*mut u8>(); - let l42 = *ptr0.add(40).cast::(); - let len43 = l42; - let bytes43 = _rt::Vec::from_raw_parts(l41.cast(), len43, len43); - - _rt::string_lift(bytes43) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l44 { - 0 => None, - 1 => { - let e = { - let l45 = *ptr0.add(48).cast::(); - - l45 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e68) - } - 28 => { - let e68 = { - let l46 = i32::from(*ptr0.add(32).cast::()); - - match l46 { - 0 => None, - 1 => { - let e = { - let l47 = *ptr0.add(40).cast::(); - - l47 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e68) - } - 29 => { - let e68 = { - let l48 = i32::from(*ptr0.add(32).cast::()); - - match l48 { - 0 => None, - 1 => { - let e = { - let l49 = *ptr0.add(36).cast::(); - - l49 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e68) - } - 30 => { - let e68 = { - let l50 = i32::from(*ptr0.add(32).cast::()); - let l54 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l50 { - 0 => None, - 1 => { - let e = { - let l51 = *ptr0.add(36).cast::<*mut u8>(); - let l52 = *ptr0.add(40).cast::(); - let len53 = l52; - let bytes53 = _rt::Vec::from_raw_parts(l51.cast(), len53, len53); - - _rt::string_lift(bytes53) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l54 { - 0 => None, - 1 => { - let e = { - let l55 = *ptr0.add(48).cast::(); - - l55 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e68) - } - 31 => { - let e68 = { - let l56 = i32::from(*ptr0.add(32).cast::()); - - match l56 { - 0 => None, - 1 => { - let e = { - let l57 = *ptr0.add(36).cast::<*mut u8>(); - let l58 = *ptr0.add(40).cast::(); - let len59 = l58; - let bytes59 = _rt::Vec::from_raw_parts(l57.cast(), len59, len59); - - _rt::string_lift(bytes59) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTransferCoding(e68) - } - 32 => { - let e68 = { - let l60 = i32::from(*ptr0.add(32).cast::()); - - match l60 { - 0 => None, - 1 => { - let e = { - let l61 = *ptr0.add(36).cast::<*mut u8>(); - let l62 = *ptr0.add(40).cast::(); - let len63 = l62; - let bytes63 = _rt::Vec::from_raw_parts(l61.cast(), len63, len63); - - _rt::string_lift(bytes63) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseContentCoding(e68) - } - 33 => { - ErrorCode::HttpResponseTimeout - } - 34 => { - ErrorCode::HttpUpgradeFailed - } - 35 => { - ErrorCode::HttpProtocolError - } - 36 => { - ErrorCode::LoopDetected - } - 37 => { - ErrorCode::ConfigurationError - } - n => { - debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e68 = { - let l64 = i32::from(*ptr0.add(32).cast::()); - - match l64 { - 0 => None, - 1 => { - let e = { - let l65 = *ptr0.add(36).cast::<*mut u8>(); - let l66 = *ptr0.add(40).cast::(); - let len67 = l66; - let bytes67 = _rt::Vec::from_raw_parts(l65.cast(), len67, len67); - - _rt::string_lift(bytes67) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::InternalError(e68) - } - }; - + 0 => ErrorCode::DnsTimeout, + 1 => { + let e68 = { + let l7 = i32::from(*ptr0.add(32).cast::()); + let l11 = i32::from(*ptr0.add(44).cast::()); + DnsErrorPayload { + rcode: match l7 { + 0 => None, + 1 => { + let e = { + let l8 = *ptr0.add(36).cast::<*mut u8>(); + let l9 = *ptr0.add(40).cast::(); + let len10 = l9; + let bytes10 = _rt::Vec::from_raw_parts( + l8.cast(), + len10, + len10, + ); + _rt::string_lift(bytes10) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + info_code: match l11 { + 0 => None, + 1 => { + let e = { + let l12 = i32::from(*ptr0.add(46).cast::()); + l12 as u16 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::DnsError(e68) + } + 2 => ErrorCode::DestinationNotFound, + 3 => ErrorCode::DestinationUnavailable, + 4 => ErrorCode::DestinationIpProhibited, + 5 => ErrorCode::DestinationIpUnroutable, + 6 => ErrorCode::ConnectionRefused, + 7 => ErrorCode::ConnectionTerminated, + 8 => ErrorCode::ConnectionTimeout, + 9 => ErrorCode::ConnectionReadTimeout, + 10 => ErrorCode::ConnectionWriteTimeout, + 11 => ErrorCode::ConnectionLimitReached, + 12 => ErrorCode::TlsProtocolError, + 13 => ErrorCode::TlsCertificateError, + 14 => { + let e68 = { + let l13 = i32::from(*ptr0.add(32).cast::()); + let l15 = i32::from(*ptr0.add(36).cast::()); + TlsAlertReceivedPayload { + alert_id: match l13 { + 0 => None, + 1 => { + let e = { + let l14 = i32::from(*ptr0.add(33).cast::()); + l14 as u8 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + alert_message: match l15 { + 0 => None, + 1 => { + let e = { + let l16 = *ptr0.add(40).cast::<*mut u8>(); + let l17 = *ptr0.add(44).cast::(); + let len18 = l17; + let bytes18 = _rt::Vec::from_raw_parts( + l16.cast(), + len18, + len18, + ); + _rt::string_lift(bytes18) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::TlsAlertReceived(e68) + } + 15 => ErrorCode::HttpRequestDenied, + 16 => ErrorCode::HttpRequestLengthRequired, + 17 => { + let e68 = { + let l19 = i32::from(*ptr0.add(32).cast::()); + match l19 { + 0 => None, + 1 => { + let e = { + let l20 = *ptr0.add(40).cast::(); + l20 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestBodySize(e68) + } + 18 => ErrorCode::HttpRequestMethodInvalid, + 19 => ErrorCode::HttpRequestUriInvalid, + 20 => ErrorCode::HttpRequestUriTooLong, + 21 => { + let e68 = { + let l21 = i32::from(*ptr0.add(32).cast::()); + match l21 { + 0 => None, + 1 => { + let e = { + let l22 = *ptr0.add(36).cast::(); + l22 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSectionSize(e68) + } + 22 => { + let e68 = { + let l23 = i32::from(*ptr0.add(32).cast::()); + match l23 { + 0 => None, + 1 => { + let e = { + let l24 = i32::from(*ptr0.add(36).cast::()); + let l28 = i32::from(*ptr0.add(48).cast::()); + FieldSizePayload { + field_name: match l24 { + 0 => None, + 1 => { + let e = { + let l25 = *ptr0.add(40).cast::<*mut u8>(); + let l26 = *ptr0.add(44).cast::(); + let len27 = l26; + let bytes27 = _rt::Vec::from_raw_parts( + l25.cast(), + len27, + len27, + ); + _rt::string_lift(bytes27) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l28 { + 0 => None, + 1 => { + let e = { + let l29 = *ptr0.add(52).cast::(); + l29 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSize(e68) + } + 23 => { + let e68 = { + let l30 = i32::from(*ptr0.add(32).cast::()); + match l30 { + 0 => None, + 1 => { + let e = { + let l31 = *ptr0.add(36).cast::(); + l31 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestTrailerSectionSize(e68) + } + 24 => { + let e68 = { + let l32 = i32::from(*ptr0.add(32).cast::()); + let l36 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l32 { + 0 => None, + 1 => { + let e = { + let l33 = *ptr0.add(36).cast::<*mut u8>(); + let l34 = *ptr0.add(40).cast::(); + let len35 = l34; + let bytes35 = _rt::Vec::from_raw_parts( + l33.cast(), + len35, + len35, + ); + _rt::string_lift(bytes35) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l36 { + 0 => None, + 1 => { + let e = { + let l37 = *ptr0.add(48).cast::(); + l37 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpRequestTrailerSize(e68) + } + 25 => ErrorCode::HttpResponseIncomplete, + 26 => { + let e68 = { + let l38 = i32::from(*ptr0.add(32).cast::()); + match l38 { + 0 => None, + 1 => { + let e = { + let l39 = *ptr0.add(36).cast::(); + l39 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseHeaderSectionSize(e68) + } + 27 => { + let e68 = { + let l40 = i32::from(*ptr0.add(32).cast::()); + let l44 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l40 { + 0 => None, + 1 => { + let e = { + let l41 = *ptr0.add(36).cast::<*mut u8>(); + let l42 = *ptr0.add(40).cast::(); + let len43 = l42; + let bytes43 = _rt::Vec::from_raw_parts( + l41.cast(), + len43, + len43, + ); + _rt::string_lift(bytes43) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l44 { + 0 => None, + 1 => { + let e = { + let l45 = *ptr0.add(48).cast::(); + l45 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseHeaderSize(e68) + } + 28 => { + let e68 = { + let l46 = i32::from(*ptr0.add(32).cast::()); + match l46 { + 0 => None, + 1 => { + let e = { + let l47 = *ptr0.add(40).cast::(); + l47 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseBodySize(e68) + } + 29 => { + let e68 = { + let l48 = i32::from(*ptr0.add(32).cast::()); + match l48 { + 0 => None, + 1 => { + let e = { + let l49 = *ptr0.add(36).cast::(); + l49 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTrailerSectionSize(e68) + } + 30 => { + let e68 = { + let l50 = i32::from(*ptr0.add(32).cast::()); + let l54 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l50 { + 0 => None, + 1 => { + let e = { + let l51 = *ptr0.add(36).cast::<*mut u8>(); + let l52 = *ptr0.add(40).cast::(); + let len53 = l52; + let bytes53 = _rt::Vec::from_raw_parts( + l51.cast(), + len53, + len53, + ); + _rt::string_lift(bytes53) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l54 { + 0 => None, + 1 => { + let e = { + let l55 = *ptr0.add(48).cast::(); + l55 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseTrailerSize(e68) + } + 31 => { + let e68 = { + let l56 = i32::from(*ptr0.add(32).cast::()); + match l56 { + 0 => None, + 1 => { + let e = { + let l57 = *ptr0.add(36).cast::<*mut u8>(); + let l58 = *ptr0.add(40).cast::(); + let len59 = l58; + let bytes59 = _rt::Vec::from_raw_parts( + l57.cast(), + len59, + len59, + ); + _rt::string_lift(bytes59) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTransferCoding(e68) + } + 32 => { + let e68 = { + let l60 = i32::from(*ptr0.add(32).cast::()); + match l60 { + 0 => None, + 1 => { + let e = { + let l61 = *ptr0.add(36).cast::<*mut u8>(); + let l62 = *ptr0.add(40).cast::(); + let len63 = l62; + let bytes63 = _rt::Vec::from_raw_parts( + l61.cast(), + len63, + len63, + ); + _rt::string_lift(bytes63) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseContentCoding(e68) + } + 33 => ErrorCode::HttpResponseTimeout, + 34 => ErrorCode::HttpUpgradeFailed, + 35 => ErrorCode::HttpProtocolError, + 36 => ErrorCode::LoopDetected, + 37 => ErrorCode::ConfigurationError, + n => { + debug_assert_eq!(n, 38, "invalid enum discriminant"); + let e68 = { + let l64 = i32::from(*ptr0.add(32).cast::()); + match l64 { + 0 => None, + 1 => { + let e = { + let l65 = *ptr0.add(36).cast::<*mut u8>(); + let l66 = *ptr0.add(40).cast::(); + let len67 = l66; + let bytes67 = _rt::Vec::from_raw_parts( + l65.cast(), + len67, + len67, + ); + _rt::string_lift(bytes67) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::InternalError(e68) + } + }; v68 }; Err(e) @@ -5947,6 +6623,11 @@ pub mod wasi { } impl OutgoingResponse { #[allow(unused_unsafe, clippy::all)] + /// Construct an `outgoing-response`, with a default `status-code` of `200`. + /// If a different `status-code` is needed, it must be set via the + /// `set-status-code` method. + /// + /// * `headers` is the HTTP Headers for the Response. pub fn new(headers: Headers) -> Self { unsafe { #[cfg(target_arch = "wasm32")] @@ -5955,7 +6636,6 @@ pub mod wasi { #[link_name = "[constructor]outgoing-response"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -5967,6 +6647,7 @@ pub mod wasi { } impl OutgoingResponse { #[allow(unused_unsafe, clippy::all)] + /// Get the HTTP Status Code for the Response. pub fn status_code(&self) -> StatusCode { unsafe { #[cfg(target_arch = "wasm32")] @@ -5975,7 +6656,6 @@ pub mod wasi { #[link_name = "[method]outgoing-response.status-code"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -5987,7 +6667,12 @@ pub mod wasi { } impl OutgoingResponse { #[allow(unused_unsafe, clippy::all)] - pub fn set_status_code(&self, status_code: StatusCode) -> Result<(), ()> { + /// Set the HTTP Status Code for the Response. Fails if the status-code + /// given is not a valid http status code. + pub fn set_status_code( + &self, + status_code: StatusCode, + ) -> Result<(), ()> { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -5995,12 +6680,14 @@ pub mod wasi { #[link_name = "[method]outgoing-response.set-status-code"] fn wit_import(_: i32, _: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, _rt::as_i32(status_code)); + let ret = wit_import( + (self).handle() as i32, + _rt::as_i32(status_code), + ); match ret { 0 => { let e = (); @@ -6017,6 +6704,14 @@ pub mod wasi { } impl OutgoingResponse { #[allow(unused_unsafe, clippy::all)] + /// Get the headers associated with the Request. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// This headers resource is a child: it must be dropped before the parent + /// `outgoing-request` is dropped, or its ownership is transfered to + /// another component by e.g. `outgoing-handler.handle`. pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] @@ -6025,7 +6720,6 @@ pub mod wasi { #[link_name = "[method]outgoing-response.headers"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -6037,11 +6731,18 @@ pub mod wasi { } impl OutgoingResponse { #[allow(unused_unsafe, clippy::all)] + /// Returns the resource corresponding to the outgoing Body for this Response. + /// + /// Returns success on the first call: the `outgoing-body` resource for + /// this `outgoing-response` can be retrieved at most once. Subsequent + /// calls will return error. pub fn body(&self) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -6049,7 +6750,6 @@ pub mod wasi { #[link_name = "[method]outgoing-response.body"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -6060,7 +6760,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - OutgoingBody::from_handle(l2 as u32) }; Ok(e) @@ -6076,11 +6775,22 @@ pub mod wasi { } impl OutgoingBody { #[allow(unused_unsafe, clippy::all)] + /// Returns a stream for writing the body contents. + /// + /// The returned `output-stream` is a child resource: it must be dropped + /// before the parent `outgoing-body` resource is dropped (or finished), + /// otherwise the `outgoing-body` drop or `finish` will trap. + /// + /// Returns success on the first call: the `output-stream` resource for + /// this `outgoing-body` may be retrieved at most once. Subsequent calls + /// will return error. pub fn write(&self) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -6088,7 +6798,6 @@ pub mod wasi { #[link_name = "[method]outgoing-body.write"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -6099,8 +6808,9 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::io0_2_0::streams::OutputStream::from_handle(l2 as u32) + super::super::super::wasi::io0_2_0::streams::OutputStream::from_handle( + l2 as u32, + ) }; Ok(e) } @@ -6115,6 +6825,15 @@ pub mod wasi { } impl OutgoingBody { #[allow(unused_unsafe, clippy::all)] + /// Finalize an outgoing body, optionally providing trailers. This must be + /// called to signal that the response is complete. If the `outgoing-body` + /// is dropped without calling `outgoing-body.finalize`, the implementation + /// should treat the body as corrupted. + /// + /// Fails if the body's `outgoing-request` or `outgoing-response` was + /// constructed with a Content-Length header, and the contents written + /// to the body (via `write`) does not match the value given in the + /// Content-Length. pub fn finish( this: OutgoingBody, trailers: Option, @@ -6122,7 +6841,9 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 40]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 40]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 40], + ); let (result0_0, result0_1) = match &trailers { Some(e) => (1i32, (e).take_handle() as i32), None => (0i32, 0i32), @@ -6134,12 +6855,16 @@ pub mod wasi { #[link_name = "[static]outgoing-body.finish"] fn wit_import(_: i32, _: i32, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import((&this).take_handle() as i32, result0_0, result0_1, ptr1); + wit_import( + (&this).take_handle() as i32, + result0_0, + result0_1, + ptr1, + ); let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { @@ -6155,24 +6880,19 @@ pub mod wasi { let e65 = { let l4 = i32::from(*ptr1.add(16).cast::()); let l8 = i32::from(*ptr1.add(28).cast::()); - DnsErrorPayload { rcode: match l4 { 0 => None, 1 => { let e = { - let l5 = - *ptr1.add(20).cast::<*mut u8>(); - let l6 = - *ptr1.add(24).cast::(); + let l5 = *ptr1.add(20).cast::<*mut u8>(); + let l6 = *ptr1.add(24).cast::(); let len7 = l6; - let bytes7 = - _rt::Vec::from_raw_parts( - l5.cast(), - len7, - len7, - ); - + let bytes7 = _rt::Vec::from_raw_parts( + l5.cast(), + len7, + len7, + ); _rt::string_lift(bytes7) }; Some(e) @@ -6183,10 +6903,7 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l9 = i32::from( - *ptr1.add(30).cast::(), - ); - + let l9 = i32::from(*ptr1.add(30).cast::()); l9 as u16 }; Some(e) @@ -6213,16 +6930,12 @@ pub mod wasi { let e65 = { let l10 = i32::from(*ptr1.add(16).cast::()); let l12 = i32::from(*ptr1.add(20).cast::()); - TlsAlertReceivedPayload { alert_id: match l10 { 0 => None, 1 => { let e = { - let l11 = i32::from( - *ptr1.add(17).cast::(), - ); - + let l11 = i32::from(*ptr1.add(17).cast::()); l11 as u8 }; Some(e) @@ -6233,18 +6946,14 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l13 = - *ptr1.add(24).cast::<*mut u8>(); - let l14 = - *ptr1.add(28).cast::(); + let l13 = *ptr1.add(24).cast::<*mut u8>(); + let l14 = *ptr1.add(28).cast::(); let len15 = l14; - let bytes15 = - _rt::Vec::from_raw_parts( - l13.cast(), - len15, - len15, - ); - + let bytes15 = _rt::Vec::from_raw_parts( + l13.cast(), + len15, + len15, + ); _rt::string_lift(bytes15) }; Some(e) @@ -6260,13 +6969,11 @@ pub mod wasi { 17 => { let e65 = { let l16 = i32::from(*ptr1.add(16).cast::()); - match l16 { 0 => None, 1 => { let e = { let l17 = *ptr1.add(24).cast::(); - l17 as u64 }; Some(e) @@ -6282,13 +6989,11 @@ pub mod wasi { 21 => { let e65 = { let l18 = i32::from(*ptr1.add(16).cast::()); - match l18 { 0 => None, 1 => { let e = { let l19 = *ptr1.add(20).cast::(); - l19 as u32 }; Some(e) @@ -6301,47 +7006,43 @@ pub mod wasi { 22 => { let e65 = { let l20 = i32::from(*ptr1.add(16).cast::()); - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = i32::from( - *ptr1.add(20).cast::(), - ); - let l25 = i32::from( - *ptr1.add(32).cast::(), - ); - - FieldSizePayload{ - field_name: match l21 { - 0 => None, - 1 => { - let e = { - let l22 = *ptr1.add(24).cast::<*mut u8>(); - let l23 = *ptr1.add(28).cast::(); - let len24 = l23; - let bytes24 = _rt::Vec::from_raw_parts(l22.cast(), len24, len24); - - _rt::string_lift(bytes24) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l25 { - 0 => None, - 1 => { - let e = { - let l26 = *ptr1.add(36).cast::(); - - l26 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } + 0 => None, + 1 => { + let e = { + let l21 = i32::from(*ptr1.add(20).cast::()); + let l25 = i32::from(*ptr1.add(32).cast::()); + FieldSizePayload { + field_name: match l21 { + 0 => None, + 1 => { + let e = { + let l22 = *ptr1.add(24).cast::<*mut u8>(); + let l23 = *ptr1.add(28).cast::(); + let len24 = l23; + let bytes24 = _rt::Vec::from_raw_parts( + l22.cast(), + len24, + len24, + ); + _rt::string_lift(bytes24) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l25 { + 0 => None, + 1 => { + let e = { + let l26 = *ptr1.add(36).cast::(); + l26 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; Some(e) } @@ -6353,13 +7054,11 @@ pub mod wasi { 23 => { let e65 = { let l27 = i32::from(*ptr1.add(16).cast::()); - match l27 { 0 => None, 1 => { let e = { let l28 = *ptr1.add(20).cast::(); - l28 as u32 }; Some(e) @@ -6373,24 +7072,19 @@ pub mod wasi { let e65 = { let l29 = i32::from(*ptr1.add(16).cast::()); let l33 = i32::from(*ptr1.add(28).cast::()); - FieldSizePayload { field_name: match l29 { 0 => None, 1 => { let e = { - let l30 = - *ptr1.add(20).cast::<*mut u8>(); - let l31 = - *ptr1.add(24).cast::(); + let l30 = *ptr1.add(20).cast::<*mut u8>(); + let l31 = *ptr1.add(24).cast::(); let len32 = l31; - let bytes32 = - _rt::Vec::from_raw_parts( - l30.cast(), - len32, - len32, - ); - + let bytes32 = _rt::Vec::from_raw_parts( + l30.cast(), + len32, + len32, + ); _rt::string_lift(bytes32) }; Some(e) @@ -6401,9 +7095,7 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l34 = - *ptr1.add(32).cast::(); - + let l34 = *ptr1.add(32).cast::(); l34 as u32 }; Some(e) @@ -6418,13 +7110,11 @@ pub mod wasi { 26 => { let e65 = { let l35 = i32::from(*ptr1.add(16).cast::()); - match l35 { 0 => None, 1 => { let e = { let l36 = *ptr1.add(20).cast::(); - l36 as u32 }; Some(e) @@ -6438,24 +7128,19 @@ pub mod wasi { let e65 = { let l37 = i32::from(*ptr1.add(16).cast::()); let l41 = i32::from(*ptr1.add(28).cast::()); - FieldSizePayload { field_name: match l37 { 0 => None, 1 => { let e = { - let l38 = - *ptr1.add(20).cast::<*mut u8>(); - let l39 = - *ptr1.add(24).cast::(); + let l38 = *ptr1.add(20).cast::<*mut u8>(); + let l39 = *ptr1.add(24).cast::(); let len40 = l39; - let bytes40 = - _rt::Vec::from_raw_parts( - l38.cast(), - len40, - len40, - ); - + let bytes40 = _rt::Vec::from_raw_parts( + l38.cast(), + len40, + len40, + ); _rt::string_lift(bytes40) }; Some(e) @@ -6466,9 +7151,7 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l42 = - *ptr1.add(32).cast::(); - + let l42 = *ptr1.add(32).cast::(); l42 as u32 }; Some(e) @@ -6482,13 +7165,11 @@ pub mod wasi { 28 => { let e65 = { let l43 = i32::from(*ptr1.add(16).cast::()); - match l43 { 0 => None, 1 => { let e = { let l44 = *ptr1.add(24).cast::(); - l44 as u64 }; Some(e) @@ -6501,13 +7182,11 @@ pub mod wasi { 29 => { let e65 = { let l45 = i32::from(*ptr1.add(16).cast::()); - match l45 { 0 => None, 1 => { let e = { let l46 = *ptr1.add(20).cast::(); - l46 as u32 }; Some(e) @@ -6521,24 +7200,19 @@ pub mod wasi { let e65 = { let l47 = i32::from(*ptr1.add(16).cast::()); let l51 = i32::from(*ptr1.add(28).cast::()); - FieldSizePayload { field_name: match l47 { 0 => None, 1 => { let e = { - let l48 = - *ptr1.add(20).cast::<*mut u8>(); - let l49 = - *ptr1.add(24).cast::(); + let l48 = *ptr1.add(20).cast::<*mut u8>(); + let l49 = *ptr1.add(24).cast::(); let len50 = l49; - let bytes50 = - _rt::Vec::from_raw_parts( - l48.cast(), - len50, - len50, - ); - + let bytes50 = _rt::Vec::from_raw_parts( + l48.cast(), + len50, + len50, + ); _rt::string_lift(bytes50) }; Some(e) @@ -6549,9 +7223,7 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l52 = - *ptr1.add(32).cast::(); - + let l52 = *ptr1.add(32).cast::(); l52 as u32 }; Some(e) @@ -6565,13 +7237,11 @@ pub mod wasi { 31 => { let e65 = { let l53 = i32::from(*ptr1.add(16).cast::()); - match l53 { 0 => None, 1 => { let e = { - let l54 = - *ptr1.add(20).cast::<*mut u8>(); + let l54 = *ptr1.add(20).cast::<*mut u8>(); let l55 = *ptr1.add(24).cast::(); let len56 = l55; let bytes56 = _rt::Vec::from_raw_parts( @@ -6579,7 +7249,6 @@ pub mod wasi { len56, len56, ); - _rt::string_lift(bytes56) }; Some(e) @@ -6592,13 +7261,11 @@ pub mod wasi { 32 => { let e65 = { let l57 = i32::from(*ptr1.add(16).cast::()); - match l57 { 0 => None, 1 => { let e = { - let l58 = - *ptr1.add(20).cast::<*mut u8>(); + let l58 = *ptr1.add(20).cast::<*mut u8>(); let l59 = *ptr1.add(24).cast::(); let len60 = l59; let bytes60 = _rt::Vec::from_raw_parts( @@ -6606,7 +7273,6 @@ pub mod wasi { len60, len60, ); - _rt::string_lift(bytes60) }; Some(e) @@ -6625,13 +7291,11 @@ pub mod wasi { debug_assert_eq!(n, 38, "invalid enum discriminant"); let e65 = { let l61 = i32::from(*ptr1.add(16).cast::()); - match l61 { 0 => None, 1 => { let e = { - let l62 = - *ptr1.add(20).cast::<*mut u8>(); + let l62 = *ptr1.add(20).cast::<*mut u8>(); let l63 = *ptr1.add(24).cast::(); let len64 = l63; let bytes64 = _rt::Vec::from_raw_parts( @@ -6639,7 +7303,6 @@ pub mod wasi { len64, len64, ); - _rt::string_lift(bytes64) }; Some(e) @@ -6650,7 +7313,6 @@ pub mod wasi { ErrorCode::InternalError(e65) } }; - v65 }; Err(e) @@ -6662,6 +7324,9 @@ pub mod wasi { } impl FutureIncomingResponse { #[allow(unused_unsafe, clippy::all)] + /// Returns a pollable which becomes ready when either the Response has + /// been received, or an error has occured. When this pollable is ready, + /// the `get` method will return `some`. pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] @@ -6670,23 +7335,42 @@ pub mod wasi { #[link_name = "[method]future-incoming-response.subscribe"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() } let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle( + ret as u32, + ) } } } impl FutureIncomingResponse { #[allow(unused_unsafe, clippy::all)] - pub fn get(&self) -> Option, ()>> { + /// Returns the incoming HTTP Response, or an error, once one is ready. + /// + /// The outer `option` represents future readiness. Users can wait on this + /// `option` to become `some` using the `subscribe` method. + /// + /// The outer `result` is used to retrieve the response or error at most + /// once. It will be success on the first call in which the outer option + /// is `some`, and error on subsequent calls. + /// + /// The inner `result` represents that either the incoming HTTP Response + /// status and headers have recieved successfully, or that an error + /// occured. Errors may also occur while consuming the response body, + /// but those will be reported by the `incoming-body` and its + /// `output-stream` child. + pub fn get( + &self, + ) -> Option, ()>> { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 56]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 56]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 56], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -6694,527 +7378,471 @@ pub mod wasi { #[link_name = "[method]future-incoming-response.get"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { - unreachable!() - } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { - 0 => None, - 1 => { - let e = { - let l2 = i32::from(*ptr0.add(8).cast::()); - - match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(16).cast::()); - - match l3 { - 0 => { - let e = { - let l4 = *ptr0.add(24).cast::(); - - IncomingResponse::from_handle(l4 as u32) - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr0.add(24).cast::(), - ); - let v67 = match l5 { - 0 => { - ErrorCode::DnsTimeout - } - 1 => { - let e67 = { - let l6 = i32::from(*ptr0.add(32).cast::()); - let l10 = i32::from(*ptr0.add(44).cast::()); - - DnsErrorPayload{ - rcode: match l6 { - 0 => None, - 1 => { - let e = { - let l7 = *ptr0.add(36).cast::<*mut u8>(); - let l8 = *ptr0.add(40).cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); - - _rt::string_lift(bytes9) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l10 { - 0 => None, - 1 => { - let e = { - let l11 = i32::from(*ptr0.add(46).cast::()); - - l11 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::DnsError(e67) - } - 2 => { - ErrorCode::DestinationNotFound - } - 3 => { - ErrorCode::DestinationUnavailable - } - 4 => { - ErrorCode::DestinationIpProhibited - } - 5 => { - ErrorCode::DestinationIpUnroutable - } - 6 => { - ErrorCode::ConnectionRefused - } - 7 => { - ErrorCode::ConnectionTerminated - } - 8 => { - ErrorCode::ConnectionTimeout - } - 9 => { - ErrorCode::ConnectionReadTimeout - } - 10 => { - ErrorCode::ConnectionWriteTimeout - } - 11 => { - ErrorCode::ConnectionLimitReached - } - 12 => { - ErrorCode::TlsProtocolError - } - 13 => { - ErrorCode::TlsCertificateError - } - 14 => { - let e67 = { - let l12 = i32::from(*ptr0.add(32).cast::()); - let l14 = i32::from(*ptr0.add(36).cast::()); - - TlsAlertReceivedPayload{ - alert_id: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = i32::from(*ptr0.add(33).cast::()); - - l13 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l14 { - 0 => None, - 1 => { - let e = { - let l15 = *ptr0.add(40).cast::<*mut u8>(); - let l16 = *ptr0.add(44).cast::(); - let len17 = l16; - let bytes17 = _rt::Vec::from_raw_parts(l15.cast(), len17, len17); - - _rt::string_lift(bytes17) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::TlsAlertReceived(e67) - } - 15 => { - ErrorCode::HttpRequestDenied - } - 16 => { - ErrorCode::HttpRequestLengthRequired - } - 17 => { - let e67 = { - let l18 = i32::from(*ptr0.add(32).cast::()); - - match l18 { - 0 => None, - 1 => { - let e = { - let l19 = *ptr0.add(40).cast::(); - - l19 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestBodySize(e67) - } - 18 => { - ErrorCode::HttpRequestMethodInvalid - } - 19 => { - ErrorCode::HttpRequestUriInvalid - } - 20 => { - ErrorCode::HttpRequestUriTooLong - } - 21 => { - let e67 = { - let l20 = i32::from(*ptr0.add(32).cast::()); - - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = *ptr0.add(36).cast::(); - - l21 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e67) - } - 22 => { - let e67 = { - let l22 = i32::from(*ptr0.add(32).cast::()); - - match l22 { - 0 => None, - 1 => { - let e = { - let l23 = i32::from(*ptr0.add(36).cast::()); - let l27 = i32::from(*ptr0.add(48).cast::()); - - FieldSizePayload{ - field_name: match l23 { - 0 => None, - 1 => { - let e = { - let l24 = *ptr0.add(40).cast::<*mut u8>(); - let l25 = *ptr0.add(44).cast::(); - let len26 = l25; - let bytes26 = _rt::Vec::from_raw_parts(l24.cast(), len26, len26); - - _rt::string_lift(bytes26) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l27 { - 0 => None, - 1 => { - let e = { - let l28 = *ptr0.add(52).cast::(); - - l28 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSize(e67) - } - 23 => { - let e67 = { - let l29 = i32::from(*ptr0.add(32).cast::()); - - match l29 { - 0 => None, - 1 => { - let e = { - let l30 = *ptr0.add(36).cast::(); - - l30 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e67) - } - 24 => { - let e67 = { - let l31 = i32::from(*ptr0.add(32).cast::()); - let l35 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l31 { - 0 => None, - 1 => { - let e = { - let l32 = *ptr0.add(36).cast::<*mut u8>(); - let l33 = *ptr0.add(40).cast::(); - let len34 = l33; - let bytes34 = _rt::Vec::from_raw_parts(l32.cast(), len34, len34); - - _rt::string_lift(bytes34) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l35 { - 0 => None, - 1 => { - let e = { - let l36 = *ptr0.add(48).cast::(); - - l36 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e67) - } - 25 => { - ErrorCode::HttpResponseIncomplete - } - 26 => { - let e67 = { - let l37 = i32::from(*ptr0.add(32).cast::()); - - match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *ptr0.add(36).cast::(); - - l38 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e67) - } - 27 => { - let e67 = { - let l39 = i32::from(*ptr0.add(32).cast::()); - let l43 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *ptr0.add(36).cast::<*mut u8>(); - let l41 = *ptr0.add(40).cast::(); - let len42 = l41; - let bytes42 = _rt::Vec::from_raw_parts(l40.cast(), len42, len42); - - _rt::string_lift(bytes42) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l43 { - 0 => None, - 1 => { - let e = { - let l44 = *ptr0.add(48).cast::(); - - l44 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e67) - } - 28 => { - let e67 = { - let l45 = i32::from(*ptr0.add(32).cast::()); - - match l45 { - 0 => None, - 1 => { - let e = { - let l46 = *ptr0.add(40).cast::(); - - l46 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e67) - } - 29 => { - let e67 = { - let l47 = i32::from(*ptr0.add(32).cast::()); - - match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *ptr0.add(36).cast::(); - - l48 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e67) - } - 30 => { - let e67 = { - let l49 = i32::from(*ptr0.add(32).cast::()); - let l53 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l49 { - 0 => None, - 1 => { - let e = { - let l50 = *ptr0.add(36).cast::<*mut u8>(); - let l51 = *ptr0.add(40).cast::(); - let len52 = l51; - let bytes52 = _rt::Vec::from_raw_parts(l50.cast(), len52, len52); - - _rt::string_lift(bytes52) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l53 { - 0 => None, - 1 => { - let e = { - let l54 = *ptr0.add(48).cast::(); - - l54 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e67) - } - 31 => { - let e67 = { - let l55 = i32::from(*ptr0.add(32).cast::()); - - match l55 { - 0 => None, - 1 => { - let e = { - let l56 = *ptr0.add(36).cast::<*mut u8>(); - let l57 = *ptr0.add(40).cast::(); - let len58 = l57; - let bytes58 = _rt::Vec::from_raw_parts(l56.cast(), len58, len58); - - _rt::string_lift(bytes58) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTransferCoding(e67) - } - 32 => { - let e67 = { - let l59 = i32::from(*ptr0.add(32).cast::()); - - match l59 { - 0 => None, - 1 => { - let e = { - let l60 = *ptr0.add(36).cast::<*mut u8>(); - let l61 = *ptr0.add(40).cast::(); - let len62 = l61; - let bytes62 = _rt::Vec::from_raw_parts(l60.cast(), len62, len62); - - _rt::string_lift(bytes62) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseContentCoding(e67) - } - 33 => { - ErrorCode::HttpResponseTimeout - } - 34 => { - ErrorCode::HttpUpgradeFailed - } - 35 => { - ErrorCode::HttpProtocolError - } - 36 => { - ErrorCode::LoopDetected - } - 37 => { - ErrorCode::ConfigurationError - } - n => { - debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e67 = { - let l63 = i32::from(*ptr0.add(32).cast::()); - - match l63 { - 0 => None, - 1 => { - let e = { - let l64 = *ptr0.add(36).cast::<*mut u8>(); - let l65 = *ptr0.add(40).cast::(); - let len66 = l65; - let bytes66 = _rt::Vec::from_raw_parts(l64.cast(), len66, len66); - - _rt::string_lift(bytes66) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::InternalError(e67) - } - }; - + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(8).cast::()); + match l2 { + 0 => { + let e = { + let l3 = i32::from(*ptr0.add(16).cast::()); + match l3 { + 0 => { + let e = { + let l4 = *ptr0.add(24).cast::(); + IncomingResponse::from_handle(l4 as u32) + }; + Ok(e) + } + 1 => { + let e = { + let l5 = i32::from(*ptr0.add(24).cast::()); + let v67 = match l5 { + 0 => ErrorCode::DnsTimeout, + 1 => { + let e67 = { + let l6 = i32::from(*ptr0.add(32).cast::()); + let l10 = i32::from(*ptr0.add(44).cast::()); + DnsErrorPayload { + rcode: match l6 { + 0 => None, + 1 => { + let e = { + let l7 = *ptr0.add(36).cast::<*mut u8>(); + let l8 = *ptr0.add(40).cast::(); + let len9 = l8; + let bytes9 = _rt::Vec::from_raw_parts( + l7.cast(), + len9, + len9, + ); + _rt::string_lift(bytes9) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + info_code: match l10 { + 0 => None, + 1 => { + let e = { + let l11 = i32::from(*ptr0.add(46).cast::()); + l11 as u16 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::DnsError(e67) + } + 2 => ErrorCode::DestinationNotFound, + 3 => ErrorCode::DestinationUnavailable, + 4 => ErrorCode::DestinationIpProhibited, + 5 => ErrorCode::DestinationIpUnroutable, + 6 => ErrorCode::ConnectionRefused, + 7 => ErrorCode::ConnectionTerminated, + 8 => ErrorCode::ConnectionTimeout, + 9 => ErrorCode::ConnectionReadTimeout, + 10 => ErrorCode::ConnectionWriteTimeout, + 11 => ErrorCode::ConnectionLimitReached, + 12 => ErrorCode::TlsProtocolError, + 13 => ErrorCode::TlsCertificateError, + 14 => { + let e67 = { + let l12 = i32::from(*ptr0.add(32).cast::()); + let l14 = i32::from(*ptr0.add(36).cast::()); + TlsAlertReceivedPayload { + alert_id: match l12 { + 0 => None, + 1 => { + let e = { + let l13 = i32::from(*ptr0.add(33).cast::()); + l13 as u8 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + alert_message: match l14 { + 0 => None, + 1 => { + let e = { + let l15 = *ptr0.add(40).cast::<*mut u8>(); + let l16 = *ptr0.add(44).cast::(); + let len17 = l16; + let bytes17 = _rt::Vec::from_raw_parts( + l15.cast(), + len17, + len17, + ); + _rt::string_lift(bytes17) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::TlsAlertReceived(e67) + } + 15 => ErrorCode::HttpRequestDenied, + 16 => ErrorCode::HttpRequestLengthRequired, + 17 => { + let e67 = { + let l18 = i32::from(*ptr0.add(32).cast::()); + match l18 { + 0 => None, + 1 => { + let e = { + let l19 = *ptr0.add(40).cast::(); + l19 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestBodySize(e67) + } + 18 => ErrorCode::HttpRequestMethodInvalid, + 19 => ErrorCode::HttpRequestUriInvalid, + 20 => ErrorCode::HttpRequestUriTooLong, + 21 => { + let e67 = { + let l20 = i32::from(*ptr0.add(32).cast::()); + match l20 { + 0 => None, + 1 => { + let e = { + let l21 = *ptr0.add(36).cast::(); + l21 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSectionSize(e67) + } + 22 => { + let e67 = { + let l22 = i32::from(*ptr0.add(32).cast::()); + match l22 { + 0 => None, + 1 => { + let e = { + let l23 = i32::from(*ptr0.add(36).cast::()); + let l27 = i32::from(*ptr0.add(48).cast::()); + FieldSizePayload { + field_name: match l23 { + 0 => None, + 1 => { + let e = { + let l24 = *ptr0.add(40).cast::<*mut u8>(); + let l25 = *ptr0.add(44).cast::(); + let len26 = l25; + let bytes26 = _rt::Vec::from_raw_parts( + l24.cast(), + len26, + len26, + ); + _rt::string_lift(bytes26) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l27 { + 0 => None, + 1 => { + let e = { + let l28 = *ptr0.add(52).cast::(); + l28 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSize(e67) + } + 23 => { + let e67 = { + let l29 = i32::from(*ptr0.add(32).cast::()); + match l29 { + 0 => None, + 1 => { + let e = { + let l30 = *ptr0.add(36).cast::(); + l30 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestTrailerSectionSize(e67) + } + 24 => { + let e67 = { + let l31 = i32::from(*ptr0.add(32).cast::()); + let l35 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l31 { + 0 => None, + 1 => { + let e = { + let l32 = *ptr0.add(36).cast::<*mut u8>(); + let l33 = *ptr0.add(40).cast::(); + let len34 = l33; + let bytes34 = _rt::Vec::from_raw_parts( + l32.cast(), + len34, + len34, + ); + _rt::string_lift(bytes34) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l35 { + 0 => None, + 1 => { + let e = { + let l36 = *ptr0.add(48).cast::(); + l36 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpRequestTrailerSize(e67) + } + 25 => ErrorCode::HttpResponseIncomplete, + 26 => { + let e67 = { + let l37 = i32::from(*ptr0.add(32).cast::()); + match l37 { + 0 => None, + 1 => { + let e = { + let l38 = *ptr0.add(36).cast::(); + l38 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseHeaderSectionSize(e67) + } + 27 => { + let e67 = { + let l39 = i32::from(*ptr0.add(32).cast::()); + let l43 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l39 { + 0 => None, + 1 => { + let e = { + let l40 = *ptr0.add(36).cast::<*mut u8>(); + let l41 = *ptr0.add(40).cast::(); + let len42 = l41; + let bytes42 = _rt::Vec::from_raw_parts( + l40.cast(), + len42, + len42, + ); + _rt::string_lift(bytes42) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l43 { + 0 => None, + 1 => { + let e = { + let l44 = *ptr0.add(48).cast::(); + l44 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseHeaderSize(e67) + } + 28 => { + let e67 = { + let l45 = i32::from(*ptr0.add(32).cast::()); + match l45 { + 0 => None, + 1 => { + let e = { + let l46 = *ptr0.add(40).cast::(); + l46 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseBodySize(e67) + } + 29 => { + let e67 = { + let l47 = i32::from(*ptr0.add(32).cast::()); + match l47 { + 0 => None, + 1 => { + let e = { + let l48 = *ptr0.add(36).cast::(); + l48 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTrailerSectionSize(e67) + } + 30 => { + let e67 = { + let l49 = i32::from(*ptr0.add(32).cast::()); + let l53 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l49 { + 0 => None, + 1 => { + let e = { + let l50 = *ptr0.add(36).cast::<*mut u8>(); + let l51 = *ptr0.add(40).cast::(); + let len52 = l51; + let bytes52 = _rt::Vec::from_raw_parts( + l50.cast(), + len52, + len52, + ); + _rt::string_lift(bytes52) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l53 { + 0 => None, + 1 => { + let e = { + let l54 = *ptr0.add(48).cast::(); + l54 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseTrailerSize(e67) + } + 31 => { + let e67 = { + let l55 = i32::from(*ptr0.add(32).cast::()); + match l55 { + 0 => None, + 1 => { + let e = { + let l56 = *ptr0.add(36).cast::<*mut u8>(); + let l57 = *ptr0.add(40).cast::(); + let len58 = l57; + let bytes58 = _rt::Vec::from_raw_parts( + l56.cast(), + len58, + len58, + ); + _rt::string_lift(bytes58) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTransferCoding(e67) + } + 32 => { + let e67 = { + let l59 = i32::from(*ptr0.add(32).cast::()); + match l59 { + 0 => None, + 1 => { + let e = { + let l60 = *ptr0.add(36).cast::<*mut u8>(); + let l61 = *ptr0.add(40).cast::(); + let len62 = l61; + let bytes62 = _rt::Vec::from_raw_parts( + l60.cast(), + len62, + len62, + ); + _rt::string_lift(bytes62) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseContentCoding(e67) + } + 33 => ErrorCode::HttpResponseTimeout, + 34 => ErrorCode::HttpUpgradeFailed, + 35 => ErrorCode::HttpProtocolError, + 36 => ErrorCode::LoopDetected, + 37 => ErrorCode::ConfigurationError, + n => { + debug_assert_eq!(n, 38, "invalid enum discriminant"); + let e67 = { + let l63 = i32::from(*ptr0.add(32).cast::()); + match l63 { + 0 => None, + 1 => { + let e = { + let l64 = *ptr0.add(36).cast::<*mut u8>(); + let l65 = *ptr0.add(40).cast::(); + let len66 = l65; + let bytes66 = _rt::Vec::from_raw_parts( + l64.cast(), + len66, + len66, + ); + _rt::string_lift(bytes66) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::InternalError(e67) + } + }; v67 }; Err(e) @@ -7239,6 +7867,17 @@ pub mod wasi { } } #[allow(unused_unsafe, clippy::all)] + /// Attempts to extract a http-related `error` from the wasi:io `error` + /// provided. + /// + /// Stream operations which return + /// `wasi:io/stream/stream-error::last-operation-failed` have a payload of + /// type `wasi:io/error/error` with more information about the operation + /// that failed. This payload can be passed through to this function to see + /// if there's http-related information about the error to return. + /// + /// Note that this function is fallible because not all io-errors are + /// http-related errors. pub fn http_error_code(err: &IoError) -> Option { unsafe { #[repr(align(8))] @@ -7251,7 +7890,6 @@ pub mod wasi { #[link_name = "http-error-code"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -7269,14 +7907,12 @@ pub mod wasi { let e64 = { let l3 = i32::from(*ptr0.add(16).cast::()); let l7 = i32::from(*ptr0.add(28).cast::()); - DnsErrorPayload { rcode: match l3 { 0 => None, 1 => { let e = { - let l4 = - *ptr0.add(20).cast::<*mut u8>(); + let l4 = *ptr0.add(20).cast::<*mut u8>(); let l5 = *ptr0.add(24).cast::(); let len6 = l5; let bytes6 = _rt::Vec::from_raw_parts( @@ -7284,7 +7920,6 @@ pub mod wasi { len6, len6, ); - _rt::string_lift(bytes6) }; Some(e) @@ -7295,10 +7930,7 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l8 = i32::from( - *ptr0.add(30).cast::(), - ); - + let l8 = i32::from(*ptr0.add(30).cast::()); l8 as u16 }; Some(e) @@ -7325,16 +7957,12 @@ pub mod wasi { let e64 = { let l9 = i32::from(*ptr0.add(16).cast::()); let l11 = i32::from(*ptr0.add(20).cast::()); - TlsAlertReceivedPayload { alert_id: match l9 { 0 => None, 1 => { let e = { - let l10 = i32::from( - *ptr0.add(17).cast::(), - ); - + let l10 = i32::from(*ptr0.add(17).cast::()); l10 as u8 }; Some(e) @@ -7345,8 +7973,7 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l12 = - *ptr0.add(24).cast::<*mut u8>(); + let l12 = *ptr0.add(24).cast::<*mut u8>(); let l13 = *ptr0.add(28).cast::(); let len14 = l13; let bytes14 = _rt::Vec::from_raw_parts( @@ -7354,7 +7981,6 @@ pub mod wasi { len14, len14, ); - _rt::string_lift(bytes14) }; Some(e) @@ -7370,13 +7996,11 @@ pub mod wasi { 17 => { let e64 = { let l15 = i32::from(*ptr0.add(16).cast::()); - match l15 { 0 => None, 1 => { let e = { let l16 = *ptr0.add(24).cast::(); - l16 as u64 }; Some(e) @@ -7392,13 +8016,11 @@ pub mod wasi { 21 => { let e64 = { let l17 = i32::from(*ptr0.add(16).cast::()); - match l17 { 0 => None, 1 => { let e = { let l18 = *ptr0.add(20).cast::(); - l18 as u32 }; Some(e) @@ -7411,54 +8033,41 @@ pub mod wasi { 22 => { let e64 = { let l19 = i32::from(*ptr0.add(16).cast::()); - match l19 { 0 => None, 1 => { let e = { - let l20 = - i32::from(*ptr0.add(20).cast::()); - let l24 = - i32::from(*ptr0.add(32).cast::()); - + let l20 = i32::from(*ptr0.add(20).cast::()); + let l24 = i32::from(*ptr0.add(32).cast::()); FieldSizePayload { field_name: match l20 { 0 => None, 1 => { let e = { - let l21 = *ptr0 - .add(24) - .cast::<*mut u8>( - ); - let l22 = *ptr0 - .add(28) - .cast::(); + let l21 = *ptr0.add(24).cast::<*mut u8>(); + let l22 = *ptr0.add(28).cast::(); let len23 = l22; - let bytes23 = _rt::Vec::from_raw_parts(l21.cast(), len23, len23); - + let bytes23 = _rt::Vec::from_raw_parts( + l21.cast(), + len23, + len23, + ); _rt::string_lift(bytes23) }; Some(e) } - _ => { - _rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), }, field_size: match l24 { 0 => None, 1 => { let e = { - let l25 = *ptr0 - .add(36) - .cast::(); - + let l25 = *ptr0.add(36).cast::(); l25 as u32 }; Some(e) } - _ => { - _rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -7472,13 +8081,11 @@ pub mod wasi { 23 => { let e64 = { let l26 = i32::from(*ptr0.add(16).cast::()); - match l26 { 0 => None, 1 => { let e = { let l27 = *ptr0.add(20).cast::(); - l27 as u32 }; Some(e) @@ -7492,14 +8099,12 @@ pub mod wasi { let e64 = { let l28 = i32::from(*ptr0.add(16).cast::()); let l32 = i32::from(*ptr0.add(28).cast::()); - FieldSizePayload { field_name: match l28 { 0 => None, 1 => { let e = { - let l29 = - *ptr0.add(20).cast::<*mut u8>(); + let l29 = *ptr0.add(20).cast::<*mut u8>(); let l30 = *ptr0.add(24).cast::(); let len31 = l30; let bytes31 = _rt::Vec::from_raw_parts( @@ -7507,7 +8112,6 @@ pub mod wasi { len31, len31, ); - _rt::string_lift(bytes31) }; Some(e) @@ -7519,7 +8123,6 @@ pub mod wasi { 1 => { let e = { let l33 = *ptr0.add(32).cast::(); - l33 as u32 }; Some(e) @@ -7534,13 +8137,11 @@ pub mod wasi { 26 => { let e64 = { let l34 = i32::from(*ptr0.add(16).cast::()); - match l34 { 0 => None, 1 => { let e = { let l35 = *ptr0.add(20).cast::(); - l35 as u32 }; Some(e) @@ -7554,14 +8155,12 @@ pub mod wasi { let e64 = { let l36 = i32::from(*ptr0.add(16).cast::()); let l40 = i32::from(*ptr0.add(28).cast::()); - FieldSizePayload { field_name: match l36 { 0 => None, 1 => { let e = { - let l37 = - *ptr0.add(20).cast::<*mut u8>(); + let l37 = *ptr0.add(20).cast::<*mut u8>(); let l38 = *ptr0.add(24).cast::(); let len39 = l38; let bytes39 = _rt::Vec::from_raw_parts( @@ -7569,7 +8168,6 @@ pub mod wasi { len39, len39, ); - _rt::string_lift(bytes39) }; Some(e) @@ -7581,7 +8179,6 @@ pub mod wasi { 1 => { let e = { let l41 = *ptr0.add(32).cast::(); - l41 as u32 }; Some(e) @@ -7595,13 +8192,11 @@ pub mod wasi { 28 => { let e64 = { let l42 = i32::from(*ptr0.add(16).cast::()); - match l42 { 0 => None, 1 => { let e = { let l43 = *ptr0.add(24).cast::(); - l43 as u64 }; Some(e) @@ -7614,13 +8209,11 @@ pub mod wasi { 29 => { let e64 = { let l44 = i32::from(*ptr0.add(16).cast::()); - match l44 { 0 => None, 1 => { let e = { let l45 = *ptr0.add(20).cast::(); - l45 as u32 }; Some(e) @@ -7634,14 +8227,12 @@ pub mod wasi { let e64 = { let l46 = i32::from(*ptr0.add(16).cast::()); let l50 = i32::from(*ptr0.add(28).cast::()); - FieldSizePayload { field_name: match l46 { 0 => None, 1 => { let e = { - let l47 = - *ptr0.add(20).cast::<*mut u8>(); + let l47 = *ptr0.add(20).cast::<*mut u8>(); let l48 = *ptr0.add(24).cast::(); let len49 = l48; let bytes49 = _rt::Vec::from_raw_parts( @@ -7649,7 +8240,6 @@ pub mod wasi { len49, len49, ); - _rt::string_lift(bytes49) }; Some(e) @@ -7661,7 +8251,6 @@ pub mod wasi { 1 => { let e = { let l51 = *ptr0.add(32).cast::(); - l51 as u32 }; Some(e) @@ -7675,7 +8264,6 @@ pub mod wasi { 31 => { let e64 = { let l52 = i32::from(*ptr0.add(16).cast::()); - match l52 { 0 => None, 1 => { @@ -7688,7 +8276,6 @@ pub mod wasi { len55, len55, ); - _rt::string_lift(bytes55) }; Some(e) @@ -7701,7 +8288,6 @@ pub mod wasi { 32 => { let e64 = { let l56 = i32::from(*ptr0.add(16).cast::()); - match l56 { 0 => None, 1 => { @@ -7714,7 +8300,6 @@ pub mod wasi { len59, len59, ); - _rt::string_lift(bytes59) }; Some(e) @@ -7733,7 +8318,6 @@ pub mod wasi { debug_assert_eq!(n, 38, "invalid enum discriminant"); let e64 = { let l60 = i32::from(*ptr0.add(16).cast::()); - match l60 { 0 => None, 1 => { @@ -7746,7 +8330,6 @@ pub mod wasi { len63, len63, ); - _rt::string_lift(bytes63) }; Some(e) @@ -7757,7 +8340,6 @@ pub mod wasi { ErrorCode::InternalError(e64) } }; - v64 }; Some(e) @@ -7774,17 +8356,13 @@ pub mod wasi { pub mod error { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; - #[derive(Debug)] #[repr(transparent)] pub struct Error { handle: _rt::Resource, } - impl Error { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -7792,24 +8370,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for Error { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:io/error@0.2.0")] @@ -7817,19 +8391,19 @@ pub mod wasi { #[link_name = "[resource-drop]error"] fn drop(_: u32); } - drop(_handle); } } } - impl Error { #[allow(unused_unsafe, clippy::all)] pub fn to_debug_string(&self) -> _rt::String { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/error@0.2.0")] @@ -7837,7 +8411,6 @@ pub mod wasi { #[link_name = "[method]error.to-debug-string"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -7852,22 +8425,17 @@ pub mod wasi { } } } - #[allow(dead_code, clippy::all)] pub mod poll { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; - #[derive(Debug)] #[repr(transparent)] pub struct Pollable { handle: _rt::Resource, } - impl Pollable { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -7875,24 +8443,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for Pollable { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:io/poll@0.2.0")] @@ -7900,12 +8464,10 @@ pub mod wasi { #[link_name = "[resource-drop]pollable"] fn drop(_: u32); } - drop(_handle); } } } - impl Pollable { #[allow(unused_unsafe, clippy::all)] pub fn ready(&self) -> bool { @@ -7916,7 +8478,6 @@ pub mod wasi { #[link_name = "[method]pollable.ready"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() @@ -7936,7 +8497,6 @@ pub mod wasi { #[link_name = "[method]pollable.block"] fn wit_import(_: i32); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) { unreachable!() @@ -7953,7 +8513,10 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let vec0 = in_; let len0 = vec0.len(); - let layout0 = _rt::alloc::Layout::from_size_align_unchecked(vec0.len() * 4, 4); + let layout0 = _rt::alloc::Layout::from_size_align_unchecked( + vec0.len() * 4, + 4, + ); let result0 = if layout0.size() != 0 { let ptr = _rt::alloc::alloc(layout0).cast::(); if ptr.is_null() { @@ -7961,9 +8524,7 @@ pub mod wasi { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec0.into_iter().enumerate() { let base = result0.add(i * 4); @@ -7978,7 +8539,6 @@ pub mod wasi { #[link_name = "poll"] fn wit_import(_: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -7994,14 +8554,11 @@ pub mod wasi { } } } - #[allow(dead_code, clippy::all)] pub mod streams { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type Error = super::super::super::wasi::io0_2_0::error::Error; pub type Pollable = super::super::super::wasi::io0_2_0::poll::Pollable; @@ -8010,30 +8567,36 @@ pub mod wasi { Closed, } impl ::core::fmt::Debug for StreamError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - StreamError::LastOperationFailed(e) => f - .debug_tuple("StreamError::LastOperationFailed") - .field(e) - .finish(), - StreamError::Closed => f.debug_tuple("StreamError::Closed").finish(), + StreamError::LastOperationFailed(e) => { + f.debug_tuple("StreamError::LastOperationFailed") + .field(e) + .finish() + } + StreamError::Closed => { + f.debug_tuple("StreamError::Closed").finish() + } } } } impl ::core::fmt::Display for StreamError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for StreamError {} - #[derive(Debug)] #[repr(transparent)] pub struct InputStream { handle: _rt::Resource, } - impl InputStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -8041,24 +8604,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for InputStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8066,18 +8625,15 @@ pub mod wasi { #[link_name = "[resource-drop]input-stream"] fn drop(_: u32); } - drop(_handle); } } } - #[derive(Debug)] #[repr(transparent)] pub struct OutputStream { handle: _rt::Resource, } - impl OutputStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -8085,24 +8641,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for OutputStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8110,19 +8662,19 @@ pub mod wasi { #[link_name = "[resource-drop]output-stream"] fn drop(_: u32); } - drop(_handle); } } } - impl InputStream { #[allow(unused_unsafe, clippy::all)] pub fn read(&self, len: u64) -> Result<_rt::Vec, StreamError> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8130,7 +8682,6 @@ pub mod wasi { #[link_name = "[method]input-stream.read"] fn wit_import(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() @@ -8143,7 +8694,6 @@ pub mod wasi { let l2 = *ptr0.add(4).cast::<*mut u8>(); let l3 = *ptr0.add(8).cast::(); let len4 = l3; - _rt::Vec::from_raw_parts(l2.cast(), len4, len4) }; Ok(e) @@ -8155,8 +8705,9 @@ pub mod wasi { 0 => { let e7 = { let l6 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l6 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l6 as u32, + ) }; StreamError::LastOperationFailed(e7) } @@ -8165,7 +8716,6 @@ pub mod wasi { StreamError::Closed } }; - v7 }; Err(e) @@ -8177,11 +8727,16 @@ pub mod wasi { } impl InputStream { #[allow(unused_unsafe, clippy::all)] - pub fn blocking_read(&self, len: u64) -> Result<_rt::Vec, StreamError> { + pub fn blocking_read( + &self, + len: u64, + ) -> Result<_rt::Vec, StreamError> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8189,7 +8744,6 @@ pub mod wasi { #[link_name = "[method]input-stream.blocking-read"] fn wit_import(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() @@ -8202,7 +8756,6 @@ pub mod wasi { let l2 = *ptr0.add(4).cast::<*mut u8>(); let l3 = *ptr0.add(8).cast::(); let len4 = l3; - _rt::Vec::from_raw_parts(l2.cast(), len4, len4) }; Ok(e) @@ -8214,8 +8767,9 @@ pub mod wasi { 0 => { let e7 = { let l6 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l6 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l6 as u32, + ) }; StreamError::LastOperationFailed(e7) } @@ -8224,7 +8778,6 @@ pub mod wasi { StreamError::Closed } }; - v7 }; Err(e) @@ -8240,7 +8793,9 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8248,7 +8803,6 @@ pub mod wasi { #[link_name = "[method]input-stream.skip"] fn wit_import(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() @@ -8259,7 +8813,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(8).cast::(); - l2 as u64 }; Ok(e) @@ -8271,8 +8824,9 @@ pub mod wasi { 0 => { let e5 = { let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l4 as u32, + ) }; StreamError::LastOperationFailed(e5) } @@ -8281,7 +8835,6 @@ pub mod wasi { StreamError::Closed } }; - v5 }; Err(e) @@ -8297,7 +8850,9 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8305,7 +8860,6 @@ pub mod wasi { #[link_name = "[method]input-stream.blocking-skip"] fn wit_import(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() @@ -8316,7 +8870,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(8).cast::(); - l2 as u64 }; Ok(e) @@ -8328,8 +8881,9 @@ pub mod wasi { 0 => { let e5 = { let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l4 as u32, + ) }; StreamError::LastOperationFailed(e5) } @@ -8338,7 +8892,6 @@ pub mod wasi { StreamError::Closed } }; - v5 }; Err(e) @@ -8358,13 +8911,14 @@ pub mod wasi { #[link_name = "[method]input-stream.subscribe"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() } let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle( + ret as u32, + ) } } } @@ -8374,7 +8928,9 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8382,7 +8938,6 @@ pub mod wasi { #[link_name = "[method]output-stream.check-write"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -8393,7 +8948,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(8).cast::(); - l2 as u64 }; Ok(e) @@ -8405,8 +8959,9 @@ pub mod wasi { 0 => { let e5 = { let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l4 as u32, + ) }; StreamError::LastOperationFailed(e5) } @@ -8415,7 +8970,6 @@ pub mod wasi { StreamError::Closed } }; - v5 }; Err(e) @@ -8431,7 +8985,9 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let vec0 = contents; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -8442,7 +8998,6 @@ pub mod wasi { #[link_name = "[method]output-stream.write"] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -8461,8 +9016,9 @@ pub mod wasi { 0 => { let e5 = { let l4 = *ptr1.add(8).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l4 as u32, + ) }; StreamError::LastOperationFailed(e5) } @@ -8471,7 +9027,6 @@ pub mod wasi { StreamError::Closed } }; - v5 }; Err(e) @@ -8483,11 +9038,16 @@ pub mod wasi { } impl OutputStream { #[allow(unused_unsafe, clippy::all)] - pub fn blocking_write_and_flush(&self, contents: &[u8]) -> Result<(), StreamError> { + pub fn blocking_write_and_flush( + &self, + contents: &[u8], + ) -> Result<(), StreamError> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let vec0 = contents; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -8498,7 +9058,6 @@ pub mod wasi { #[link_name = "[method]output-stream.blocking-write-and-flush"] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() @@ -8517,8 +9076,9 @@ pub mod wasi { 0 => { let e5 = { let l4 = *ptr1.add(8).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l4 as u32, + ) }; StreamError::LastOperationFailed(e5) } @@ -8527,7 +9087,6 @@ pub mod wasi { StreamError::Closed } }; - v5 }; Err(e) @@ -8543,7 +9102,9 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8551,7 +9112,6 @@ pub mod wasi { #[link_name = "[method]output-stream.flush"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -8570,8 +9130,9 @@ pub mod wasi { 0 => { let e4 = { let l3 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l3 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l3 as u32, + ) }; StreamError::LastOperationFailed(e4) } @@ -8580,7 +9141,6 @@ pub mod wasi { StreamError::Closed } }; - v4 }; Err(e) @@ -8596,7 +9156,9 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8604,7 +9166,6 @@ pub mod wasi { #[link_name = "[method]output-stream.blocking-flush"] fn wit_import(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: *mut u8) { unreachable!() @@ -8623,8 +9184,9 @@ pub mod wasi { 0 => { let e4 = { let l3 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l3 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l3 as u32, + ) }; StreamError::LastOperationFailed(e4) } @@ -8633,7 +9195,6 @@ pub mod wasi { StreamError::Closed } }; - v4 }; Err(e) @@ -8653,13 +9214,14 @@ pub mod wasi { #[link_name = "[method]output-stream.subscribe"] fn wit_import(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32) -> i32 { unreachable!() } let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle( + ret as u32, + ) } } } @@ -8669,7 +9231,9 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8677,7 +9241,6 @@ pub mod wasi { #[link_name = "[method]output-stream.write-zeroes"] fn wit_import(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() @@ -8696,8 +9259,9 @@ pub mod wasi { 0 => { let e4 = { let l3 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l3 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l3 as u32, + ) }; StreamError::LastOperationFailed(e4) } @@ -8706,7 +9270,6 @@ pub mod wasi { StreamError::Closed } }; - v4 }; Err(e) @@ -8718,11 +9281,16 @@ pub mod wasi { } impl OutputStream { #[allow(unused_unsafe, clippy::all)] - pub fn blocking_write_zeroes_and_flush(&self, len: u64) -> Result<(), StreamError> { + pub fn blocking_write_zeroes_and_flush( + &self, + len: u64, + ) -> Result<(), StreamError> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8730,7 +9298,6 @@ pub mod wasi { #[link_name = "[method]output-stream.blocking-write-zeroes-and-flush"] fn wit_import(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() @@ -8749,8 +9316,9 @@ pub mod wasi { 0 => { let e4 = { let l3 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l3 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l3 as u32, + ) }; StreamError::LastOperationFailed(e4) } @@ -8759,7 +9327,6 @@ pub mod wasi { StreamError::Closed } }; - v4 }; Err(e) @@ -8771,11 +9338,17 @@ pub mod wasi { } impl OutputStream { #[allow(unused_unsafe, clippy::all)] - pub fn splice(&self, src: &InputStream, len: u64) -> Result { + pub fn splice( + &self, + src: &InputStream, + len: u64, + ) -> Result { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8783,7 +9356,6 @@ pub mod wasi { #[link_name = "[method]output-stream.splice"] fn wit_import(_: i32, _: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) { unreachable!() @@ -8799,7 +9371,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(8).cast::(); - l2 as u64 }; Ok(e) @@ -8811,8 +9382,9 @@ pub mod wasi { 0 => { let e5 = { let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l4 as u32, + ) }; StreamError::LastOperationFailed(e5) } @@ -8821,7 +9393,6 @@ pub mod wasi { StreamError::Closed } }; - v5 }; Err(e) @@ -8841,7 +9412,9 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -8849,7 +9422,6 @@ pub mod wasi { #[link_name = "[method]output-stream.blocking-splice"] fn wit_import(_: i32, _: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) { unreachable!() @@ -8865,7 +9437,6 @@ pub mod wasi { 0 => { let e = { let l2 = *ptr0.add(8).cast::(); - l2 as u64 }; Ok(e) @@ -8877,8 +9448,9 @@ pub mod wasi { 0 => { let e5 = { let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + super::super::super::wasi::io0_2_0::error::Error::from_handle( + l4 as u32, + ) }; StreamError::LastOperationFailed(e5) } @@ -8887,7 +9459,6 @@ pub mod wasi { StreamError::Closed } }; - v5 }; Err(e) @@ -8905,17 +9476,16 @@ pub mod wasi { pub mod network { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; - + /// An opaque resource that represents access to (a subset of) the network. + /// This enables context-based security for networking. + /// There is no need for this to map 1:1 to a physical network interface. #[derive(Debug)] #[repr(transparent)] pub struct Network { handle: _rt::Resource, } - impl Network { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -8923,24 +9493,20 @@ pub mod wasi { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } } - unsafe impl _rt::WasmResource for Network { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link(wasm_import_module = "wasi:sockets/network@0.2.0")] @@ -8948,35 +9514,83 @@ pub mod wasi { #[link_name = "[resource-drop]network"] fn drop(_: u32); } - drop(_handle); } } } - + /// Error codes. + /// + /// In theory, every API can return any error code. + /// In practice, API's typically only return the errors documented per API + /// combined with a couple of errors that are always possible: + /// - `unknown` + /// - `access-denied` + /// - `not-supported` + /// - `out-of-memory` + /// - `concurrency-conflict` + /// + /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum ErrorCode { + /// Unknown error Unknown, + /// Access denied. + /// + /// POSIX equivalent: EACCES, EPERM AccessDenied, + /// The operation is not supported. + /// + /// POSIX equivalent: EOPNOTSUPP NotSupported, + /// One of the arguments is invalid. + /// + /// POSIX equivalent: EINVAL InvalidArgument, + /// Not enough memory to complete the operation. + /// + /// POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY OutOfMemory, + /// The operation timed out before it could finish completely. Timeout, + /// This operation is incompatible with another asynchronous operation that is already in progress. + /// + /// POSIX equivalent: EALREADY ConcurrencyConflict, + /// Trying to finish an asynchronous operation that: + /// - has not been started yet, or: + /// - was already finished by a previous `finish-*` call. + /// + /// Note: this is scheduled to be removed when `future`s are natively supported. NotInProgress, + /// The operation has been aborted because it could not be completed immediately. + /// + /// Note: this is scheduled to be removed when `future`s are natively supported. WouldBlock, + /// The operation is not valid in the socket's current state. InvalidState, + /// A new socket resource could not be created because of a system limit. NewSocketLimit, + /// A bind operation failed because the provided address is not an address that the `network` can bind to. AddressNotBindable, + /// A bind operation failed because the provided address is already in use or because there are no ephemeral ports available. AddressInUse, + /// The remote address is not reachable RemoteUnreachable, + /// The TCP connection was forcefully rejected ConnectionRefused, + /// The TCP connection was reset. ConnectionReset, + /// A TCP connection was aborted. ConnectionAborted, + /// The size of a datagram sent to a UDP socket exceeded the maximum + /// supported size. DatagramTooLarge, + /// Name does not exist or has no suitable associated IP addresses. NameUnresolvable, + /// A temporary failure in name resolution occurred. TemporaryResolverFailure, + /// A permanent failure in name resolution occurred. PermanentResolverFailure, } impl ErrorCode { @@ -9001,38 +9615,98 @@ pub mod wasi { ErrorCode::ConnectionAborted => "connection-aborted", ErrorCode::DatagramTooLarge => "datagram-too-large", ErrorCode::NameUnresolvable => "name-unresolvable", - ErrorCode::TemporaryResolverFailure => "temporary-resolver-failure", - ErrorCode::PermanentResolverFailure => "permanent-resolver-failure", + ErrorCode::TemporaryResolverFailure => { + "temporary-resolver-failure" + } + ErrorCode::PermanentResolverFailure => { + "permanent-resolver-failure" + } } } pub fn message(&self) -> &'static str { match self { - ErrorCode::Unknown => "", - ErrorCode::AccessDenied => "", - ErrorCode::NotSupported => "", - ErrorCode::InvalidArgument => "", - ErrorCode::OutOfMemory => "", - ErrorCode::Timeout => "", - ErrorCode::ConcurrencyConflict => "", - ErrorCode::NotInProgress => "", - ErrorCode::WouldBlock => "", - ErrorCode::InvalidState => "", - ErrorCode::NewSocketLimit => "", - ErrorCode::AddressNotBindable => "", - ErrorCode::AddressInUse => "", - ErrorCode::RemoteUnreachable => "", - ErrorCode::ConnectionRefused => "", - ErrorCode::ConnectionReset => "", - ErrorCode::ConnectionAborted => "", - ErrorCode::DatagramTooLarge => "", - ErrorCode::NameUnresolvable => "", - ErrorCode::TemporaryResolverFailure => "", - ErrorCode::PermanentResolverFailure => "", + ErrorCode::Unknown => "Unknown error", + ErrorCode::AccessDenied => { + "Access denied. + + POSIX equivalent: EACCES, EPERM" + } + ErrorCode::NotSupported => { + "The operation is not supported. + + POSIX equivalent: EOPNOTSUPP" + } + ErrorCode::InvalidArgument => { + "One of the arguments is invalid. + + POSIX equivalent: EINVAL" + } + ErrorCode::OutOfMemory => { + "Not enough memory to complete the operation. + + POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY" + } + ErrorCode::Timeout => { + "The operation timed out before it could finish completely." + } + ErrorCode::ConcurrencyConflict => { + "This operation is incompatible with another asynchronous operation that is already in progress. + + POSIX equivalent: EALREADY" + } + ErrorCode::NotInProgress => { + "Trying to finish an asynchronous operation that: + - has not been started yet, or: + - was already finished by a previous `finish-*` call. + + Note: this is scheduled to be removed when `future`s are natively supported." + } + ErrorCode::WouldBlock => { + "The operation has been aborted because it could not be completed immediately. + + Note: this is scheduled to be removed when `future`s are natively supported." + } + ErrorCode::InvalidState => { + "The operation is not valid in the socket's current state." + } + ErrorCode::NewSocketLimit => { + "A new socket resource could not be created because of a system limit." + } + ErrorCode::AddressNotBindable => { + "A bind operation failed because the provided address is not an address that the `network` can bind to." + } + ErrorCode::AddressInUse => { + "A bind operation failed because the provided address is already in use or because there are no ephemeral ports available." + } + ErrorCode::RemoteUnreachable => { + "The remote address is not reachable" + } + ErrorCode::ConnectionRefused => { + "The TCP connection was forcefully rejected" + } + ErrorCode::ConnectionReset => "The TCP connection was reset.", + ErrorCode::ConnectionAborted => "A TCP connection was aborted.", + ErrorCode::DatagramTooLarge => { + "The size of a datagram sent to a UDP socket exceeded the maximum + supported size." + } + ErrorCode::NameUnresolvable => { + "Name does not exist or has no suitable associated IP addresses." + } + ErrorCode::TemporaryResolverFailure => { + "A temporary failure in name resolution occurred." + } + ErrorCode::PermanentResolverFailure => { + "A permanent failure in name resolution occurred." + } } } } impl ::core::fmt::Debug for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("ErrorCode") .field("code", &(*self as i32)) .field("name", &self.name()) @@ -9041,20 +9715,20 @@ pub mod wasi { } } impl ::core::fmt::Display for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - write!(f, "{} (error {})", self.name(), *self as i32) + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { + write!(f, "{} (error {})", self.name(), * self as i32) } } - impl std::error::Error for ErrorCode {} - impl ErrorCode { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> ErrorCode { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => ErrorCode::Unknown, 1 => ErrorCode::AccessDenied, @@ -9077,43 +9751,46 @@ pub mod wasi { 18 => ErrorCode::NameUnresolvable, 19 => ErrorCode::TemporaryResolverFailure, 20 => ErrorCode::PermanentResolverFailure, - _ => panic!("invalid enum discriminant"), } } } - #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum IpAddressFamily { + /// Similar to `AF_INET` in POSIX. Ipv4, + /// Similar to `AF_INET6` in POSIX. Ipv6, } impl ::core::fmt::Debug for IpAddressFamily { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - IpAddressFamily::Ipv4 => f.debug_tuple("IpAddressFamily::Ipv4").finish(), - IpAddressFamily::Ipv6 => f.debug_tuple("IpAddressFamily::Ipv6").finish(), + IpAddressFamily::Ipv4 => { + f.debug_tuple("IpAddressFamily::Ipv4").finish() + } + IpAddressFamily::Ipv6 => { + f.debug_tuple("IpAddressFamily::Ipv6").finish() + } } } } - impl IpAddressFamily { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> IpAddressFamily { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => IpAddressFamily::Ipv4, 1 => IpAddressFamily::Ipv6, - _ => panic!("invalid enum discriminant"), } } } - pub type Ipv4Address = (u8, u8, u8, u8); pub type Ipv6Address = (u16, u16, u16, u16, u16, u16, u16, u16); #[derive(Clone, Copy)] @@ -9122,21 +9799,33 @@ pub mod wasi { Ipv6(Ipv6Address), } impl ::core::fmt::Debug for IpAddress { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - IpAddress::Ipv4(e) => f.debug_tuple("IpAddress::Ipv4").field(e).finish(), - IpAddress::Ipv6(e) => f.debug_tuple("IpAddress::Ipv6").field(e).finish(), + IpAddress::Ipv4(e) => { + f.debug_tuple("IpAddress::Ipv4").field(e).finish() + } + IpAddress::Ipv6(e) => { + f.debug_tuple("IpAddress::Ipv6").field(e).finish() + } } } } #[repr(C)] #[derive(Clone, Copy)] pub struct Ipv4SocketAddress { + /// sin_port pub port: u16, + /// sin_addr pub address: Ipv4Address, } impl ::core::fmt::Debug for Ipv4SocketAddress { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("Ipv4SocketAddress") .field("port", &self.port) .field("address", &self.address) @@ -9146,13 +9835,20 @@ pub mod wasi { #[repr(C)] #[derive(Clone, Copy)] pub struct Ipv6SocketAddress { + /// sin6_port pub port: u16, + /// sin6_flowinfo pub flow_info: u32, + /// sin6_addr pub address: Ipv6Address, + /// sin6_scope_id pub scope_id: u32, } impl ::core::fmt::Debug for Ipv6SocketAddress { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("Ipv6SocketAddress") .field("port", &self.port) .field("flow-info", &self.flow_info) @@ -9167,7 +9863,10 @@ pub mod wasi { Ipv6(Ipv6SocketAddress), } impl ::core::fmt::Debug for IpSocketAddress { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { IpSocketAddress::Ipv4(e) => { f.debug_tuple("IpSocketAddress::Ipv4").field(e).finish() @@ -9191,9 +9890,7 @@ pub mod exports { pub mod llm { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; /// A Large Language Model. pub type InferencingModel = _rt::String; @@ -9217,7 +9914,10 @@ pub mod exports { pub top_p: f32, } impl ::core::fmt::Debug for InferencingParams { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("InferencingParams") .field("max-tokens", &self.max_tokens) .field("repeat-penalty", &self.repeat_penalty) @@ -9239,7 +9939,10 @@ pub mod exports { InvalidInput(_rt::String), } impl ::core::fmt::Debug for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Error::ModelNotSupported => { f.debug_tuple("Error::ModelNotSupported").finish() @@ -9254,11 +9957,13 @@ pub mod exports { } } impl ::core::fmt::Display for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for Error {} /// Usage information related to the inferencing result #[repr(C)] @@ -9270,7 +9975,10 @@ pub mod exports { pub generated_token_count: u32, } impl ::core::fmt::Debug for InferencingUsage { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("InferencingUsage") .field("prompt-token-count", &self.prompt_token_count) .field("generated-token-count", &self.generated_token_count) @@ -9287,7 +9995,10 @@ pub mod exports { pub usage: InferencingUsage, } impl ::core::fmt::Debug for InferencingResult { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("InferencingResult") .field("text", &self.text) .field("usage", &self.usage) @@ -9304,7 +10015,10 @@ pub mod exports { pub prompt_token_count: u32, } impl ::core::fmt::Debug for EmbeddingsUsage { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("EmbeddingsUsage") .field("prompt-token-count", &self.prompt_token_count) .finish() @@ -9319,7 +10033,10 @@ pub mod exports { pub usage: EmbeddingsUsage, } impl ::core::fmt::Debug for EmbeddingsResult { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("EmbeddingsResult") .field("embeddings", &self.embeddings) .field("usage", &self.usage) @@ -9341,8 +10058,7 @@ pub mod exports { arg9: i32, arg10: f32, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg1; let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); let len1 = arg3; @@ -9370,10 +10086,7 @@ pub mod exports { match result2 { Ok(e) => { *ptr3.add(0).cast::() = (0i32) as u8; - let InferencingResult { - text: text4, - usage: usage4, - } = e; + let InferencingResult { text: text4, usage: usage4 } = e; let vec5 = (text4.into_bytes()).into_boxed_slice(); let ptr5 = vec5.as_ptr().cast::(); let len5 = vec5.len(); @@ -9384,8 +10097,12 @@ pub mod exports { prompt_token_count: prompt_token_count6, generated_token_count: generated_token_count6, } = usage4; - *ptr3.add(12).cast::() = _rt::as_i32(prompt_token_count6); - *ptr3.add(16).cast::() = _rt::as_i32(generated_token_count6); + *ptr3.add(12).cast::() = _rt::as_i32( + prompt_token_count6, + ); + *ptr3.add(16).cast::() = _rt::as_i32( + generated_token_count6, + ); } Err(e) => { *ptr3.add(0).cast::() = (1i32) as u8; @@ -9429,7 +10146,7 @@ pub mod exports { _ => { let l3 = i32::from(*arg0.add(4).cast::()); match l3 { - 0 => (), + 0 => {} 1 => { let l4 = *arg0.add(8).cast::<*mut u8>(); let l5 = *arg0.add(12).cast::(); @@ -9452,8 +10169,7 @@ pub mod exports { arg2: *mut u8, arg3: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg1; let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); let base4 = arg2; @@ -9466,13 +10182,15 @@ pub mod exports { let l2 = *base.add(4).cast::(); let len3 = l2; let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); - _rt::string_lift(bytes3) }; result4.push(e4); } _rt::cabi_dealloc(base4, len4 * 8, 4); - let result5 = T::generate_embeddings(_rt::string_lift(bytes0), result4); + let result5 = T::generate_embeddings( + _rt::string_lift(bytes0), + result4, + ); let ptr6 = _RET_AREA.0.as_mut_ptr().cast::(); match result5 { Ok(e) => { @@ -9483,8 +10201,10 @@ pub mod exports { } = e; let vec9 = embeddings7; let len9 = vec9.len(); - let layout9 = - _rt::alloc::Layout::from_size_align_unchecked(vec9.len() * 8, 4); + let layout9 = _rt::alloc::Layout::from_size_align_unchecked( + vec9.len() * 8, + 4, + ); let result9 = if layout9.size() != 0 { let ptr = _rt::alloc::alloc(layout9).cast::(); if ptr.is_null() { @@ -9492,9 +10212,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec9.into_iter().enumerate() { let base = result9.add(i * 8); @@ -9512,7 +10230,9 @@ pub mod exports { let EmbeddingsUsage { prompt_token_count: prompt_token_count10, } = usage7; - *ptr6.add(12).cast::() = _rt::as_i32(prompt_token_count10); + *ptr6.add(12).cast::() = _rt::as_i32( + prompt_token_count10, + ); } Err(e) => { *ptr6.add(0).cast::() = (1i32) as u8; @@ -9545,22 +10265,24 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_generate_embeddings(arg0: *mut u8) { + pub unsafe fn __post_return_generate_embeddings( + arg0: *mut u8, + ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { 0 => { - let l4 = *arg0.add(4).cast::<*mut u8>(); - let l5 = *arg0.add(8).cast::(); - let base6 = l4; - let len6 = l5; + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base6 = l1; + let len6 = l2; for i in 0..len6 { let base = base6.add(i * 8); { - let l1 = *base.add(0).cast::<*mut u8>(); - let l2 = *base.add(4).cast::(); - let base3 = l1; - let len3 = l2; - _rt::cabi_dealloc(base3, len3 * 4, 4); + let l3 = *base.add(0).cast::<*mut u8>(); + let l4 = *base.add(4).cast::(); + let base5 = l3; + let len5 = l4; + _rt::cabi_dealloc(base5, len5 * 4, 4); } } _rt::cabi_dealloc(base6, len6 * 8, 4); @@ -9568,7 +10290,7 @@ pub mod exports { _ => { let l7 = i32::from(*arg0.add(4).cast::()); match l7 { - 0 => (), + 0 => {} 1 => { let l8 = *arg0.add(8).cast::<*mut u8>(); let l9 = *arg0.add(12).cast::(); @@ -9597,42 +10319,41 @@ pub mod exports { ) -> Result; } #[doc(hidden)] - - macro_rules! __export_fermyon_spin_llm_2_0_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "fermyon:spin/llm@2.0.0#infer"] - unsafe extern "C" fn export_infer(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,arg4: i32,arg5: i32,arg6: f32,arg7: i32,arg8: f32,arg9: i32,arg10: f32,) -> *mut u8 { - $($path_to_types)*::_export_infer_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) - } - #[export_name = "cabi_post_fermyon:spin/llm@2.0.0#infer"] - unsafe extern "C" fn _post_return_infer(arg0: *mut u8,) { - $($path_to_types)*::__post_return_infer::<$ty>(arg0) - } - #[export_name = "fermyon:spin/llm@2.0.0#generate-embeddings"] - unsafe extern "C" fn export_generate_embeddings(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,) -> *mut u8 { - $($path_to_types)*::_export_generate_embeddings_cabi::<$ty>(arg0, arg1, arg2, arg3) - } - #[export_name = "cabi_post_fermyon:spin/llm@2.0.0#generate-embeddings"] - unsafe extern "C" fn _post_return_generate_embeddings(arg0: *mut u8,) { - $($path_to_types)*::__post_return_generate_embeddings::<$ty>(arg0) - } - };); - } + macro_rules! __export_fermyon_spin_llm_2_0_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = "fermyon:spin/llm@2.0.0#infer"] + unsafe extern "C" fn export_infer(arg0 : * mut u8, arg1 : usize, + arg2 : * mut u8, arg3 : usize, arg4 : i32, arg5 : i32, arg6 : + f32, arg7 : i32, arg8 : f32, arg9 : i32, arg10 : f32,) -> * mut + u8 { $($path_to_types)*:: _export_infer_cabi::<$ty > (arg0, arg1, + arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) } + #[export_name = "cabi_post_fermyon:spin/llm@2.0.0#infer"] unsafe + extern "C" fn _post_return_infer(arg0 : * mut u8,) { + $($path_to_types)*:: __post_return_infer::<$ty > (arg0) } + #[export_name = "fermyon:spin/llm@2.0.0#generate-embeddings"] + unsafe extern "C" fn export_generate_embeddings(arg0 : * mut u8, + arg1 : usize, arg2 : * mut u8, arg3 : usize,) -> * mut u8 { + $($path_to_types)*:: _export_generate_embeddings_cabi::<$ty > + (arg0, arg1, arg2, arg3) } #[export_name = + "cabi_post_fermyon:spin/llm@2.0.0#generate-embeddings"] unsafe + extern "C" fn _post_return_generate_embeddings(arg0 : * mut u8,) + { $($path_to_types)*:: __post_return_generate_embeddings::<$ty > + (arg0) } }; + }; + } #[doc(hidden)] pub(crate) use __export_fermyon_spin_llm_2_0_0_cabi; #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 20]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 20]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 20], + ); } - #[allow(dead_code, clippy::all)] pub mod redis { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; /// Errors related to interacting with Redis #[derive(Clone)] @@ -9647,7 +10368,10 @@ pub mod exports { Other(_rt::String), } impl ::core::fmt::Debug for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Error::InvalidAddress => { f.debug_tuple("Error::InvalidAddress").finish() @@ -9655,27 +10379,30 @@ pub mod exports { Error::TooManyConnections => { f.debug_tuple("Error::TooManyConnections").finish() } - Error::TypeError => f.debug_tuple("Error::TypeError").finish(), - Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + Error::TypeError => { + f.debug_tuple("Error::TypeError").finish() + } + Error::Other(e) => { + f.debug_tuple("Error::Other").field(e).finish() + } } } } impl ::core::fmt::Display for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for Error {} - #[derive(Debug)] #[repr(transparent)] pub struct Connection { handle: _rt::Resource, } - type _ConnectionRep = Option; - impl Connection { /// Creates a new resource from the specified representation. /// @@ -9685,77 +10412,68 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _ConnectionRep = Some(val); - let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestConnection` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); } - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`Connection`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -9764,7 +10482,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a Connection>, } - impl<'a> ConnectionBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -9773,41 +10490,34 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for Connection { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/redis@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/redis@2.0.0" + )] extern "C" { #[link_name = "[resource-drop]connection"] fn drop(_: u32); } - drop(_handle); } } } - /// The message payload. pub type Payload = _rt::Vec; /// A parameter type for the general-purpose `execute` function. @@ -9817,7 +10527,10 @@ pub mod exports { Binary(Payload), } impl ::core::fmt::Debug for RedisParameter { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { RedisParameter::Int64(e) => { f.debug_tuple("RedisParameter::Int64").field(e).finish() @@ -9837,9 +10550,14 @@ pub mod exports { Binary(Payload), } impl ::core::fmt::Debug for RedisResult { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - RedisResult::Nil => f.debug_tuple("RedisResult::Nil").finish(), + RedisResult::Nil => { + f.debug_tuple("RedisResult::Nil").finish() + } RedisResult::Status(e) => { f.debug_tuple("RedisResult::Status").field(e).finish() } @@ -9858,8 +10576,7 @@ pub mod exports { arg0: *mut u8, arg1: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg1; let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); let result1 = T::open(_rt::string_lift(bytes0)); @@ -9902,13 +10619,13 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -9927,8 +10644,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let len1 = arg4; @@ -9970,18 +10686,18 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_connection_publish( - arg0: *mut u8, - ) { + pub unsafe fn __post_return_method_connection_publish< + T: GuestConnection, + >(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -9998,8 +10714,7 @@ pub mod exports { arg1: *mut u8, arg2: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let result1 = T::get( @@ -10061,7 +10776,7 @@ pub mod exports { 0 => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), + 0 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -10074,9 +10789,9 @@ pub mod exports { _ => { let l5 = i32::from(*arg0.add(4).cast::()); match l5 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l6 = *arg0.add(8).cast::<*mut u8>(); let l7 = *arg0.add(12).cast::(); @@ -10095,8 +10810,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let len1 = arg4; @@ -10143,13 +10857,13 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -10166,8 +10880,7 @@ pub mod exports { arg1: *mut u8, arg2: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let result1 = T::incr( @@ -10213,13 +10926,13 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(8).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(12).cast::<*mut u8>(); let l3 = *arg0.add(16).cast::(); @@ -10236,8 +10949,7 @@ pub mod exports { arg1: *mut u8, arg2: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let base3 = arg1; let len3 = arg2; let mut result3 = _rt::Vec::with_capacity(len3); @@ -10248,14 +10960,15 @@ pub mod exports { let l1 = *base.add(4).cast::(); let len2 = l1; let bytes2 = _rt::Vec::from_raw_parts(l0.cast(), len2, len2); - _rt::string_lift(bytes2) }; result3.push(e3); } _rt::cabi_dealloc(base3, len3 * 8, 4); - let result4 = - T::del(ConnectionBorrow::lift(arg0 as u32 as usize).get(), result3); + let result4 = T::del( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + result3, + ); let ptr5 = _RET_AREA.0.as_mut_ptr().cast::(); match result4 { Ok(e) => { @@ -10295,13 +11008,13 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -10320,8 +11033,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let base4 = arg3; @@ -10334,7 +11046,6 @@ pub mod exports { let l2 = *base.add(4).cast::(); let len3 = l2; let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); - _rt::string_lift(bytes3) }; result4.push(e4); @@ -10384,13 +11095,13 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -10402,13 +11113,10 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_connection_smembers_cabi( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + pub unsafe fn _export_method_connection_smembers_cabi< + T: GuestConnection, + >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let result1 = T::smembers( @@ -10421,8 +11129,10 @@ pub mod exports { *ptr2.add(0).cast::() = (0i32) as u8; let vec4 = e; let len4 = vec4.len(); - let layout4 = - _rt::alloc::Layout::from_size_align_unchecked(vec4.len() * 8, 4); + let layout4 = _rt::alloc::Layout::from_size_align_unchecked( + vec4.len() * 8, + 4, + ); let result4 = if layout4.size() != 0 { let ptr = _rt::alloc::alloc(layout4).cast::(); if ptr.is_null() { @@ -10430,9 +11140,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec4.into_iter().enumerate() { let base = result4.add(i * 8); @@ -10476,22 +11184,22 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_connection_smembers( - arg0: *mut u8, - ) { + pub unsafe fn __post_return_method_connection_smembers< + T: GuestConnection, + >(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { 0 => { - let l3 = *arg0.add(4).cast::<*mut u8>(); - let l4 = *arg0.add(8).cast::(); - let base5 = l3; - let len5 = l4; + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base5 = l1; + let len5 = l2; for i in 0..len5 { let base = base5.add(i * 8); { - let l1 = *base.add(0).cast::<*mut u8>(); - let l2 = *base.add(4).cast::(); - _rt::cabi_dealloc(l1, l2, 1); + let l3 = *base.add(0).cast::<*mut u8>(); + let l4 = *base.add(4).cast::(); + _rt::cabi_dealloc(l3, l4, 1); } } _rt::cabi_dealloc(base5, len5 * 8, 4); @@ -10499,9 +11207,9 @@ pub mod exports { _ => { let l6 = i32::from(*arg0.add(4).cast::()); match l6 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l7 = *arg0.add(8).cast::<*mut u8>(); let l8 = *arg0.add(12).cast::(); @@ -10520,8 +11228,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let base4 = arg3; @@ -10534,7 +11241,6 @@ pub mod exports { let l2 = *base.add(4).cast::(); let len3 = l2; let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); - _rt::string_lift(bytes3) }; result4.push(e4); @@ -10584,13 +11290,13 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -10609,8 +11315,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let base7 = arg3; @@ -10624,7 +11329,6 @@ pub mod exports { 0 => { let e6 = { let l2 = *base.add(8).cast::(); - l2 }; RedisParameter::Int64(e6) @@ -10635,13 +11339,11 @@ pub mod exports { let l3 = *base.add(8).cast::<*mut u8>(); let l4 = *base.add(12).cast::(); let len5 = l4; - _rt::Vec::from_raw_parts(l3.cast(), len5, len5) }; RedisParameter::Binary(e6) } }; - v6 }; result7.push(e7); @@ -10658,8 +11360,10 @@ pub mod exports { *ptr9.add(0).cast::() = (0i32) as u8; let vec12 = e; let len12 = vec12.len(); - let layout12 = - _rt::alloc::Layout::from_size_align_unchecked(vec12.len() * 16, 8); + let layout12 = _rt::alloc::Layout::from_size_align_unchecked( + vec12.len() * 16, + 8, + ); let result12 = if layout12.size() != 0 { let ptr = _rt::alloc::alloc(layout12).cast::(); if ptr.is_null() { @@ -10667,9 +11371,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec12.into_iter().enumerate() { let base = result12.add(i * 16); @@ -10734,34 +11436,34 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_connection_execute( - arg0: *mut u8, - ) { + pub unsafe fn __post_return_method_connection_execute< + T: GuestConnection, + >(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { 0 => { - let l7 = *arg0.add(4).cast::<*mut u8>(); - let l8 = *arg0.add(8).cast::(); - let base9 = l7; - let len9 = l8; + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base9 = l1; + let len9 = l2; for i in 0..len9 { let base = base9.add(i * 16); { - let l1 = i32::from(*base.add(0).cast::()); - match l1 { - 0 => (), + let l3 = i32::from(*base.add(0).cast::()); + match l3 { + 0 => {} 1 => { - let l2 = *base.add(8).cast::<*mut u8>(); - let l3 = *base.add(12).cast::(); - _rt::cabi_dealloc(l2, l3, 1); - } - 2 => (), - _ => { let l4 = *base.add(8).cast::<*mut u8>(); let l5 = *base.add(12).cast::(); - let base6 = l4; - let len6 = l5; - _rt::cabi_dealloc(base6, len6 * 1, 1); + _rt::cabi_dealloc(l4, l5, 1); + } + 2 => {} + _ => { + let l6 = *base.add(8).cast::<*mut u8>(); + let l7 = *base.add(12).cast::(); + let base8 = l6; + let len8 = l7; + _rt::cabi_dealloc(base8, len8 * 1, 1); } } } @@ -10771,9 +11473,9 @@ pub mod exports { _ => { let l10 = i32::from(*arg0.add(4).cast::()); match l10 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l11 = *arg0.add(8).cast::<*mut u8>(); let l12 = *arg0.add(12).cast::(); @@ -10797,10 +11499,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/redis@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/redis@2.0.0" + )] extern "C" { #[link_name = "[resource-new]connection"] fn new(_: *mut u8) -> u32; @@ -10808,7 +11511,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -10819,10 +11521,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/redis@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/redis@2.0.0" + )] extern "C" { #[link_name = "[resource-rep]connection"] fn rep(_: u32) -> *mut u8; @@ -10830,11 +11533,14 @@ pub mod exports { unsafe { rep(handle) } } } - /// Open a connection to the Redis instance at `address`. fn open(address: _rt::String) -> Result; /// Publish a Redis message to the specified channel. - fn publish(&self, channel: _rt::String, payload: Payload) -> Result<(), Error>; + fn publish( + &self, + channel: _rt::String, + payload: Payload, + ) -> Result<(), Error>; /// Get the value of a key. fn get(&self, key: _rt::String) -> Result, Error>; /// Set key to value. @@ -10858,7 +11564,10 @@ pub mod exports { values: _rt::Vec<_rt::String>, ) -> Result; /// Retrieve the contents of the set named `key`. - fn smembers(&self, key: _rt::String) -> Result<_rt::Vec<_rt::String>, Error>; + fn smembers( + &self, + key: _rt::String, + ) -> Result<_rt::Vec<_rt::String>, Error>; /// Remove the specified `values` from the set named `key`, returning the number of newly-removed values. fn srem( &self, @@ -10873,118 +11582,143 @@ pub mod exports { ) -> Result<_rt::Vec, Error>; } #[doc(hidden)] - - macro_rules! __export_fermyon_spin_redis_2_0_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "fermyon:spin/redis@2.0.0#[static]connection.open"] - unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { - $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[static]connection.open"] - unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { - $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.publish"] - unsafe extern "C" fn export_method_connection_publish(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_publish_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.publish"] - unsafe extern "C" fn _post_return_method_connection_publish(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_publish::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.get"] - unsafe extern "C" fn export_method_connection_get(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_get_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.get"] - unsafe extern "C" fn _post_return_method_connection_get(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_get::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.set"] - unsafe extern "C" fn export_method_connection_set(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_set_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.set"] - unsafe extern "C" fn _post_return_method_connection_set(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_set::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.incr"] - unsafe extern "C" fn export_method_connection_incr(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_incr_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.incr"] - unsafe extern "C" fn _post_return_method_connection_incr(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_incr::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.del"] - unsafe extern "C" fn export_method_connection_del(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_del_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.del"] - unsafe extern "C" fn _post_return_method_connection_del(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_del::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.sadd"] - unsafe extern "C" fn export_method_connection_sadd(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_sadd_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.sadd"] - unsafe extern "C" fn _post_return_method_connection_sadd(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_sadd::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.smembers"] - unsafe extern "C" fn export_method_connection_smembers(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_smembers_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.smembers"] - unsafe extern "C" fn _post_return_method_connection_smembers(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_smembers::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.srem"] - unsafe extern "C" fn export_method_connection_srem(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_srem_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.srem"] - unsafe extern "C" fn _post_return_method_connection_srem(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_srem::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.execute"] - unsafe extern "C" fn export_method_connection_execute(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.execute"] - unsafe extern "C" fn _post_return_method_connection_execute(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_execute::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - - const _: () = { - #[doc(hidden)] - #[export_name = "fermyon:spin/redis@2.0.0#[dtor]connection"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::Connection::dtor::< - <$ty as $($path_to_types)*::Guest>::Connection - >(rep) - } - }; - - };); -} + macro_rules! __export_fermyon_spin_redis_2_0_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "fermyon:spin/redis@2.0.0#[static]connection.open"] unsafe extern + "C" fn export_static_connection_open(arg0 : * mut u8, arg1 : + usize,) -> * mut u8 { $($path_to_types)*:: + _export_static_connection_open_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1) } + #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_static_connection_open::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/redis@2.0.0#[method]connection.publish"] unsafe + extern "C" fn export_method_connection_publish(arg0 : * mut u8, + arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> + * mut u8 { $($path_to_types)*:: + _export_method_connection_publish_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4) } #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.publish"] + unsafe extern "C" fn _post_return_method_connection_publish(arg0 + : * mut u8,) { $($path_to_types)*:: + __post_return_method_connection_publish::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/redis@2.0.0#[method]connection.get"] unsafe + extern "C" fn export_method_connection_get(arg0 : * mut u8, arg1 + : * mut u8, arg2 : usize,) -> * mut u8 { $($path_to_types)*:: + _export_method_connection_get_cabi::<<$ty as $($path_to_types)*:: + Guest >::Connection > (arg0, arg1, arg2) } #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.get"] + unsafe extern "C" fn _post_return_method_connection_get(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_method_connection_get::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/redis@2.0.0#[method]connection.set"] unsafe + extern "C" fn export_method_connection_set(arg0 : * mut u8, arg1 + : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> * + mut u8 { $($path_to_types)*:: + _export_method_connection_set_cabi::<<$ty as $($path_to_types)*:: + Guest >::Connection > (arg0, arg1, arg2, arg3, arg4) } + #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.set"] + unsafe extern "C" fn _post_return_method_connection_set(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_method_connection_set::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/redis@2.0.0#[method]connection.incr"] unsafe + extern "C" fn export_method_connection_incr(arg0 : * mut u8, arg1 + : * mut u8, arg2 : usize,) -> * mut u8 { $($path_to_types)*:: + _export_method_connection_incr_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2) } + #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.incr"] + unsafe extern "C" fn _post_return_method_connection_incr(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_method_connection_incr::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/redis@2.0.0#[method]connection.del"] unsafe + extern "C" fn export_method_connection_del(arg0 : * mut u8, arg1 + : * mut u8, arg2 : usize,) -> * mut u8 { $($path_to_types)*:: + _export_method_connection_del_cabi::<<$ty as $($path_to_types)*:: + Guest >::Connection > (arg0, arg1, arg2) } #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.del"] + unsafe extern "C" fn _post_return_method_connection_del(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_method_connection_del::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/redis@2.0.0#[method]connection.sadd"] unsafe + extern "C" fn export_method_connection_sadd(arg0 : * mut u8, arg1 + : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> * + mut u8 { $($path_to_types)*:: + _export_method_connection_sadd_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4) } #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.sadd"] + unsafe extern "C" fn _post_return_method_connection_sadd(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_method_connection_sadd::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/redis@2.0.0#[method]connection.smembers"] unsafe + extern "C" fn export_method_connection_smembers(arg0 : * mut u8, + arg1 : * mut u8, arg2 : usize,) -> * mut u8 { + $($path_to_types)*:: + _export_method_connection_smembers_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2) } + #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.smembers"] + unsafe extern "C" fn _post_return_method_connection_smembers(arg0 + : * mut u8,) { $($path_to_types)*:: + __post_return_method_connection_smembers::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/redis@2.0.0#[method]connection.srem"] unsafe + extern "C" fn export_method_connection_srem(arg0 : * mut u8, arg1 + : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> * + mut u8 { $($path_to_types)*:: + _export_method_connection_srem_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4) } #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.srem"] + unsafe extern "C" fn _post_return_method_connection_srem(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_method_connection_srem::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/redis@2.0.0#[method]connection.execute"] unsafe + extern "C" fn export_method_connection_execute(arg0 : * mut u8, + arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> + * mut u8 { $($path_to_types)*:: + _export_method_connection_execute_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4) } #[export_name = + "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.execute"] + unsafe extern "C" fn _post_return_method_connection_execute(arg0 + : * mut u8,) { $($path_to_types)*:: + __post_return_method_connection_execute::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } const _ : () + = { #[doc(hidden)] #[export_name = + "fermyon:spin/redis@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: Connection::dtor::< <$ty as + $($path_to_types)*:: Guest >::Connection > (rep) } }; }; + }; + } #[doc(hidden)] pub(crate) use __export_fermyon_spin_redis_2_0_0_cabi; #[repr(align(8))] struct _RetArea([::core::mem::MaybeUninit; 24]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 24]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 24], + ); } - #[allow(dead_code, clippy::all)] pub mod mqtt { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; /// Errors related to interacting with Mqtt #[derive(Clone)] @@ -10999,7 +11733,10 @@ pub mod exports { Other(_rt::String), } impl ::core::fmt::Debug for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Error::InvalidAddress => { f.debug_tuple("Error::InvalidAddress").finish() @@ -11010,60 +11747,65 @@ pub mod exports { Error::ConnectionFailed(e) => { f.debug_tuple("Error::ConnectionFailed").field(e).finish() } - Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + Error::Other(e) => { + f.debug_tuple("Error::Other").field(e).finish() + } } } } impl ::core::fmt::Display for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for Error {} /// QoS for publishing Mqtt messages #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum Qos { AtMostOnce, AtLeastOnce, ExactlyOnce, } impl ::core::fmt::Debug for Qos { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Qos::AtMostOnce => f.debug_tuple("Qos::AtMostOnce").finish(), - Qos::AtLeastOnce => f.debug_tuple("Qos::AtLeastOnce").finish(), - Qos::ExactlyOnce => f.debug_tuple("Qos::ExactlyOnce").finish(), + Qos::AtLeastOnce => { + f.debug_tuple("Qos::AtLeastOnce").finish() + } + Qos::ExactlyOnce => { + f.debug_tuple("Qos::ExactlyOnce").finish() + } } } } - impl Qos { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> Qos { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => Qos::AtMostOnce, 1 => Qos::AtLeastOnce, 2 => Qos::ExactlyOnce, - _ => panic!("invalid enum discriminant"), } } } - #[derive(Debug)] #[repr(transparent)] pub struct Connection { handle: _rt::Resource, } - type _ConnectionRep = Option; - impl Connection { /// Creates a new resource from the specified representation. /// @@ -11073,77 +11815,68 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _ConnectionRep = Some(val); - let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestConnection` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); } - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`Connection`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -11152,7 +11885,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a Connection>, } - impl<'a> ConnectionBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -11161,41 +11893,34 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for Connection { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/mqtt@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/mqtt@2.0.0" + )] extern "C" { #[link_name = "[resource-drop]connection"] fn drop(_: u32); } - drop(_handle); } } } - /// The message payload. pub type Payload = _rt::Vec; #[doc(hidden)] @@ -11209,8 +11934,7 @@ pub mod exports { arg5: usize, arg6: i64, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg1; let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); let len1 = arg3; @@ -11268,12 +11992,12 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), + 0 => {} + 1 => {} 2 => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -11298,8 +12022,7 @@ pub mod exports { arg4: usize, arg5: i32, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let len1 = arg4; @@ -11348,17 +12071,17 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_connection_publish( - arg0: *mut u8, - ) { + pub unsafe fn __post_return_method_connection_publish< + T: GuestConnection, + >(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), + 0 => {} + 1 => {} 2 => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -11387,10 +12110,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/mqtt@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/mqtt@2.0.0" + )] extern "C" { #[link_name = "[resource-new]connection"] fn new(_: *mut u8) -> u32; @@ -11398,7 +12122,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -11409,10 +12132,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/mqtt@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/mqtt@2.0.0" + )] extern "C" { #[link_name = "[resource-rep]connection"] fn rep(_: u32) -> *mut u8; @@ -11420,7 +12144,6 @@ pub mod exports { unsafe { rep(handle) } } } - /// Open a connection to the Mqtt instance at `address`. fn open( address: _rt::String, @@ -11437,54 +12160,53 @@ pub mod exports { ) -> Result<(), Error>; } #[doc(hidden)] - - macro_rules! __export_fermyon_spin_mqtt_2_0_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "fermyon:spin/mqtt@2.0.0#[static]connection.open"] - unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,arg4: *mut u8,arg5: usize,arg6: i64,) -> *mut u8 { - $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4, arg5, arg6) - } - #[export_name = "cabi_post_fermyon:spin/mqtt@2.0.0#[static]connection.open"] - unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { - $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/mqtt@2.0.0#[method]connection.publish"] - unsafe extern "C" fn export_method_connection_publish(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,arg5: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_publish_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4, arg5) - } - #[export_name = "cabi_post_fermyon:spin/mqtt@2.0.0#[method]connection.publish"] - unsafe extern "C" fn _post_return_method_connection_publish(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_publish::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - - const _: () = { - #[doc(hidden)] - #[export_name = "fermyon:spin/mqtt@2.0.0#[dtor]connection"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::Connection::dtor::< - <$ty as $($path_to_types)*::Guest>::Connection - >(rep) - } - }; - - };); -} - #[doc(hidden)] + macro_rules! __export_fermyon_spin_mqtt_2_0_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "fermyon:spin/mqtt@2.0.0#[static]connection.open"] unsafe extern + "C" fn export_static_connection_open(arg0 : * mut u8, arg1 : + usize, arg2 : * mut u8, arg3 : usize, arg4 : * mut u8, arg5 : + usize, arg6 : i64,) -> * mut u8 { $($path_to_types)*:: + _export_static_connection_open_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4, arg5, arg6) } #[export_name = + "cabi_post_fermyon:spin/mqtt@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_static_connection_open::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/mqtt@2.0.0#[method]connection.publish"] unsafe + extern "C" fn export_method_connection_publish(arg0 : * mut u8, + arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize, + arg5 : i32,) -> * mut u8 { $($path_to_types)*:: + _export_method_connection_publish_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4, arg5) } #[export_name = + "cabi_post_fermyon:spin/mqtt@2.0.0#[method]connection.publish"] + unsafe extern "C" fn _post_return_method_connection_publish(arg0 + : * mut u8,) { $($path_to_types)*:: + __post_return_method_connection_publish::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } const _ : () + = { #[doc(hidden)] #[export_name = + "fermyon:spin/mqtt@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: Connection::dtor::< <$ty as + $($path_to_types)*:: Guest >::Connection > (rep) } }; }; + }; + } + #[doc(hidden)] pub(crate) use __export_fermyon_spin_mqtt_2_0_0_cabi; #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 16]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); } - #[allow(dead_code, clippy::all)] pub mod rdbms_types { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; /// Errors related to interacting with a database. #[derive(Clone)] @@ -11496,7 +12218,10 @@ pub mod exports { Other(_rt::String), } impl ::core::fmt::Debug for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Error::ConnectionFailed(e) => { f.debug_tuple("Error::ConnectionFailed").field(e).finish() @@ -11507,24 +12232,29 @@ pub mod exports { Error::QueryFailed(e) => { f.debug_tuple("Error::QueryFailed").field(e).finish() } - Error::ValueConversionFailed(e) => f - .debug_tuple("Error::ValueConversionFailed") - .field(e) - .finish(), - Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + Error::ValueConversionFailed(e) => { + f.debug_tuple("Error::ValueConversionFailed") + .field(e) + .finish() + } + Error::Other(e) => { + f.debug_tuple("Error::Other").field(e).finish() + } } } } impl ::core::fmt::Display for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for Error {} /// Data types for a database column #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum DbDataType { Boolean, Int8, @@ -11542,17 +12272,38 @@ pub mod exports { Other, } impl ::core::fmt::Debug for DbDataType { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - DbDataType::Boolean => f.debug_tuple("DbDataType::Boolean").finish(), - DbDataType::Int8 => f.debug_tuple("DbDataType::Int8").finish(), - DbDataType::Int16 => f.debug_tuple("DbDataType::Int16").finish(), - DbDataType::Int32 => f.debug_tuple("DbDataType::Int32").finish(), - DbDataType::Int64 => f.debug_tuple("DbDataType::Int64").finish(), - DbDataType::Uint8 => f.debug_tuple("DbDataType::Uint8").finish(), - DbDataType::Uint16 => f.debug_tuple("DbDataType::Uint16").finish(), - DbDataType::Uint32 => f.debug_tuple("DbDataType::Uint32").finish(), - DbDataType::Uint64 => f.debug_tuple("DbDataType::Uint64").finish(), + DbDataType::Boolean => { + f.debug_tuple("DbDataType::Boolean").finish() + } + DbDataType::Int8 => { + f.debug_tuple("DbDataType::Int8").finish() + } + DbDataType::Int16 => { + f.debug_tuple("DbDataType::Int16").finish() + } + DbDataType::Int32 => { + f.debug_tuple("DbDataType::Int32").finish() + } + DbDataType::Int64 => { + f.debug_tuple("DbDataType::Int64").finish() + } + DbDataType::Uint8 => { + f.debug_tuple("DbDataType::Uint8").finish() + } + DbDataType::Uint16 => { + f.debug_tuple("DbDataType::Uint16").finish() + } + DbDataType::Uint32 => { + f.debug_tuple("DbDataType::Uint32").finish() + } + DbDataType::Uint64 => { + f.debug_tuple("DbDataType::Uint64").finish() + } DbDataType::Floating32 => { f.debug_tuple("DbDataType::Floating32").finish() } @@ -11560,19 +12311,21 @@ pub mod exports { f.debug_tuple("DbDataType::Floating64").finish() } DbDataType::Str => f.debug_tuple("DbDataType::Str").finish(), - DbDataType::Binary => f.debug_tuple("DbDataType::Binary").finish(), - DbDataType::Other => f.debug_tuple("DbDataType::Other").finish(), + DbDataType::Binary => { + f.debug_tuple("DbDataType::Binary").finish() + } + DbDataType::Other => { + f.debug_tuple("DbDataType::Other").finish() + } } } } - impl DbDataType { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> DbDataType { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => DbDataType::Boolean, 1 => DbDataType::Int8, @@ -11588,12 +12341,10 @@ pub mod exports { 11 => DbDataType::Str, 12 => DbDataType::Binary, 13 => DbDataType::Other, - _ => panic!("invalid enum discriminant"), } } } - /// Database values #[derive(Clone)] pub enum DbValue { @@ -11614,16 +12365,29 @@ pub mod exports { Unsupported, } impl ::core::fmt::Debug for DbValue { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { DbValue::Boolean(e) => { f.debug_tuple("DbValue::Boolean").field(e).finish() } - DbValue::Int8(e) => f.debug_tuple("DbValue::Int8").field(e).finish(), - DbValue::Int16(e) => f.debug_tuple("DbValue::Int16").field(e).finish(), - DbValue::Int32(e) => f.debug_tuple("DbValue::Int32").field(e).finish(), - DbValue::Int64(e) => f.debug_tuple("DbValue::Int64").field(e).finish(), - DbValue::Uint8(e) => f.debug_tuple("DbValue::Uint8").field(e).finish(), + DbValue::Int8(e) => { + f.debug_tuple("DbValue::Int8").field(e).finish() + } + DbValue::Int16(e) => { + f.debug_tuple("DbValue::Int16").field(e).finish() + } + DbValue::Int32(e) => { + f.debug_tuple("DbValue::Int32").field(e).finish() + } + DbValue::Int64(e) => { + f.debug_tuple("DbValue::Int64").field(e).finish() + } + DbValue::Uint8(e) => { + f.debug_tuple("DbValue::Uint8").field(e).finish() + } DbValue::Uint16(e) => { f.debug_tuple("DbValue::Uint16").field(e).finish() } @@ -11639,12 +12403,16 @@ pub mod exports { DbValue::Floating64(e) => { f.debug_tuple("DbValue::Floating64").field(e).finish() } - DbValue::Str(e) => f.debug_tuple("DbValue::Str").field(e).finish(), + DbValue::Str(e) => { + f.debug_tuple("DbValue::Str").field(e).finish() + } DbValue::Binary(e) => { f.debug_tuple("DbValue::Binary").field(e).finish() } DbValue::DbNull => f.debug_tuple("DbValue::DbNull").finish(), - DbValue::Unsupported => f.debug_tuple("DbValue::Unsupported").finish(), + DbValue::Unsupported => { + f.debug_tuple("DbValue::Unsupported").finish() + } } } } @@ -11667,7 +12435,10 @@ pub mod exports { DbNull, } impl ::core::fmt::Debug for ParameterValue { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { ParameterValue::Boolean(e) => { f.debug_tuple("ParameterValue::Boolean").field(e).finish() @@ -11696,14 +12467,16 @@ pub mod exports { ParameterValue::Uint64(e) => { f.debug_tuple("ParameterValue::Uint64").field(e).finish() } - ParameterValue::Floating32(e) => f - .debug_tuple("ParameterValue::Floating32") - .field(e) - .finish(), - ParameterValue::Floating64(e) => f - .debug_tuple("ParameterValue::Floating64") - .field(e) - .finish(), + ParameterValue::Floating32(e) => { + f.debug_tuple("ParameterValue::Floating32") + .field(e) + .finish() + } + ParameterValue::Floating64(e) => { + f.debug_tuple("ParameterValue::Floating64") + .field(e) + .finish() + } ParameterValue::Str(e) => { f.debug_tuple("ParameterValue::Str").field(e).finish() } @@ -11723,7 +12496,10 @@ pub mod exports { pub data_type: DbDataType, } impl ::core::fmt::Debug for Column { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("Column") .field("name", &self.name) .field("data-type", &self.data_type) @@ -11739,7 +12515,10 @@ pub mod exports { pub rows: _rt::Vec, } impl ::core::fmt::Debug for RowSet { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("RowSet") .field("columns", &self.columns) .field("rows", &self.rows) @@ -11747,40 +12526,30 @@ pub mod exports { } } #[doc(hidden)] - macro_rules! __export_fermyon_spin_rdbms_types_2_0_0_cabi { ($ty:ident with_types_in $($path_to_types:tt)*) => { - const _: () = {}; + const _ : () = {}; }; } #[doc(hidden)] pub(crate) use __export_fermyon_spin_rdbms_types_2_0_0_cabi; } - #[allow(dead_code, clippy::all)] pub mod postgres { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; - pub type ParameterValue = - super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue; - pub type RowSet = - super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet; - pub type Error = - super::super::super::super::exports::fermyon::spin::rdbms_types::Error; + pub type ParameterValue = super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue; + pub type RowSet = super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet; + pub type Error = super::super::super::super::exports::fermyon::spin::rdbms_types::Error; /// A connection to a postgres database. - #[derive(Debug)] #[repr(transparent)] pub struct Connection { handle: _rt::Resource, } - type _ConnectionRep = Option; - impl Connection { /// Creates a new resource from the specified representation. /// @@ -11790,77 +12559,68 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _ConnectionRep = Some(val); - let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestConnection` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); } - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`Connection`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -11869,7 +12629,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a Connection>, } - impl<'a> ConnectionBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -11878,49 +12637,41 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for Connection { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/postgres@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/postgres@2.0.0" + )] extern "C" { #[link_name = "[resource-drop]connection"] fn drop(_: u32); } - drop(_handle); } } } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_static_connection_open_cabi( arg0: *mut u8, arg1: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg1; let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); let result1 = T::open(_rt::string_lift(bytes0)); @@ -11991,7 +12742,7 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { @@ -12033,8 +12784,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let base20 = arg3; @@ -12049,7 +12799,6 @@ pub mod exports { 0 => { let e19 = { let l2 = i32::from(*base.add(8).cast::()); - _rt::bool_lift(l2 as u8) }; V19::Boolean(e19) @@ -12057,7 +12806,6 @@ pub mod exports { 1 => { let e19 = { let l3 = i32::from(*base.add(8).cast::()); - l3 as i8 }; V19::Int8(e19) @@ -12065,7 +12813,6 @@ pub mod exports { 2 => { let e19 = { let l4 = i32::from(*base.add(8).cast::()); - l4 as i16 }; V19::Int16(e19) @@ -12073,7 +12820,6 @@ pub mod exports { 3 => { let e19 = { let l5 = *base.add(8).cast::(); - l5 }; V19::Int32(e19) @@ -12081,7 +12827,6 @@ pub mod exports { 4 => { let e19 = { let l6 = *base.add(8).cast::(); - l6 }; V19::Int64(e19) @@ -12089,7 +12834,6 @@ pub mod exports { 5 => { let e19 = { let l7 = i32::from(*base.add(8).cast::()); - l7 as u8 }; V19::Uint8(e19) @@ -12097,7 +12841,6 @@ pub mod exports { 6 => { let e19 = { let l8 = i32::from(*base.add(8).cast::()); - l8 as u16 }; V19::Uint16(e19) @@ -12105,7 +12848,6 @@ pub mod exports { 7 => { let e19 = { let l9 = *base.add(8).cast::(); - l9 as u32 }; V19::Uint32(e19) @@ -12113,7 +12855,6 @@ pub mod exports { 8 => { let e19 = { let l10 = *base.add(8).cast::(); - l10 as u64 }; V19::Uint64(e19) @@ -12121,7 +12862,6 @@ pub mod exports { 9 => { let e19 = { let l11 = *base.add(8).cast::(); - l11 }; V19::Floating32(e19) @@ -12129,7 +12869,6 @@ pub mod exports { 10 => { let e19 = { let l12 = *base.add(8).cast::(); - l12 }; V19::Floating64(e19) @@ -12139,9 +12878,11 @@ pub mod exports { let l13 = *base.add(8).cast::<*mut u8>(); let l14 = *base.add(12).cast::(); let len15 = l14; - let bytes15 = - _rt::Vec::from_raw_parts(l13.cast(), len15, len15); - + let bytes15 = _rt::Vec::from_raw_parts( + l13.cast(), + len15, + len15, + ); _rt::string_lift(bytes15) }; V19::Str(e19) @@ -12151,7 +12892,6 @@ pub mod exports { let l16 = *base.add(8).cast::<*mut u8>(); let l17 = *base.add(12).cast::(); let len18 = l17; - _rt::Vec::from_raw_parts(l16.cast(), len18, len18) }; V19::Binary(e19) @@ -12161,7 +12901,6 @@ pub mod exports { V19::DbNull } }; - v19 }; result20.push(e20); @@ -12176,11 +12915,16 @@ pub mod exports { match result21 { Ok(e) => { *ptr22.add(0).cast::() = (0i32) as u8; - let super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet{ columns:columns23, rows:rows23, } = e; + let super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet { + columns: columns23, + rows: rows23, + } = e; let vec26 = columns23; let len26 = vec26.len(); - let layout26 = - _rt::alloc::Layout::from_size_align_unchecked(vec26.len() * 12, 4); + let layout26 = _rt::alloc::Layout::from_size_align_unchecked( + vec26.len() * 12, + 4, + ); let result26 = if layout26.size() != 0 { let ptr = _rt::alloc::alloc(layout26).cast::(); if ptr.is_null() { @@ -12188,29 +12932,33 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec26.into_iter().enumerate() { let base = result26.add(i * 12); { - let super::super::super::super::exports::fermyon::spin::rdbms_types::Column{ name:name24, data_type:data_type24, } = e; + let super::super::super::super::exports::fermyon::spin::rdbms_types::Column { + name: name24, + data_type: data_type24, + } = e; let vec25 = (name24.into_bytes()).into_boxed_slice(); let ptr25 = vec25.as_ptr().cast::(); let len25 = vec25.len(); ::core::mem::forget(vec25); *base.add(4).cast::() = len25; *base.add(0).cast::<*mut u8>() = ptr25.cast_mut(); - *base.add(8).cast::() = (data_type24.clone() as i32) as u8; + *base.add(8).cast::() = (data_type24.clone() as i32) + as u8; } } *ptr22.add(8).cast::() = len26; *ptr22.add(4).cast::<*mut u8>() = result26; let vec31 = rows23; let len31 = vec31.len(); - let layout31 = - _rt::alloc::Layout::from_size_align_unchecked(vec31.len() * 8, 4); + let layout31 = _rt::alloc::Layout::from_size_align_unchecked( + vec31.len() * 8, + 4, + ); let result31 = if layout31.size() != 0 { let ptr = _rt::alloc::alloc(layout31).cast::(); if ptr.is_null() { @@ -12218,9 +12966,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec31.into_iter().enumerate() { let base = result31.add(i * 8); @@ -12238,9 +12984,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec30.into_iter().enumerate() { let base = result30.add(i * 16); @@ -12252,18 +12996,15 @@ pub mod exports { *base.add(8).cast::() = (match e { true => 1, false => 0, - }) - as u8; + }) as u8; } V29::Int8(e) => { *base.add(0).cast::() = (1i32) as u8; - *base.add(8).cast::() = - (_rt::as_i32(e)) as u8; + *base.add(8).cast::() = (_rt::as_i32(e)) as u8; } V29::Int16(e) => { *base.add(0).cast::() = (2i32) as u8; - *base.add(8).cast::() = - (_rt::as_i32(e)) as u16; + *base.add(8).cast::() = (_rt::as_i32(e)) as u16; } V29::Int32(e) => { *base.add(0).cast::() = (3i32) as u8; @@ -12275,13 +13016,11 @@ pub mod exports { } V29::Uint8(e) => { *base.add(0).cast::() = (5i32) as u8; - *base.add(8).cast::() = - (_rt::as_i32(e)) as u8; + *base.add(8).cast::() = (_rt::as_i32(e)) as u8; } V29::Uint16(e) => { *base.add(0).cast::() = (6i32) as u8; - *base.add(8).cast::() = - (_rt::as_i32(e)) as u16; + *base.add(8).cast::() = (_rt::as_i32(e)) as u16; } V29::Uint32(e) => { *base.add(0).cast::() = (7i32) as u8; @@ -12306,8 +13045,7 @@ pub mod exports { let len27 = vec27.len(); ::core::mem::forget(vec27); *base.add(12).cast::() = len27; - *base.add(8).cast::<*mut u8>() = - ptr27.cast_mut(); + *base.add(8).cast::<*mut u8>() = ptr27.cast_mut(); } V29::Binary(e) => { *base.add(0).cast::() = (12i32) as u8; @@ -12316,8 +13054,7 @@ pub mod exports { let len28 = vec28.len(); ::core::mem::forget(vec28); *base.add(12).cast::() = len28; - *base.add(8).cast::<*mut u8>() = - ptr28.cast_mut(); + *base.add(8).cast::<*mut u8>() = ptr28.cast_mut(); } V29::DbNull => { *base.add(0).cast::() = (13i32) as u8; @@ -12397,64 +13134,64 @@ pub mod exports { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { 0 => { - let l3 = *arg0.add(4).cast::<*mut u8>(); - let l4 = *arg0.add(8).cast::(); - let base5 = l3; - let len5 = l4; + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base5 = l1; + let len5 = l2; for i in 0..len5 { let base = base5.add(i * 12); { - let l1 = *base.add(0).cast::<*mut u8>(); - let l2 = *base.add(4).cast::(); - _rt::cabi_dealloc(l1, l2, 1); + let l3 = *base.add(0).cast::<*mut u8>(); + let l4 = *base.add(4).cast::(); + _rt::cabi_dealloc(l3, l4, 1); } } _rt::cabi_dealloc(base5, len5 * 12, 4); - let l15 = *arg0.add(12).cast::<*mut u8>(); - let l16 = *arg0.add(16).cast::(); - let base17 = l15; - let len17 = l16; + let l6 = *arg0.add(12).cast::<*mut u8>(); + let l7 = *arg0.add(16).cast::(); + let base17 = l6; + let len17 = l7; for i in 0..len17 { let base = base17.add(i * 8); { - let l12 = *base.add(0).cast::<*mut u8>(); - let l13 = *base.add(4).cast::(); - let base14 = l12; - let len14 = l13; - for i in 0..len14 { - let base = base14.add(i * 16); + let l8 = *base.add(0).cast::<*mut u8>(); + let l9 = *base.add(4).cast::(); + let base16 = l8; + let len16 = l9; + for i in 0..len16 { + let base = base16.add(i * 16); { - let l6 = i32::from(*base.add(0).cast::()); - match l6 { - 0 => (), - 1 => (), - 2 => (), - 3 => (), - 4 => (), - 5 => (), - 6 => (), - 7 => (), - 8 => (), - 9 => (), - 10 => (), + let l10 = i32::from(*base.add(0).cast::()); + match l10 { + 0 => {} + 1 => {} + 2 => {} + 3 => {} + 4 => {} + 5 => {} + 6 => {} + 7 => {} + 8 => {} + 9 => {} + 10 => {} 11 => { - let l7 = *base.add(8).cast::<*mut u8>(); - let l8 = *base.add(12).cast::(); - _rt::cabi_dealloc(l7, l8, 1); + let l11 = *base.add(8).cast::<*mut u8>(); + let l12 = *base.add(12).cast::(); + _rt::cabi_dealloc(l11, l12, 1); } 12 => { - let l9 = *base.add(8).cast::<*mut u8>(); - let l10 = *base.add(12).cast::(); - let base11 = l9; - let len11 = l10; - _rt::cabi_dealloc(base11, len11 * 1, 1); + let l13 = *base.add(8).cast::<*mut u8>(); + let l14 = *base.add(12).cast::(); + let base15 = l13; + let len15 = l14; + _rt::cabi_dealloc(base15, len15 * 1, 1); } - 13 => (), - _ => (), + 13 => {} + _ => {} } } } - _rt::cabi_dealloc(base14, len14 * 16, 8); + _rt::cabi_dealloc(base16, len16 * 16, 8); } } _rt::cabi_dealloc(base17, len17 * 8, 4); @@ -12500,8 +13237,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let base20 = arg3; @@ -12516,7 +13252,6 @@ pub mod exports { 0 => { let e19 = { let l2 = i32::from(*base.add(8).cast::()); - _rt::bool_lift(l2 as u8) }; V19::Boolean(e19) @@ -12524,7 +13259,6 @@ pub mod exports { 1 => { let e19 = { let l3 = i32::from(*base.add(8).cast::()); - l3 as i8 }; V19::Int8(e19) @@ -12532,7 +13266,6 @@ pub mod exports { 2 => { let e19 = { let l4 = i32::from(*base.add(8).cast::()); - l4 as i16 }; V19::Int16(e19) @@ -12540,7 +13273,6 @@ pub mod exports { 3 => { let e19 = { let l5 = *base.add(8).cast::(); - l5 }; V19::Int32(e19) @@ -12548,7 +13280,6 @@ pub mod exports { 4 => { let e19 = { let l6 = *base.add(8).cast::(); - l6 }; V19::Int64(e19) @@ -12556,7 +13287,6 @@ pub mod exports { 5 => { let e19 = { let l7 = i32::from(*base.add(8).cast::()); - l7 as u8 }; V19::Uint8(e19) @@ -12564,7 +13294,6 @@ pub mod exports { 6 => { let e19 = { let l8 = i32::from(*base.add(8).cast::()); - l8 as u16 }; V19::Uint16(e19) @@ -12572,7 +13301,6 @@ pub mod exports { 7 => { let e19 = { let l9 = *base.add(8).cast::(); - l9 as u32 }; V19::Uint32(e19) @@ -12580,7 +13308,6 @@ pub mod exports { 8 => { let e19 = { let l10 = *base.add(8).cast::(); - l10 as u64 }; V19::Uint64(e19) @@ -12588,7 +13315,6 @@ pub mod exports { 9 => { let e19 = { let l11 = *base.add(8).cast::(); - l11 }; V19::Floating32(e19) @@ -12596,7 +13322,6 @@ pub mod exports { 10 => { let e19 = { let l12 = *base.add(8).cast::(); - l12 }; V19::Floating64(e19) @@ -12606,9 +13331,11 @@ pub mod exports { let l13 = *base.add(8).cast::<*mut u8>(); let l14 = *base.add(12).cast::(); let len15 = l14; - let bytes15 = - _rt::Vec::from_raw_parts(l13.cast(), len15, len15); - + let bytes15 = _rt::Vec::from_raw_parts( + l13.cast(), + len15, + len15, + ); _rt::string_lift(bytes15) }; V19::Str(e19) @@ -12618,7 +13345,6 @@ pub mod exports { let l16 = *base.add(8).cast::<*mut u8>(); let l17 = *base.add(12).cast::(); let len18 = l17; - _rt::Vec::from_raw_parts(l16.cast(), len18, len18) }; V19::Binary(e19) @@ -12628,7 +13354,6 @@ pub mod exports { V19::DbNull } }; - v19 }; result20.push(e20); @@ -12701,12 +13426,12 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_connection_execute( - arg0: *mut u8, - ) { + pub unsafe fn __post_return_method_connection_execute< + T: GuestConnection, + >(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(8).cast::()); match l1 { @@ -12753,10 +13478,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/postgres@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/postgres@2.0.0" + )] extern "C" { #[link_name = "[resource-new]connection"] fn new(_: *mut u8) -> u32; @@ -12764,7 +13490,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -12775,10 +13500,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/postgres@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/postgres@2.0.0" + )] extern "C" { #[link_name = "[resource-rep]connection"] fn rep(_: u32) -> *mut u8; @@ -12786,7 +13512,6 @@ pub mod exports { unsafe { rep(handle) } } } - /// Open a connection to the Postgres instance at `address`. fn open(address: _rt::String) -> Result; /// Query the database. @@ -12803,79 +13528,75 @@ pub mod exports { ) -> Result; } #[doc(hidden)] - - macro_rules! __export_fermyon_spin_postgres_2_0_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "fermyon:spin/postgres@2.0.0#[static]connection.open"] - unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { - $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1) - } - #[export_name = "cabi_post_fermyon:spin/postgres@2.0.0#[static]connection.open"] - unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { - $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/postgres@2.0.0#[method]connection.query"] - unsafe extern "C" fn export_method_connection_query(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_query_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/postgres@2.0.0#[method]connection.query"] - unsafe extern "C" fn _post_return_method_connection_query(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_query::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/postgres@2.0.0#[method]connection.execute"] - unsafe extern "C" fn export_method_connection_execute(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/postgres@2.0.0#[method]connection.execute"] - unsafe extern "C" fn _post_return_method_connection_execute(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_execute::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - - const _: () = { - #[doc(hidden)] - #[export_name = "fermyon:spin/postgres@2.0.0#[dtor]connection"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::Connection::dtor::< - <$ty as $($path_to_types)*::Guest>::Connection - >(rep) - } - }; - - };); -} + macro_rules! __export_fermyon_spin_postgres_2_0_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "fermyon:spin/postgres@2.0.0#[static]connection.open"] unsafe + extern "C" fn export_static_connection_open(arg0 : * mut u8, arg1 + : usize,) -> * mut u8 { $($path_to_types)*:: + _export_static_connection_open_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1) } + #[export_name = + "cabi_post_fermyon:spin/postgres@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_static_connection_open::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/postgres@2.0.0#[method]connection.query"] unsafe + extern "C" fn export_method_connection_query(arg0 : * mut u8, + arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> + * mut u8 { $($path_to_types)*:: + _export_method_connection_query_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4) } #[export_name = + "cabi_post_fermyon:spin/postgres@2.0.0#[method]connection.query"] + unsafe extern "C" fn _post_return_method_connection_query(arg0 : + * mut u8,) { $($path_to_types)*:: + __post_return_method_connection_query::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/postgres@2.0.0#[method]connection.execute"] + unsafe extern "C" fn export_method_connection_execute(arg0 : * + mut u8, arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : + usize,) -> * mut u8 { $($path_to_types)*:: + _export_method_connection_execute_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4) } #[export_name = + "cabi_post_fermyon:spin/postgres@2.0.0#[method]connection.execute"] + unsafe extern "C" fn _post_return_method_connection_execute(arg0 + : * mut u8,) { $($path_to_types)*:: + __post_return_method_connection_execute::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } const _ : () + = { #[doc(hidden)] #[export_name = + "fermyon:spin/postgres@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: Connection::dtor::< <$ty as + $($path_to_types)*:: Guest >::Connection > (rep) } }; }; + }; + } #[doc(hidden)] pub(crate) use __export_fermyon_spin_postgres_2_0_0_cabi; #[repr(align(8))] struct _RetArea([::core::mem::MaybeUninit; 24]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 24]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 24], + ); } - #[allow(dead_code, clippy::all)] pub mod mysql { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; - pub type ParameterValue = - super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue; - pub type RowSet = - super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet; - pub type Error = - super::super::super::super::exports::fermyon::spin::rdbms_types::Error; + pub type ParameterValue = super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue; + pub type RowSet = super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet; + pub type Error = super::super::super::super::exports::fermyon::spin::rdbms_types::Error; /// A connection to a MySQL database. - #[derive(Debug)] #[repr(transparent)] pub struct Connection { handle: _rt::Resource, } - type _ConnectionRep = Option; - impl Connection { /// Creates a new resource from the specified representation. /// @@ -12885,77 +13606,68 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _ConnectionRep = Some(val); - let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestConnection` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); } - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`Connection`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -12964,7 +13676,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a Connection>, } - impl<'a> ConnectionBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -12973,49 +13684,41 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for Connection { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/mysql@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/mysql@2.0.0" + )] extern "C" { #[link_name = "[resource-drop]connection"] fn drop(_: u32); } - drop(_handle); } } } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_static_connection_open_cabi( arg0: *mut u8, arg1: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg1; let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); let result1 = T::open(_rt::string_lift(bytes0)); @@ -13086,7 +13789,7 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { @@ -13128,8 +13831,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let base20 = arg3; @@ -13144,7 +13846,6 @@ pub mod exports { 0 => { let e19 = { let l2 = i32::from(*base.add(8).cast::()); - _rt::bool_lift(l2 as u8) }; V19::Boolean(e19) @@ -13152,7 +13853,6 @@ pub mod exports { 1 => { let e19 = { let l3 = i32::from(*base.add(8).cast::()); - l3 as i8 }; V19::Int8(e19) @@ -13160,7 +13860,6 @@ pub mod exports { 2 => { let e19 = { let l4 = i32::from(*base.add(8).cast::()); - l4 as i16 }; V19::Int16(e19) @@ -13168,7 +13867,6 @@ pub mod exports { 3 => { let e19 = { let l5 = *base.add(8).cast::(); - l5 }; V19::Int32(e19) @@ -13176,7 +13874,6 @@ pub mod exports { 4 => { let e19 = { let l6 = *base.add(8).cast::(); - l6 }; V19::Int64(e19) @@ -13184,7 +13881,6 @@ pub mod exports { 5 => { let e19 = { let l7 = i32::from(*base.add(8).cast::()); - l7 as u8 }; V19::Uint8(e19) @@ -13192,7 +13888,6 @@ pub mod exports { 6 => { let e19 = { let l8 = i32::from(*base.add(8).cast::()); - l8 as u16 }; V19::Uint16(e19) @@ -13200,7 +13895,6 @@ pub mod exports { 7 => { let e19 = { let l9 = *base.add(8).cast::(); - l9 as u32 }; V19::Uint32(e19) @@ -13208,7 +13902,6 @@ pub mod exports { 8 => { let e19 = { let l10 = *base.add(8).cast::(); - l10 as u64 }; V19::Uint64(e19) @@ -13216,7 +13909,6 @@ pub mod exports { 9 => { let e19 = { let l11 = *base.add(8).cast::(); - l11 }; V19::Floating32(e19) @@ -13224,7 +13916,6 @@ pub mod exports { 10 => { let e19 = { let l12 = *base.add(8).cast::(); - l12 }; V19::Floating64(e19) @@ -13234,9 +13925,11 @@ pub mod exports { let l13 = *base.add(8).cast::<*mut u8>(); let l14 = *base.add(12).cast::(); let len15 = l14; - let bytes15 = - _rt::Vec::from_raw_parts(l13.cast(), len15, len15); - + let bytes15 = _rt::Vec::from_raw_parts( + l13.cast(), + len15, + len15, + ); _rt::string_lift(bytes15) }; V19::Str(e19) @@ -13246,7 +13939,6 @@ pub mod exports { let l16 = *base.add(8).cast::<*mut u8>(); let l17 = *base.add(12).cast::(); let len18 = l17; - _rt::Vec::from_raw_parts(l16.cast(), len18, len18) }; V19::Binary(e19) @@ -13256,7 +13948,6 @@ pub mod exports { V19::DbNull } }; - v19 }; result20.push(e20); @@ -13271,11 +13962,16 @@ pub mod exports { match result21 { Ok(e) => { *ptr22.add(0).cast::() = (0i32) as u8; - let super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet{ columns:columns23, rows:rows23, } = e; + let super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet { + columns: columns23, + rows: rows23, + } = e; let vec26 = columns23; let len26 = vec26.len(); - let layout26 = - _rt::alloc::Layout::from_size_align_unchecked(vec26.len() * 12, 4); + let layout26 = _rt::alloc::Layout::from_size_align_unchecked( + vec26.len() * 12, + 4, + ); let result26 = if layout26.size() != 0 { let ptr = _rt::alloc::alloc(layout26).cast::(); if ptr.is_null() { @@ -13283,29 +13979,33 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec26.into_iter().enumerate() { let base = result26.add(i * 12); { - let super::super::super::super::exports::fermyon::spin::rdbms_types::Column{ name:name24, data_type:data_type24, } = e; + let super::super::super::super::exports::fermyon::spin::rdbms_types::Column { + name: name24, + data_type: data_type24, + } = e; let vec25 = (name24.into_bytes()).into_boxed_slice(); let ptr25 = vec25.as_ptr().cast::(); let len25 = vec25.len(); ::core::mem::forget(vec25); *base.add(4).cast::() = len25; *base.add(0).cast::<*mut u8>() = ptr25.cast_mut(); - *base.add(8).cast::() = (data_type24.clone() as i32) as u8; + *base.add(8).cast::() = (data_type24.clone() as i32) + as u8; } } *ptr22.add(8).cast::() = len26; *ptr22.add(4).cast::<*mut u8>() = result26; let vec31 = rows23; let len31 = vec31.len(); - let layout31 = - _rt::alloc::Layout::from_size_align_unchecked(vec31.len() * 8, 4); + let layout31 = _rt::alloc::Layout::from_size_align_unchecked( + vec31.len() * 8, + 4, + ); let result31 = if layout31.size() != 0 { let ptr = _rt::alloc::alloc(layout31).cast::(); if ptr.is_null() { @@ -13313,9 +14013,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec31.into_iter().enumerate() { let base = result31.add(i * 8); @@ -13333,9 +14031,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec30.into_iter().enumerate() { let base = result30.add(i * 16); @@ -13347,18 +14043,15 @@ pub mod exports { *base.add(8).cast::() = (match e { true => 1, false => 0, - }) - as u8; + }) as u8; } V29::Int8(e) => { *base.add(0).cast::() = (1i32) as u8; - *base.add(8).cast::() = - (_rt::as_i32(e)) as u8; + *base.add(8).cast::() = (_rt::as_i32(e)) as u8; } V29::Int16(e) => { *base.add(0).cast::() = (2i32) as u8; - *base.add(8).cast::() = - (_rt::as_i32(e)) as u16; + *base.add(8).cast::() = (_rt::as_i32(e)) as u16; } V29::Int32(e) => { *base.add(0).cast::() = (3i32) as u8; @@ -13370,13 +14063,11 @@ pub mod exports { } V29::Uint8(e) => { *base.add(0).cast::() = (5i32) as u8; - *base.add(8).cast::() = - (_rt::as_i32(e)) as u8; + *base.add(8).cast::() = (_rt::as_i32(e)) as u8; } V29::Uint16(e) => { *base.add(0).cast::() = (6i32) as u8; - *base.add(8).cast::() = - (_rt::as_i32(e)) as u16; + *base.add(8).cast::() = (_rt::as_i32(e)) as u16; } V29::Uint32(e) => { *base.add(0).cast::() = (7i32) as u8; @@ -13401,8 +14092,7 @@ pub mod exports { let len27 = vec27.len(); ::core::mem::forget(vec27); *base.add(12).cast::() = len27; - *base.add(8).cast::<*mut u8>() = - ptr27.cast_mut(); + *base.add(8).cast::<*mut u8>() = ptr27.cast_mut(); } V29::Binary(e) => { *base.add(0).cast::() = (12i32) as u8; @@ -13411,8 +14101,7 @@ pub mod exports { let len28 = vec28.len(); ::core::mem::forget(vec28); *base.add(12).cast::() = len28; - *base.add(8).cast::<*mut u8>() = - ptr28.cast_mut(); + *base.add(8).cast::<*mut u8>() = ptr28.cast_mut(); } V29::DbNull => { *base.add(0).cast::() = (13i32) as u8; @@ -13492,64 +14181,64 @@ pub mod exports { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { 0 => { - let l3 = *arg0.add(4).cast::<*mut u8>(); - let l4 = *arg0.add(8).cast::(); - let base5 = l3; - let len5 = l4; + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base5 = l1; + let len5 = l2; for i in 0..len5 { let base = base5.add(i * 12); { - let l1 = *base.add(0).cast::<*mut u8>(); - let l2 = *base.add(4).cast::(); - _rt::cabi_dealloc(l1, l2, 1); + let l3 = *base.add(0).cast::<*mut u8>(); + let l4 = *base.add(4).cast::(); + _rt::cabi_dealloc(l3, l4, 1); } } _rt::cabi_dealloc(base5, len5 * 12, 4); - let l15 = *arg0.add(12).cast::<*mut u8>(); - let l16 = *arg0.add(16).cast::(); - let base17 = l15; - let len17 = l16; + let l6 = *arg0.add(12).cast::<*mut u8>(); + let l7 = *arg0.add(16).cast::(); + let base17 = l6; + let len17 = l7; for i in 0..len17 { let base = base17.add(i * 8); { - let l12 = *base.add(0).cast::<*mut u8>(); - let l13 = *base.add(4).cast::(); - let base14 = l12; - let len14 = l13; - for i in 0..len14 { - let base = base14.add(i * 16); + let l8 = *base.add(0).cast::<*mut u8>(); + let l9 = *base.add(4).cast::(); + let base16 = l8; + let len16 = l9; + for i in 0..len16 { + let base = base16.add(i * 16); { - let l6 = i32::from(*base.add(0).cast::()); - match l6 { - 0 => (), - 1 => (), - 2 => (), - 3 => (), - 4 => (), - 5 => (), - 6 => (), - 7 => (), - 8 => (), - 9 => (), - 10 => (), + let l10 = i32::from(*base.add(0).cast::()); + match l10 { + 0 => {} + 1 => {} + 2 => {} + 3 => {} + 4 => {} + 5 => {} + 6 => {} + 7 => {} + 8 => {} + 9 => {} + 10 => {} 11 => { - let l7 = *base.add(8).cast::<*mut u8>(); - let l8 = *base.add(12).cast::(); - _rt::cabi_dealloc(l7, l8, 1); + let l11 = *base.add(8).cast::<*mut u8>(); + let l12 = *base.add(12).cast::(); + _rt::cabi_dealloc(l11, l12, 1); } 12 => { - let l9 = *base.add(8).cast::<*mut u8>(); - let l10 = *base.add(12).cast::(); - let base11 = l9; - let len11 = l10; - _rt::cabi_dealloc(base11, len11 * 1, 1); + let l13 = *base.add(8).cast::<*mut u8>(); + let l14 = *base.add(12).cast::(); + let base15 = l13; + let len15 = l14; + _rt::cabi_dealloc(base15, len15 * 1, 1); } - 13 => (), - _ => (), + 13 => {} + _ => {} } } } - _rt::cabi_dealloc(base14, len14 * 16, 8); + _rt::cabi_dealloc(base16, len16 * 16, 8); } } _rt::cabi_dealloc(base17, len17 * 8, 4); @@ -13595,8 +14284,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let base20 = arg3; @@ -13611,7 +14299,6 @@ pub mod exports { 0 => { let e19 = { let l2 = i32::from(*base.add(8).cast::()); - _rt::bool_lift(l2 as u8) }; V19::Boolean(e19) @@ -13619,7 +14306,6 @@ pub mod exports { 1 => { let e19 = { let l3 = i32::from(*base.add(8).cast::()); - l3 as i8 }; V19::Int8(e19) @@ -13627,7 +14313,6 @@ pub mod exports { 2 => { let e19 = { let l4 = i32::from(*base.add(8).cast::()); - l4 as i16 }; V19::Int16(e19) @@ -13635,7 +14320,6 @@ pub mod exports { 3 => { let e19 = { let l5 = *base.add(8).cast::(); - l5 }; V19::Int32(e19) @@ -13643,7 +14327,6 @@ pub mod exports { 4 => { let e19 = { let l6 = *base.add(8).cast::(); - l6 }; V19::Int64(e19) @@ -13651,7 +14334,6 @@ pub mod exports { 5 => { let e19 = { let l7 = i32::from(*base.add(8).cast::()); - l7 as u8 }; V19::Uint8(e19) @@ -13659,7 +14341,6 @@ pub mod exports { 6 => { let e19 = { let l8 = i32::from(*base.add(8).cast::()); - l8 as u16 }; V19::Uint16(e19) @@ -13667,7 +14348,6 @@ pub mod exports { 7 => { let e19 = { let l9 = *base.add(8).cast::(); - l9 as u32 }; V19::Uint32(e19) @@ -13675,7 +14355,6 @@ pub mod exports { 8 => { let e19 = { let l10 = *base.add(8).cast::(); - l10 as u64 }; V19::Uint64(e19) @@ -13683,7 +14362,6 @@ pub mod exports { 9 => { let e19 = { let l11 = *base.add(8).cast::(); - l11 }; V19::Floating32(e19) @@ -13691,7 +14369,6 @@ pub mod exports { 10 => { let e19 = { let l12 = *base.add(8).cast::(); - l12 }; V19::Floating64(e19) @@ -13701,9 +14378,11 @@ pub mod exports { let l13 = *base.add(8).cast::<*mut u8>(); let l14 = *base.add(12).cast::(); let len15 = l14; - let bytes15 = - _rt::Vec::from_raw_parts(l13.cast(), len15, len15); - + let bytes15 = _rt::Vec::from_raw_parts( + l13.cast(), + len15, + len15, + ); _rt::string_lift(bytes15) }; V19::Str(e19) @@ -13713,7 +14392,6 @@ pub mod exports { let l16 = *base.add(8).cast::<*mut u8>(); let l17 = *base.add(12).cast::(); let len18 = l17; - _rt::Vec::from_raw_parts(l16.cast(), len18, len18) }; V19::Binary(e19) @@ -13723,7 +14401,6 @@ pub mod exports { V19::DbNull } }; - v19 }; result20.push(e20); @@ -13795,12 +14472,12 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_connection_execute( - arg0: *mut u8, - ) { + pub unsafe fn __post_return_method_connection_execute< + T: GuestConnection, + >(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { @@ -13847,10 +14524,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/mysql@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/mysql@2.0.0" + )] extern "C" { #[link_name = "[resource-new]connection"] fn new(_: *mut u8) -> u32; @@ -13858,7 +14536,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -13869,10 +14546,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/mysql@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/mysql@2.0.0" + )] extern "C" { #[link_name = "[resource-rep]connection"] fn rep(_: u32) -> *mut u8; @@ -13880,7 +14558,6 @@ pub mod exports { unsafe { rep(handle) } } } - /// Open a connection to the MySQL instance at `address`. fn open(address: _rt::String) -> Result; /// query the database: select @@ -13897,73 +14574,72 @@ pub mod exports { ) -> Result<(), Error>; } #[doc(hidden)] - - macro_rules! __export_fermyon_spin_mysql_2_0_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "fermyon:spin/mysql@2.0.0#[static]connection.open"] - unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { - $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1) - } - #[export_name = "cabi_post_fermyon:spin/mysql@2.0.0#[static]connection.open"] - unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { - $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/mysql@2.0.0#[method]connection.query"] - unsafe extern "C" fn export_method_connection_query(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_query_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/mysql@2.0.0#[method]connection.query"] - unsafe extern "C" fn _post_return_method_connection_query(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_query::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/mysql@2.0.0#[method]connection.execute"] - unsafe extern "C" fn export_method_connection_execute(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/mysql@2.0.0#[method]connection.execute"] - unsafe extern "C" fn _post_return_method_connection_execute(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_execute::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - - const _: () = { - #[doc(hidden)] - #[export_name = "fermyon:spin/mysql@2.0.0#[dtor]connection"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::Connection::dtor::< - <$ty as $($path_to_types)*::Guest>::Connection - >(rep) - } - }; - - };); -} + macro_rules! __export_fermyon_spin_mysql_2_0_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "fermyon:spin/mysql@2.0.0#[static]connection.open"] unsafe extern + "C" fn export_static_connection_open(arg0 : * mut u8, arg1 : + usize,) -> * mut u8 { $($path_to_types)*:: + _export_static_connection_open_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1) } + #[export_name = + "cabi_post_fermyon:spin/mysql@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_static_connection_open::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/mysql@2.0.0#[method]connection.query"] unsafe + extern "C" fn export_method_connection_query(arg0 : * mut u8, + arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> + * mut u8 { $($path_to_types)*:: + _export_method_connection_query_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4) } #[export_name = + "cabi_post_fermyon:spin/mysql@2.0.0#[method]connection.query"] + unsafe extern "C" fn _post_return_method_connection_query(arg0 : + * mut u8,) { $($path_to_types)*:: + __post_return_method_connection_query::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/mysql@2.0.0#[method]connection.execute"] unsafe + extern "C" fn export_method_connection_execute(arg0 : * mut u8, + arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> + * mut u8 { $($path_to_types)*:: + _export_method_connection_execute_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4) } #[export_name = + "cabi_post_fermyon:spin/mysql@2.0.0#[method]connection.execute"] + unsafe extern "C" fn _post_return_method_connection_execute(arg0 + : * mut u8,) { $($path_to_types)*:: + __post_return_method_connection_execute::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } const _ : () + = { #[doc(hidden)] #[export_name = + "fermyon:spin/mysql@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: Connection::dtor::< <$ty as + $($path_to_types)*:: Guest >::Connection > (rep) } }; }; + }; + } #[doc(hidden)] pub(crate) use __export_fermyon_spin_mysql_2_0_0_cabi; #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 20]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 20]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 20], + ); } - #[allow(dead_code, clippy::all)] pub mod sqlite { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; /// A handle to an open sqlite instance - #[derive(Debug)] #[repr(transparent)] pub struct Connection { handle: _rt::Resource, } - type _ConnectionRep = Option; - impl Connection { /// Creates a new resource from the specified representation. /// @@ -13973,77 +14649,68 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _ConnectionRep = Some(val); - let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestConnection` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); } - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`Connection`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -14052,7 +14719,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a Connection>, } - impl<'a> ConnectionBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -14061,41 +14727,34 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _ConnectionRep { Connection::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for Connection { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/sqlite@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/sqlite@2.0.0" + )] extern "C" { #[link_name = "[resource-drop]connection"] fn drop(_: u32); } - drop(_handle); } } } - /// The set of errors which may be raised by functions in this interface #[derive(Clone)] pub enum Error { @@ -14111,26 +14770,35 @@ pub mod exports { Io(_rt::String), } impl ::core::fmt::Debug for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Error::NoSuchDatabase => { f.debug_tuple("Error::NoSuchDatabase").finish() } - Error::AccessDenied => f.debug_tuple("Error::AccessDenied").finish(), + Error::AccessDenied => { + f.debug_tuple("Error::AccessDenied").finish() + } Error::InvalidConnection => { f.debug_tuple("Error::InvalidConnection").finish() } - Error::DatabaseFull => f.debug_tuple("Error::DatabaseFull").finish(), + Error::DatabaseFull => { + f.debug_tuple("Error::DatabaseFull").finish() + } Error::Io(e) => f.debug_tuple("Error::Io").field(e).finish(), } } } impl ::core::fmt::Display for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for Error {} /// A single column's result from a database query #[derive(Clone)] @@ -14142,12 +14810,23 @@ pub mod exports { Null, } impl ::core::fmt::Debug for Value { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - Value::Integer(e) => f.debug_tuple("Value::Integer").field(e).finish(), - Value::Real(e) => f.debug_tuple("Value::Real").field(e).finish(), - Value::Text(e) => f.debug_tuple("Value::Text").field(e).finish(), - Value::Blob(e) => f.debug_tuple("Value::Blob").field(e).finish(), + Value::Integer(e) => { + f.debug_tuple("Value::Integer").field(e).finish() + } + Value::Real(e) => { + f.debug_tuple("Value::Real").field(e).finish() + } + Value::Text(e) => { + f.debug_tuple("Value::Text").field(e).finish() + } + Value::Blob(e) => { + f.debug_tuple("Value::Blob").field(e).finish() + } Value::Null => f.debug_tuple("Value::Null").finish(), } } @@ -14158,7 +14837,10 @@ pub mod exports { pub values: _rt::Vec, } impl ::core::fmt::Debug for RowResult { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("RowResult") .field("values", &self.values) .finish() @@ -14173,7 +14855,10 @@ pub mod exports { pub rows: _rt::Vec, } impl ::core::fmt::Debug for QueryResult { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("QueryResult") .field("columns", &self.columns) .field("rows", &self.rows) @@ -14186,8 +14871,7 @@ pub mod exports { arg0: *mut u8, arg1: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg1; let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); let result1 = T::open(_rt::string_lift(bytes0)); @@ -14233,14 +14917,14 @@ pub mod exports { ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), - 3 => (), + 0 => {} + 1 => {} + 2 => {} + 3 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -14259,8 +14943,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let base11 = arg3; @@ -14274,7 +14957,6 @@ pub mod exports { 0 => { let e10 = { let l2 = *base.add(8).cast::(); - l2 }; Value::Integer(e10) @@ -14282,7 +14964,6 @@ pub mod exports { 1 => { let e10 = { let l3 = *base.add(8).cast::(); - l3 }; Value::Real(e10) @@ -14292,9 +14973,11 @@ pub mod exports { let l4 = *base.add(8).cast::<*mut u8>(); let l5 = *base.add(12).cast::(); let len6 = l5; - let bytes6 = - _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - + let bytes6 = _rt::Vec::from_raw_parts( + l4.cast(), + len6, + len6, + ); _rt::string_lift(bytes6) }; Value::Text(e10) @@ -14304,7 +14987,6 @@ pub mod exports { let l7 = *base.add(8).cast::<*mut u8>(); let l8 = *base.add(12).cast::(); let len9 = l8; - _rt::Vec::from_raw_parts(l7.cast(), len9, len9) }; Value::Blob(e10) @@ -14314,7 +14996,6 @@ pub mod exports { Value::Null } }; - v10 }; result11.push(e11); @@ -14329,14 +15010,13 @@ pub mod exports { match result12 { Ok(e) => { *ptr13.add(0).cast::() = (0i32) as u8; - let QueryResult { - columns: columns14, - rows: rows14, - } = e; + let QueryResult { columns: columns14, rows: rows14 } = e; let vec16 = columns14; let len16 = vec16.len(); - let layout16 = - _rt::alloc::Layout::from_size_align_unchecked(vec16.len() * 8, 4); + let layout16 = _rt::alloc::Layout::from_size_align_unchecked( + vec16.len() * 8, + 4, + ); let result16 = if layout16.size() != 0 { let ptr = _rt::alloc::alloc(layout16).cast::(); if ptr.is_null() { @@ -14344,9 +15024,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec16.into_iter().enumerate() { let base = result16.add(i * 8); @@ -14363,8 +15041,10 @@ pub mod exports { *ptr13.add(4).cast::<*mut u8>() = result16; let vec21 = rows14; let len21 = vec21.len(); - let layout21 = - _rt::alloc::Layout::from_size_align_unchecked(vec21.len() * 8, 4); + let layout21 = _rt::alloc::Layout::from_size_align_unchecked( + vec21.len() * 8, + 4, + ); let result21 = if layout21.size() != 0 { let ptr = _rt::alloc::alloc(layout21).cast::(); if ptr.is_null() { @@ -14372,9 +15052,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec21.into_iter().enumerate() { let base = result21.add(i * 8); @@ -14393,9 +15071,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec20.into_iter().enumerate() { let base = result20.add(i * 16); @@ -14416,8 +15092,7 @@ pub mod exports { let len18 = vec18.len(); ::core::mem::forget(vec18); *base.add(12).cast::() = len18; - *base.add(8).cast::<*mut u8>() = - ptr18.cast_mut(); + *base.add(8).cast::<*mut u8>() = ptr18.cast_mut(); } Value::Blob(e) => { *base.add(0).cast::() = (3i32) as u8; @@ -14426,8 +15101,7 @@ pub mod exports { let len19 = vec19.len(); ::core::mem::forget(vec19); *base.add(12).cast::() = len19; - *base.add(8).cast::<*mut u8>() = - ptr19.cast_mut(); + *base.add(8).cast::<*mut u8>() = ptr19.cast_mut(); } Value::Null => { *base.add(0).cast::() = (4i32) as u8; @@ -14473,60 +15147,60 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_connection_execute( - arg0: *mut u8, - ) { + pub unsafe fn __post_return_method_connection_execute< + T: GuestConnection, + >(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { 0 => { - let l3 = *arg0.add(4).cast::<*mut u8>(); - let l4 = *arg0.add(8).cast::(); - let base5 = l3; - let len5 = l4; + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base5 = l1; + let len5 = l2; for i in 0..len5 { let base = base5.add(i * 8); { - let l1 = *base.add(0).cast::<*mut u8>(); - let l2 = *base.add(4).cast::(); - _rt::cabi_dealloc(l1, l2, 1); + let l3 = *base.add(0).cast::<*mut u8>(); + let l4 = *base.add(4).cast::(); + _rt::cabi_dealloc(l3, l4, 1); } } _rt::cabi_dealloc(base5, len5 * 8, 4); - let l15 = *arg0.add(12).cast::<*mut u8>(); - let l16 = *arg0.add(16).cast::(); - let base17 = l15; - let len17 = l16; + let l6 = *arg0.add(12).cast::<*mut u8>(); + let l7 = *arg0.add(16).cast::(); + let base17 = l6; + let len17 = l7; for i in 0..len17 { let base = base17.add(i * 8); { - let l12 = *base.add(0).cast::<*mut u8>(); - let l13 = *base.add(4).cast::(); - let base14 = l12; - let len14 = l13; - for i in 0..len14 { - let base = base14.add(i * 16); + let l8 = *base.add(0).cast::<*mut u8>(); + let l9 = *base.add(4).cast::(); + let base16 = l8; + let len16 = l9; + for i in 0..len16 { + let base = base16.add(i * 16); { - let l6 = i32::from(*base.add(0).cast::()); - match l6 { - 0 => (), - 1 => (), + let l10 = i32::from(*base.add(0).cast::()); + match l10 { + 0 => {} + 1 => {} 2 => { - let l7 = *base.add(8).cast::<*mut u8>(); - let l8 = *base.add(12).cast::(); - _rt::cabi_dealloc(l7, l8, 1); + let l11 = *base.add(8).cast::<*mut u8>(); + let l12 = *base.add(12).cast::(); + _rt::cabi_dealloc(l11, l12, 1); } 3 => { - let l9 = *base.add(8).cast::<*mut u8>(); - let l10 = *base.add(12).cast::(); - let base11 = l9; - let len11 = l10; - _rt::cabi_dealloc(base11, len11 * 1, 1); + let l13 = *base.add(8).cast::<*mut u8>(); + let l14 = *base.add(12).cast::(); + let base15 = l13; + let len15 = l14; + _rt::cabi_dealloc(base15, len15 * 1, 1); } - _ => (), + _ => {} } } } - _rt::cabi_dealloc(base14, len14 * 16, 8); + _rt::cabi_dealloc(base16, len16 * 16, 8); } } _rt::cabi_dealloc(base17, len17 * 8, 4); @@ -14534,10 +15208,10 @@ pub mod exports { _ => { let l18 = i32::from(*arg0.add(4).cast::()); match l18 { - 0 => (), - 1 => (), - 2 => (), - 3 => (), + 0 => {} + 1 => {} + 2 => {} + 3 => {} _ => { let l19 = *arg0.add(8).cast::<*mut u8>(); let l20 = *arg0.add(12).cast::(); @@ -14561,10 +15235,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/sqlite@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/sqlite@2.0.0" + )] extern "C" { #[link_name = "[resource-new]connection"] fn new(_: *mut u8) -> u32; @@ -14572,7 +15247,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -14583,10 +15257,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/sqlite@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/sqlite@2.0.0" + )] extern "C" { #[link_name = "[resource-rep]connection"] fn rep(_: u32) -> *mut u8; @@ -14594,7 +15269,6 @@ pub mod exports { unsafe { rep(handle) } } } - /// Open a connection to a named database instance. /// /// If `database` is "default", the default instance is opened. @@ -14609,65 +15283,60 @@ pub mod exports { ) -> Result; } #[doc(hidden)] - - macro_rules! __export_fermyon_spin_sqlite_2_0_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "fermyon:spin/sqlite@2.0.0#[static]connection.open"] - unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { - $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1) - } - #[export_name = "cabi_post_fermyon:spin/sqlite@2.0.0#[static]connection.open"] - unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { - $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - #[export_name = "fermyon:spin/sqlite@2.0.0#[method]connection.execute"] - unsafe extern "C" fn export_method_connection_execute(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_connection_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/sqlite@2.0.0#[method]connection.execute"] - unsafe extern "C" fn _post_return_method_connection_execute(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_connection_execute::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) - } - - const _: () = { - #[doc(hidden)] - #[export_name = "fermyon:spin/sqlite@2.0.0#[dtor]connection"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::Connection::dtor::< - <$ty as $($path_to_types)*::Guest>::Connection - >(rep) - } - }; - - };); -} + macro_rules! __export_fermyon_spin_sqlite_2_0_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "fermyon:spin/sqlite@2.0.0#[static]connection.open"] unsafe + extern "C" fn export_static_connection_open(arg0 : * mut u8, arg1 + : usize,) -> * mut u8 { $($path_to_types)*:: + _export_static_connection_open_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1) } + #[export_name = + "cabi_post_fermyon:spin/sqlite@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_static_connection_open::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } #[export_name + = "fermyon:spin/sqlite@2.0.0#[method]connection.execute"] unsafe + extern "C" fn export_method_connection_execute(arg0 : * mut u8, + arg1 : * mut u8, arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> + * mut u8 { $($path_to_types)*:: + _export_method_connection_execute_cabi::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0, arg1, arg2, + arg3, arg4) } #[export_name = + "cabi_post_fermyon:spin/sqlite@2.0.0#[method]connection.execute"] + unsafe extern "C" fn _post_return_method_connection_execute(arg0 + : * mut u8,) { $($path_to_types)*:: + __post_return_method_connection_execute::<<$ty as + $($path_to_types)*:: Guest >::Connection > (arg0) } const _ : () + = { #[doc(hidden)] #[export_name = + "fermyon:spin/sqlite@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: Connection::dtor::< <$ty as + $($path_to_types)*:: Guest >::Connection > (rep) } }; }; + }; + } #[doc(hidden)] pub(crate) use __export_fermyon_spin_sqlite_2_0_0_cabi; #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 20]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 20]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 20], + ); } - #[allow(dead_code, clippy::all)] pub mod key_value { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; /// An open key-value store - #[derive(Debug)] #[repr(transparent)] pub struct Store { handle: _rt::Resource, } - type _StoreRep = Option; - impl Store { /// Creates a new resource from the specified representation. /// @@ -14677,77 +15346,68 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _StoreRep = Some(val); - let ptr: *mut _StoreRep = _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _StoreRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestStore` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); let _ = _rt::Box::from_raw(handle as *mut _StoreRep); } - fn as_ptr(&self) -> *mut _StoreRep { Store::type_guard::(); T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`Store`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -14756,7 +15416,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a Store>, } - impl<'a> StoreBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -14765,41 +15424,34 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _StoreRep { Store::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for Store { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/key-value@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/key-value@2.0.0" + )] extern "C" { #[link_name = "[resource-drop]store"] fn drop(_: u32); } - drop(_handle); } } } - /// The set of errors which may be raised by functions in this interface #[derive(Clone)] pub enum Error { @@ -14815,23 +15467,34 @@ pub mod exports { Other(_rt::String), } impl ::core::fmt::Debug for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Error::StoreTableFull => { f.debug_tuple("Error::StoreTableFull").finish() } - Error::NoSuchStore => f.debug_tuple("Error::NoSuchStore").finish(), - Error::AccessDenied => f.debug_tuple("Error::AccessDenied").finish(), - Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + Error::NoSuchStore => { + f.debug_tuple("Error::NoSuchStore").finish() + } + Error::AccessDenied => { + f.debug_tuple("Error::AccessDenied").finish() + } + Error::Other(e) => { + f.debug_tuple("Error::Other").field(e).finish() + } } } } impl ::core::fmt::Display for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for Error {} #[doc(hidden)] #[allow(non_snake_case)] @@ -14839,8 +15502,7 @@ pub mod exports { arg0: *mut u8, arg1: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg1; let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); let result1 = T::open(_rt::string_lift(bytes0)); @@ -14878,16 +15540,18 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_static_store_open(arg0: *mut u8) { + pub unsafe fn __post_return_static_store_open( + arg0: *mut u8, + ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -14904,8 +15568,7 @@ pub mod exports { arg1: *mut u8, arg2: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let result1 = T::get( @@ -14959,13 +15622,15 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_store_get(arg0: *mut u8) { + pub unsafe fn __post_return_method_store_get( + arg0: *mut u8, + ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { 0 => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), + 0 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -14978,9 +15643,9 @@ pub mod exports { _ => { let l5 = i32::from(*arg0.add(4).cast::()); match l5 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l6 = *arg0.add(8).cast::<*mut u8>(); let l7 = *arg0.add(12).cast::(); @@ -14999,8 +15664,7 @@ pub mod exports { arg3: *mut u8, arg4: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let len1 = arg4; @@ -15042,16 +15706,18 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_store_set(arg0: *mut u8) { + pub unsafe fn __post_return_method_store_set( + arg0: *mut u8, + ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -15068,8 +15734,7 @@ pub mod exports { arg1: *mut u8, arg2: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let result1 = T::delete( @@ -15109,16 +15774,18 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_store_delete(arg0: *mut u8) { + pub unsafe fn __post_return_method_store_delete( + arg0: *mut u8, + ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -15135,8 +15802,7 @@ pub mod exports { arg1: *mut u8, arg2: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg2; let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); let result1 = T::exists( @@ -15180,16 +15846,18 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_store_exists(arg0: *mut u8) { + pub unsafe fn __post_return_method_store_exists( + arg0: *mut u8, + ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(4).cast::()); match l1 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l2 = *arg0.add(8).cast::<*mut u8>(); let l3 = *arg0.add(12).cast::(); @@ -15204,17 +15872,20 @@ pub mod exports { pub unsafe fn _export_method_store_get_keys_cabi( arg0: *mut u8, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = T::get_keys(StoreBorrow::lift(arg0 as u32 as usize).get()); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::get_keys( + StoreBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { *ptr1.add(0).cast::() = (0i32) as u8; let vec3 = e; let len3 = vec3.len(); - let layout3 = - _rt::alloc::Layout::from_size_align_unchecked(vec3.len() * 8, 4); + let layout3 = _rt::alloc::Layout::from_size_align_unchecked( + vec3.len() * 8, + 4, + ); let result3 = if layout3.size() != 0 { let ptr = _rt::alloc::alloc(layout3).cast::(); if ptr.is_null() { @@ -15222,9 +15893,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec3.into_iter().enumerate() { let base = result3.add(i * 8); @@ -15268,20 +15937,22 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn __post_return_method_store_get_keys(arg0: *mut u8) { + pub unsafe fn __post_return_method_store_get_keys( + arg0: *mut u8, + ) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { 0 => { - let l3 = *arg0.add(4).cast::<*mut u8>(); - let l4 = *arg0.add(8).cast::(); - let base5 = l3; - let len5 = l4; + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base5 = l1; + let len5 = l2; for i in 0..len5 { let base = base5.add(i * 8); { - let l1 = *base.add(0).cast::<*mut u8>(); - let l2 = *base.add(4).cast::(); - _rt::cabi_dealloc(l1, l2, 1); + let l3 = *base.add(0).cast::<*mut u8>(); + let l4 = *base.add(4).cast::(); + _rt::cabi_dealloc(l3, l4, 1); } } _rt::cabi_dealloc(base5, len5 * 8, 4); @@ -15289,9 +15960,9 @@ pub mod exports { _ => { let l6 = i32::from(*arg0.add(4).cast::()); match l6 { - 0 => (), - 1 => (), - 2 => (), + 0 => {} + 1 => {} + 2 => {} _ => { let l7 = *arg0.add(8).cast::<*mut u8>(); let l8 = *arg0.add(12).cast::(); @@ -15315,10 +15986,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/key-value@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/key-value@2.0.0" + )] extern "C" { #[link_name = "[resource-new]store"] fn new(_: *mut u8) -> u32; @@ -15326,7 +15998,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -15337,10 +16008,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]fermyon:spin/key-value@2.0.0")] + #[link( + wasm_import_module = "[export]fermyon:spin/key-value@2.0.0" + )] extern "C" { #[link_name = "[resource-rep]store"] fn rep(_: u32) -> *mut u8; @@ -15348,7 +16020,6 @@ pub mod exports { unsafe { rep(handle) } } } - /// Open the store with the specified label. /// /// `label` must refer to a store allowed in the spin.toml manifest. @@ -15358,9 +16029,16 @@ pub mod exports { /// Get the value associated with the specified `key` /// /// Returns `ok(none)` if the key does not exist. - fn get(&self, key: _rt::String) -> Result>, Error>; + fn get( + &self, + key: _rt::String, + ) -> Result>, Error>; /// Set the `value` associated with the specified `key` overwriting any existing value. - fn set(&self, key: _rt::String, value: _rt::Vec) -> Result<(), Error>; + fn set( + &self, + key: _rt::String, + value: _rt::Vec, + ) -> Result<(), Error>; /// Delete the tuple with the specified `key` /// /// No error is raised if a tuple did not previously exist for `key`. @@ -15371,86 +16049,88 @@ pub mod exports { fn get_keys(&self) -> Result<_rt::Vec<_rt::String>, Error>; } #[doc(hidden)] - - macro_rules! __export_fermyon_spin_key_value_2_0_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "fermyon:spin/key-value@2.0.0#[static]store.open"] - unsafe extern "C" fn export_static_store_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { - $($path_to_types)*::_export_static_store_open_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1) - } - #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[static]store.open"] - unsafe extern "C" fn _post_return_static_store_open(arg0: *mut u8,) { - $($path_to_types)*::__post_return_static_store_open::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) - } - #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.get"] - unsafe extern "C" fn export_method_store_get(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_store_get_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1, arg2) - } - #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.get"] - unsafe extern "C" fn _post_return_method_store_get(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_store_get::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) - } - #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.set"] - unsafe extern "C" fn export_method_store_set(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_store_set_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1, arg2, arg3, arg4) - } - #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.set"] - unsafe extern "C" fn _post_return_method_store_set(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_store_set::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) - } - #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.delete"] - unsafe extern "C" fn export_method_store_delete(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_store_delete_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1, arg2) - } - #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.delete"] - unsafe extern "C" fn _post_return_method_store_delete(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_store_delete::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) - } - #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.exists"] - unsafe extern "C" fn export_method_store_exists(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_store_exists_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1, arg2) - } - #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.exists"] - unsafe extern "C" fn _post_return_method_store_exists(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_store_exists::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) - } - #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.get-keys"] - unsafe extern "C" fn export_method_store_get_keys(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_store_get_keys_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) - } - #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.get-keys"] - unsafe extern "C" fn _post_return_method_store_get_keys(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_store_get_keys::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) - } - - const _: () = { - #[doc(hidden)] - #[export_name = "fermyon:spin/key-value@2.0.0#[dtor]store"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::Store::dtor::< - <$ty as $($path_to_types)*::Guest>::Store - >(rep) - } - }; - - };); -} + macro_rules! __export_fermyon_spin_key_value_2_0_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "fermyon:spin/key-value@2.0.0#[static]store.open"] unsafe extern + "C" fn export_static_store_open(arg0 : * mut u8, arg1 : usize,) + -> * mut u8 { $($path_to_types)*:: + _export_static_store_open_cabi::<<$ty as $($path_to_types)*:: + Guest >::Store > (arg0, arg1) } #[export_name = + "cabi_post_fermyon:spin/key-value@2.0.0#[static]store.open"] + unsafe extern "C" fn _post_return_static_store_open(arg0 : * mut + u8,) { $($path_to_types)*:: + __post_return_static_store_open::<<$ty as $($path_to_types)*:: + Guest >::Store > (arg0) } #[export_name = + "fermyon:spin/key-value@2.0.0#[method]store.get"] unsafe extern + "C" fn export_method_store_get(arg0 : * mut u8, arg1 : * mut u8, + arg2 : usize,) -> * mut u8 { $($path_to_types)*:: + _export_method_store_get_cabi::<<$ty as $($path_to_types)*:: + Guest >::Store > (arg0, arg1, arg2) } #[export_name = + "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.get"] + unsafe extern "C" fn _post_return_method_store_get(arg0 : * mut + u8,) { $($path_to_types)*:: __post_return_method_store_get::<<$ty + as $($path_to_types)*:: Guest >::Store > (arg0) } #[export_name = + "fermyon:spin/key-value@2.0.0#[method]store.set"] unsafe extern + "C" fn export_method_store_set(arg0 : * mut u8, arg1 : * mut u8, + arg2 : usize, arg3 : * mut u8, arg4 : usize,) -> * mut u8 { + $($path_to_types)*:: _export_method_store_set_cabi::<<$ty as + $($path_to_types)*:: Guest >::Store > (arg0, arg1, arg2, arg3, + arg4) } #[export_name = + "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.set"] + unsafe extern "C" fn _post_return_method_store_set(arg0 : * mut + u8,) { $($path_to_types)*:: __post_return_method_store_set::<<$ty + as $($path_to_types)*:: Guest >::Store > (arg0) } #[export_name = + "fermyon:spin/key-value@2.0.0#[method]store.delete"] unsafe + extern "C" fn export_method_store_delete(arg0 : * mut u8, arg1 : + * mut u8, arg2 : usize,) -> * mut u8 { $($path_to_types)*:: + _export_method_store_delete_cabi::<<$ty as $($path_to_types)*:: + Guest >::Store > (arg0, arg1, arg2) } #[export_name = + "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.delete"] + unsafe extern "C" fn _post_return_method_store_delete(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_method_store_delete::<<$ty as $($path_to_types)*:: + Guest >::Store > (arg0) } #[export_name = + "fermyon:spin/key-value@2.0.0#[method]store.exists"] unsafe + extern "C" fn export_method_store_exists(arg0 : * mut u8, arg1 : + * mut u8, arg2 : usize,) -> * mut u8 { $($path_to_types)*:: + _export_method_store_exists_cabi::<<$ty as $($path_to_types)*:: + Guest >::Store > (arg0, arg1, arg2) } #[export_name = + "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.exists"] + unsafe extern "C" fn _post_return_method_store_exists(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_method_store_exists::<<$ty as $($path_to_types)*:: + Guest >::Store > (arg0) } #[export_name = + "fermyon:spin/key-value@2.0.0#[method]store.get-keys"] unsafe + extern "C" fn export_method_store_get_keys(arg0 : * mut u8,) -> * + mut u8 { $($path_to_types)*:: + _export_method_store_get_keys_cabi::<<$ty as $($path_to_types)*:: + Guest >::Store > (arg0) } #[export_name = + "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.get-keys"] + unsafe extern "C" fn _post_return_method_store_get_keys(arg0 : * + mut u8,) { $($path_to_types)*:: + __post_return_method_store_get_keys::<<$ty as + $($path_to_types)*:: Guest >::Store > (arg0) } const _ : () = { + #[doc(hidden)] #[export_name = + "fermyon:spin/key-value@2.0.0#[dtor]store"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: Store::dtor::< <$ty as + $($path_to_types)*:: Guest >::Store > (rep) } }; }; + }; + } #[doc(hidden)] pub(crate) use __export_fermyon_spin_key_value_2_0_0_cabi; #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 16]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); } - #[allow(dead_code, clippy::all)] pub mod variables { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; /// The set of errors which may be raised by functions in this interface. #[derive(Clone)] @@ -15465,7 +16145,10 @@ pub mod exports { Other(_rt::String), } impl ::core::fmt::Debug for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Error::InvalidName(e) => { f.debug_tuple("Error::InvalidName").field(e).finish() @@ -15476,22 +16159,28 @@ pub mod exports { Error::Provider(e) => { f.debug_tuple("Error::Provider").field(e).finish() } - Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + Error::Other(e) => { + f.debug_tuple("Error::Other").field(e).finish() + } } } } impl ::core::fmt::Display for Error { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - impl std::error::Error for Error {} #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_get_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + pub unsafe fn _export_get_cabi( + arg0: *mut u8, + arg1: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let len0 = arg1; let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); let result1 = T::get(_rt::string_lift(bytes0)); @@ -15594,25 +16283,24 @@ pub mod exports { fn get(name: _rt::String) -> Result<_rt::String, Error>; } #[doc(hidden)] - - macro_rules! __export_fermyon_spin_variables_2_0_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "fermyon:spin/variables@2.0.0#get"] - unsafe extern "C" fn export_get(arg0: *mut u8,arg1: usize,) -> *mut u8 { - $($path_to_types)*::_export_get_cabi::<$ty>(arg0, arg1) - } - #[export_name = "cabi_post_fermyon:spin/variables@2.0.0#get"] - unsafe extern "C" fn _post_return_get(arg0: *mut u8,) { - $($path_to_types)*::__post_return_get::<$ty>(arg0) - } - };); -} + macro_rules! __export_fermyon_spin_variables_2_0_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "fermyon:spin/variables@2.0.0#get"] unsafe extern "C" fn + export_get(arg0 : * mut u8, arg1 : usize,) -> * mut u8 { + $($path_to_types)*:: _export_get_cabi::<$ty > (arg0, arg1) } + #[export_name = "cabi_post_fermyon:spin/variables@2.0.0#get"] + unsafe extern "C" fn _post_return_get(arg0 : * mut u8,) { + $($path_to_types)*:: __post_return_get::<$ty > (arg0) } }; + }; + } #[doc(hidden)] pub(crate) use __export_fermyon_spin_variables_2_0_0_cabi; #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 16]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); } } } @@ -15624,20 +16312,20 @@ pub mod exports { pub mod environment { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + 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)] pub unsafe fn _export_get_environment_cabi() -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::get_environment(); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); let vec5 = result0; let len5 = vec5.len(); - let layout5 = _rt::alloc::Layout::from_size_align_unchecked(vec5.len() * 16, 4); + let layout5 = _rt::alloc::Layout::from_size_align_unchecked( + vec5.len() * 16, + 4, + ); let result5 = if layout5.size() != 0 { let ptr = _rt::alloc::alloc(layout5).cast::(); if ptr.is_null() { @@ -15645,9 +16333,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec5.into_iter().enumerate() { let base = result5.add(i * 16); @@ -15674,19 +16360,19 @@ pub mod exports { #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_get_environment(arg0: *mut u8) { - let l4 = *arg0.add(0).cast::<*mut u8>(); - let l5 = *arg0.add(4).cast::(); - let base6 = l4; - let len6 = l5; + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base6 = l0; + let len6 = l1; for i in 0..len6 { let base = base6.add(i * 16); { - let l0 = *base.add(0).cast::<*mut u8>(); - let l1 = *base.add(4).cast::(); - _rt::cabi_dealloc(l0, l1, 1); - let l2 = *base.add(8).cast::<*mut u8>(); - let l3 = *base.add(12).cast::(); + let l2 = *base.add(0).cast::<*mut u8>(); + let l3 = *base.add(4).cast::(); _rt::cabi_dealloc(l2, l3, 1); + let l4 = *base.add(8).cast::<*mut u8>(); + let l5 = *base.add(12).cast::(); + _rt::cabi_dealloc(l4, l5, 1); } } _rt::cabi_dealloc(base6, len6 * 16, 4); @@ -15694,13 +16380,15 @@ pub mod exports { #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_get_arguments_cabi() -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::get_arguments(); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = result0; let len3 = vec3.len(); - let layout3 = _rt::alloc::Layout::from_size_align_unchecked(vec3.len() * 8, 4); + let layout3 = _rt::alloc::Layout::from_size_align_unchecked( + vec3.len() * 8, + 4, + ); let result3 = if layout3.size() != 0 { let ptr = _rt::alloc::alloc(layout3).cast::(); if ptr.is_null() { @@ -15708,9 +16396,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec3.into_iter().enumerate() { let base = result3.add(i * 8); @@ -15730,16 +16416,16 @@ pub mod exports { #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_get_arguments(arg0: *mut u8) { - let l2 = *arg0.add(0).cast::<*mut u8>(); - let l3 = *arg0.add(4).cast::(); - let base4 = l2; - let len4 = l3; + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base4 = l0; + let len4 = l1; for i in 0..len4 { let base = base4.add(i * 8); { - let l0 = *base.add(0).cast::<*mut u8>(); - let l1 = *base.add(4).cast::(); - _rt::cabi_dealloc(l0, l1, 1); + let l2 = *base.add(0).cast::<*mut u8>(); + let l3 = *base.add(4).cast::(); + _rt::cabi_dealloc(l2, l3, 1); } } _rt::cabi_dealloc(base4, len4 * 8, 4); @@ -15747,8 +16433,7 @@ pub mod exports { #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_initial_cwd_cabi() -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::initial_cwd(); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { @@ -15772,7 +16457,7 @@ pub mod exports { pub unsafe fn __post_return_initial_cwd(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = *arg0.add(4).cast::<*mut u8>(); let l2 = *arg0.add(8).cast::(); @@ -15797,41 +16482,39 @@ pub mod exports { fn initial_cwd() -> Option<_rt::String>; } #[doc(hidden)] - - macro_rules! __export_wasi_cli_environment_0_2_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "wasi:cli/environment@0.2.0#get-environment"] - unsafe extern "C" fn export_get_environment() -> *mut u8 { - $($path_to_types)*::_export_get_environment_cabi::<$ty>() - } - #[export_name = "cabi_post_wasi:cli/environment@0.2.0#get-environment"] - unsafe extern "C" fn _post_return_get_environment(arg0: *mut u8,) { - $($path_to_types)*::__post_return_get_environment::<$ty>(arg0) - } - #[export_name = "wasi:cli/environment@0.2.0#get-arguments"] - unsafe extern "C" fn export_get_arguments() -> *mut u8 { - $($path_to_types)*::_export_get_arguments_cabi::<$ty>() - } - #[export_name = "cabi_post_wasi:cli/environment@0.2.0#get-arguments"] - unsafe extern "C" fn _post_return_get_arguments(arg0: *mut u8,) { - $($path_to_types)*::__post_return_get_arguments::<$ty>(arg0) - } - #[export_name = "wasi:cli/environment@0.2.0#initial-cwd"] - unsafe extern "C" fn export_initial_cwd() -> *mut u8 { - $($path_to_types)*::_export_initial_cwd_cabi::<$ty>() - } - #[export_name = "cabi_post_wasi:cli/environment@0.2.0#initial-cwd"] - unsafe extern "C" fn _post_return_initial_cwd(arg0: *mut u8,) { - $($path_to_types)*::__post_return_initial_cwd::<$ty>(arg0) - } - };); -} + macro_rules! __export_wasi_cli_environment_0_2_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "wasi:cli/environment@0.2.0#get-environment"] unsafe extern "C" + fn export_get_environment() -> * mut u8 { $($path_to_types)*:: + _export_get_environment_cabi::<$ty > () } #[export_name = + "cabi_post_wasi:cli/environment@0.2.0#get-environment"] unsafe + extern "C" fn _post_return_get_environment(arg0 : * mut u8,) { + $($path_to_types)*:: __post_return_get_environment::<$ty > (arg0) + } #[export_name = "wasi:cli/environment@0.2.0#get-arguments"] + unsafe extern "C" fn export_get_arguments() -> * mut u8 { + $($path_to_types)*:: _export_get_arguments_cabi::<$ty > () } + #[export_name = + "cabi_post_wasi:cli/environment@0.2.0#get-arguments"] unsafe + extern "C" fn _post_return_get_arguments(arg0 : * mut u8,) { + $($path_to_types)*:: __post_return_get_arguments::<$ty > (arg0) } + #[export_name = "wasi:cli/environment@0.2.0#initial-cwd"] unsafe + extern "C" fn export_initial_cwd() -> * mut u8 { + $($path_to_types)*:: _export_initial_cwd_cabi::<$ty > () } + #[export_name = + "cabi_post_wasi:cli/environment@0.2.0#initial-cwd"] unsafe extern + "C" fn _post_return_initial_cwd(arg0 : * mut u8,) { + $($path_to_types)*:: __post_return_initial_cwd::<$ty > (arg0) } + }; + }; + } #[doc(hidden)] pub(crate) use __export_wasi_cli_environment_0_2_0_cabi; #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 12]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 12]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); } } #[allow(dead_code)] @@ -15840,22 +16523,21 @@ pub mod exports { pub mod preopens { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; - pub type Descriptor = - super::super::super::super::wasi::filesystem0_2_0::types::Descriptor; + pub type Descriptor = super::super::super::super::wasi::filesystem0_2_0::types::Descriptor; #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_get_directories_cabi() -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::get_directories(); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); let vec4 = result0; let len4 = vec4.len(); - let layout4 = _rt::alloc::Layout::from_size_align_unchecked(vec4.len() * 12, 4); + let layout4 = _rt::alloc::Layout::from_size_align_unchecked( + vec4.len() * 12, + 4, + ); let result4 = if layout4.size() != 0 { let ptr = _rt::alloc::alloc(layout4).cast::(); if ptr.is_null() { @@ -15863,9 +16545,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec4.into_iter().enumerate() { let base = result4.add(i * 12); @@ -15887,43 +16567,45 @@ pub mod exports { #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn __post_return_get_directories(arg0: *mut u8) { - let l2 = *arg0.add(0).cast::<*mut u8>(); - let l3 = *arg0.add(4).cast::(); - let base4 = l2; - let len4 = l3; + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base4 = l0; + let len4 = l1; for i in 0..len4 { let base = base4.add(i * 12); { - let l0 = *base.add(4).cast::<*mut u8>(); - let l1 = *base.add(8).cast::(); - _rt::cabi_dealloc(l0, l1, 1); + let l2 = *base.add(4).cast::<*mut u8>(); + let l3 = *base.add(8).cast::(); + _rt::cabi_dealloc(l2, l3, 1); } } _rt::cabi_dealloc(base4, len4 * 12, 4); } pub trait Guest { + /// Return the set of preopened directories, and their path. fn get_directories() -> _rt::Vec<(Descriptor, _rt::String)>; } #[doc(hidden)] - - macro_rules! __export_wasi_filesystem_preopens_0_2_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "wasi:filesystem/preopens@0.2.0#get-directories"] - unsafe extern "C" fn export_get_directories() -> *mut u8 { - $($path_to_types)*::_export_get_directories_cabi::<$ty>() - } - #[export_name = "cabi_post_wasi:filesystem/preopens@0.2.0#get-directories"] - unsafe extern "C" fn _post_return_get_directories(arg0: *mut u8,) { - $($path_to_types)*::__post_return_get_directories::<$ty>(arg0) - } - };); - } + macro_rules! __export_wasi_filesystem_preopens_0_2_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "wasi:filesystem/preopens@0.2.0#get-directories"] unsafe extern + "C" fn export_get_directories() -> * mut u8 { + $($path_to_types)*:: _export_get_directories_cabi::<$ty > () } + #[export_name = + "cabi_post_wasi:filesystem/preopens@0.2.0#get-directories"] + unsafe extern "C" fn _post_return_get_directories(arg0 : * mut + u8,) { $($path_to_types)*:: __post_return_get_directories::<$ty > + (arg0) } }; + }; + } #[doc(hidden)] pub(crate) use __export_wasi_filesystem_preopens_0_2_0_cabi; #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 8]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 8]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); } } #[allow(dead_code)] @@ -15932,16 +16614,11 @@ pub mod exports { pub mod outgoing_handler { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; - pub type OutgoingRequest = - super::super::super::super::wasi::http0_2_0::types::OutgoingRequest; - pub type RequestOptions = - super::super::super::super::wasi::http0_2_0::types::RequestOptions; - pub type FutureIncomingResponse = - super::super::super::super::wasi::http0_2_0::types::FutureIncomingResponse; + pub type OutgoingRequest = super::super::super::super::wasi::http0_2_0::types::OutgoingRequest; + pub type RequestOptions = super::super::super::super::wasi::http0_2_0::types::RequestOptions; + pub type FutureIncomingResponse = super::super::super::super::wasi::http0_2_0::types::FutureIncomingResponse; pub type ErrorCode = super::super::super::super::wasi::http0_2_0::types::ErrorCode; #[doc(hidden)] #[allow(non_snake_case)] @@ -15950,16 +16627,22 @@ pub mod exports { arg1: i32, arg2: i32, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = T::handle(super::super::super::super::wasi::http0_2_0::types::OutgoingRequest::from_handle(arg0 as u32), match arg1 { - 0 => None, - 1 => { - let e = super::super::super::super::wasi::http0_2_0::types::RequestOptions::from_handle(arg2 as u32); - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::handle( + super::super::super::super::wasi::http0_2_0::types::OutgoingRequest::from_handle( + arg0 as u32, + ), + match arg1 { + 0 => None, + 1 => { + let e = super::super::super::super::wasi::http0_2_0::types::RequestOptions::from_handle( + arg2 as u32, + ); + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -15975,7 +16658,10 @@ pub mod exports { } V17::DnsError(e) => { *ptr1.add(8).cast::() = (1i32) as u8; - let super::super::super::super::wasi::http0_2_0::types::DnsErrorPayload{ rcode:rcode2, info_code:info_code2, } = e; + let super::super::super::super::wasi::http0_2_0::types::DnsErrorPayload { + rcode: rcode2, + info_code: info_code2, + } = e; match rcode2 { Some(e) => { *ptr1.add(16).cast::() = (1i32) as u8; @@ -16038,7 +16724,10 @@ pub mod exports { } V17::TlsAlertReceived(e) => { *ptr1.add(8).cast::() = (14i32) as u8; - let super::super::super::super::wasi::http0_2_0::types::TlsAlertReceivedPayload{ alert_id:alert_id4, alert_message:alert_message4, } = e; + let super::super::super::super::wasi::http0_2_0::types::TlsAlertReceivedPayload { + alert_id: alert_id4, + alert_message: alert_message4, + } = e; match alert_id4 { Some(e) => { *ptr1.add(16).cast::() = (1i32) as u8; @@ -16107,7 +16796,10 @@ pub mod exports { match e { Some(e) => { *ptr1.add(16).cast::() = (1i32) as u8; - let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload{ field_name:field_name6, field_size:field_size6, } = e; + let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload { + field_name: field_name6, + field_size: field_size6, + } = e; match field_name6 { Some(e) => { *ptr1.add(20).cast::() = (1i32) as u8; @@ -16116,8 +16808,7 @@ pub mod exports { let len7 = vec7.len(); ::core::mem::forget(vec7); *ptr1.add(28).cast::() = len7; - *ptr1.add(24).cast::<*mut u8>() = - ptr7.cast_mut(); + *ptr1.add(24).cast::<*mut u8>() = ptr7.cast_mut(); } None => { *ptr1.add(20).cast::() = (0i32) as u8; @@ -16152,7 +16843,10 @@ pub mod exports { } V17::HttpRequestTrailerSize(e) => { *ptr1.add(8).cast::() = (24i32) as u8; - let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload{ field_name:field_name8, field_size:field_size8, } = e; + let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload { + field_name: field_name8, + field_size: field_size8, + } = e; match field_name8 { Some(e) => { *ptr1.add(16).cast::() = (1i32) as u8; @@ -16194,7 +16888,10 @@ pub mod exports { } V17::HttpResponseHeaderSize(e) => { *ptr1.add(8).cast::() = (27i32) as u8; - let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload{ field_name:field_name10, field_size:field_size10, } = e; + let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload { + field_name: field_name10, + field_size: field_size10, + } = e; match field_name10 { Some(e) => { *ptr1.add(16).cast::() = (1i32) as u8; @@ -16245,7 +16942,10 @@ pub mod exports { } V17::HttpResponseTrailerSize(e) => { *ptr1.add(8).cast::() = (30i32) as u8; - let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload{ field_name:field_name12, field_size:field_size12, } = e; + let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload { + field_name: field_name12, + field_size: field_size12, + } = e; match field_name12 { Some(e) => { *ptr1.add(16).cast::() = (1i32) as u8; @@ -16346,15 +17046,15 @@ pub mod exports { pub unsafe fn __post_return_handle(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { - 0 => (), + 0 => {} _ => { let l1 = i32::from(*arg0.add(8).cast::()); match l1 { - 0 => (), + 0 => {} 1 => { let l2 = i32::from(*arg0.add(16).cast::()); match l2 { - 0 => (), + 0 => {} _ => { let l3 = *arg0.add(20).cast::<*mut u8>(); let l4 = *arg0.add(24).cast::(); @@ -16362,22 +17062,22 @@ pub mod exports { } } } - 2 => (), - 3 => (), - 4 => (), - 5 => (), - 6 => (), - 7 => (), - 8 => (), - 9 => (), - 10 => (), - 11 => (), - 12 => (), - 13 => (), + 2 => {} + 3 => {} + 4 => {} + 5 => {} + 6 => {} + 7 => {} + 8 => {} + 9 => {} + 10 => {} + 11 => {} + 12 => {} + 13 => {} 14 => { let l5 = i32::from(*arg0.add(20).cast::()); match l5 { - 0 => (), + 0 => {} _ => { let l6 = *arg0.add(24).cast::<*mut u8>(); let l7 = *arg0.add(28).cast::(); @@ -16385,21 +17085,21 @@ pub mod exports { } } } - 15 => (), - 16 => (), - 17 => (), - 18 => (), - 19 => (), - 20 => (), - 21 => (), + 15 => {} + 16 => {} + 17 => {} + 18 => {} + 19 => {} + 20 => {} + 21 => {} 22 => { let l8 = i32::from(*arg0.add(16).cast::()); match l8 { - 0 => (), + 0 => {} _ => { let l9 = i32::from(*arg0.add(20).cast::()); match l9 { - 0 => (), + 0 => {} _ => { let l10 = *arg0.add(24).cast::<*mut u8>(); let l11 = *arg0.add(28).cast::(); @@ -16409,11 +17109,11 @@ pub mod exports { } } } - 23 => (), + 23 => {} 24 => { let l12 = i32::from(*arg0.add(16).cast::()); match l12 { - 0 => (), + 0 => {} _ => { let l13 = *arg0.add(20).cast::<*mut u8>(); let l14 = *arg0.add(24).cast::(); @@ -16421,12 +17121,12 @@ pub mod exports { } } } - 25 => (), - 26 => (), + 25 => {} + 26 => {} 27 => { let l15 = i32::from(*arg0.add(16).cast::()); match l15 { - 0 => (), + 0 => {} _ => { let l16 = *arg0.add(20).cast::<*mut u8>(); let l17 = *arg0.add(24).cast::(); @@ -16434,12 +17134,12 @@ pub mod exports { } } } - 28 => (), - 29 => (), + 28 => {} + 29 => {} 30 => { let l18 = i32::from(*arg0.add(16).cast::()); match l18 { - 0 => (), + 0 => {} _ => { let l19 = *arg0.add(20).cast::<*mut u8>(); let l20 = *arg0.add(24).cast::(); @@ -16450,7 +17150,7 @@ pub mod exports { 31 => { let l21 = i32::from(*arg0.add(16).cast::()); match l21 { - 0 => (), + 0 => {} _ => { let l22 = *arg0.add(20).cast::<*mut u8>(); let l23 = *arg0.add(24).cast::(); @@ -16461,7 +17161,7 @@ pub mod exports { 32 => { let l24 = i32::from(*arg0.add(16).cast::()); match l24 { - 0 => (), + 0 => {} _ => { let l25 = *arg0.add(20).cast::<*mut u8>(); let l26 = *arg0.add(24).cast::(); @@ -16469,15 +17169,15 @@ pub mod exports { } } } - 33 => (), - 34 => (), - 35 => (), - 36 => (), - 37 => (), + 33 => {} + 34 => {} + 35 => {} + 36 => {} + 37 => {} _ => { let l27 = i32::from(*arg0.add(16).cast::()); match l27 { - 0 => (), + 0 => {} _ => { let l28 = *arg0.add(20).cast::<*mut u8>(); let l29 = *arg0.add(24).cast::(); @@ -16490,31 +17190,41 @@ pub mod exports { } } pub trait Guest { + /// This function is invoked with an outgoing HTTP Request, and it returns + /// a resource `future-incoming-response` which represents an HTTP Response + /// which may arrive in the future. + /// + /// The `options` argument accepts optional parameters for the HTTP + /// protocol's transport layer. + /// + /// This function may return an error if the `outgoing-request` is invalid + /// or not allowed to be made. Otherwise, protocol errors are reported + /// through the `future-incoming-response`. fn handle( request: OutgoingRequest, options: Option, ) -> Result; } #[doc(hidden)] - - macro_rules! __export_wasi_http_outgoing_handler_0_2_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "wasi:http/outgoing-handler@0.2.0#handle"] - unsafe extern "C" fn export_handle(arg0: i32,arg1: i32,arg2: i32,) -> *mut u8 { - $($path_to_types)*::_export_handle_cabi::<$ty>(arg0, arg1, arg2) - } - #[export_name = "cabi_post_wasi:http/outgoing-handler@0.2.0#handle"] - unsafe extern "C" fn _post_return_handle(arg0: *mut u8,) { - $($path_to_types)*::__post_return_handle::<$ty>(arg0) - } - };); - } + macro_rules! __export_wasi_http_outgoing_handler_0_2_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "wasi:http/outgoing-handler@0.2.0#handle"] unsafe extern "C" fn + export_handle(arg0 : i32, arg1 : i32, arg2 : i32,) -> * mut u8 { + $($path_to_types)*:: _export_handle_cabi::<$ty > (arg0, arg1, + arg2) } #[export_name = + "cabi_post_wasi:http/outgoing-handler@0.2.0#handle"] unsafe + extern "C" fn _post_return_handle(arg0 : * mut u8,) { + $($path_to_types)*:: __post_return_handle::<$ty > (arg0) } }; + }; + } #[doc(hidden)] pub(crate) use __export_wasi_http_outgoing_handler_0_2_0_cabi; #[repr(align(8))] struct _RetArea([::core::mem::MaybeUninit; 40]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 40]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 40], + ); } } #[allow(dead_code)] @@ -16523,25 +17233,18 @@ pub mod exports { pub mod ip_name_lookup { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; pub type Pollable = super::super::super::super::wasi::io0_2_0::poll::Pollable; pub type Network = super::super::super::super::wasi::sockets0_2_0::network::Network; - pub type ErrorCode = - super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; - pub type IpAddress = - super::super::super::super::wasi::sockets0_2_0::network::IpAddress; - + pub type ErrorCode = super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; + pub type IpAddress = super::super::super::super::wasi::sockets0_2_0::network::IpAddress; #[derive(Debug)] #[repr(transparent)] pub struct ResolveAddressStream { handle: _rt::Resource, } - type _ResolveAddressStreamRep = Option; - impl ResolveAddressStream { /// Creates a new resource from the specified representation. /// @@ -16551,72 +17254,65 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _ResolveAddressStreamRep = Some(val); - let ptr: *mut _ResolveAddressStreamRep = - _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _ResolveAddressStreamRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestResolveAddressStream` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); - let _ = _rt::Box::from_raw(handle as *mut _ResolveAddressStreamRep); + let _ = _rt::Box::from_raw( + handle as *mut _ResolveAddressStreamRep, + ); } - fn as_ptr( &self, ) -> *mut _ResolveAddressStreamRep { @@ -16624,7 +17320,6 @@ pub mod exports { T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`ResolveAddressStream`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -16633,7 +17328,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a ResolveAddressStream>, } - impl<'a> ResolveAddressStreamBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -16642,28 +17336,21 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _ResolveAddressStreamRep { ResolveAddressStream::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for ResolveAddressStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { #[link( @@ -16673,21 +17360,16 @@ pub mod exports { #[link_name = "[resource-drop]resolve-address-stream"] fn drop(_: u32); } - drop(_handle); } } } - #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_method_resolve_address_stream_resolve_next_address_cabi< T: GuestResolveAddressStream, - >( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::resolve_next_address( ResolveAddressStreamBorrow::lift(arg0 as u32 as usize).get(), ); @@ -16710,22 +17392,15 @@ pub mod exports { } V4::Ipv6(e) => { *ptr1.add(4).cast::() = (1i32) as u8; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = - e; + let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = e; *ptr1.add(6).cast::() = (_rt::as_i32(t3_0)) as u16; *ptr1.add(8).cast::() = (_rt::as_i32(t3_1)) as u16; - *ptr1.add(10).cast::() = - (_rt::as_i32(t3_2)) as u16; - *ptr1.add(12).cast::() = - (_rt::as_i32(t3_3)) as u16; - *ptr1.add(14).cast::() = - (_rt::as_i32(t3_4)) as u16; - *ptr1.add(16).cast::() = - (_rt::as_i32(t3_5)) as u16; - *ptr1.add(18).cast::() = - (_rt::as_i32(t3_6)) as u16; - *ptr1.add(20).cast::() = - (_rt::as_i32(t3_7)) as u16; + *ptr1.add(10).cast::() = (_rt::as_i32(t3_2)) as u16; + *ptr1.add(12).cast::() = (_rt::as_i32(t3_3)) as u16; + *ptr1.add(14).cast::() = (_rt::as_i32(t3_4)) as u16; + *ptr1.add(16).cast::() = (_rt::as_i32(t3_5)) as u16; + *ptr1.add(18).cast::() = (_rt::as_i32(t3_6)) as u16; + *ptr1.add(20).cast::() = (_rt::as_i32(t3_7)) as u16; } } } @@ -16745,13 +17420,11 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_resolve_address_stream_subscribe_cabi< T: GuestResolveAddressStream, - >( - arg0: *mut u8, - ) -> i32 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::subscribe(ResolveAddressStreamBorrow::lift(arg0 as u32 as usize).get()); + >(arg0: *mut u8) -> i32 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::subscribe( + ResolveAddressStreamBorrow::lift(arg0 as u32 as usize).get(), + ); (result0).take_handle() as i32 } #[doc(hidden)] @@ -16761,14 +17434,15 @@ pub mod exports { arg1: *mut u8, arg2: usize, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let handle0; let len1 = arg2; let bytes1 = _rt::Vec::from_raw_parts(arg1.cast(), len1, len1); let result2 = T::resolve_addresses( { - handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle(arg0 as u32); + handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle( + arg0 as u32, + ); &handle0 }, _rt::string_lift(bytes1), @@ -16788,6 +17462,26 @@ pub mod exports { } pub trait Guest { type ResolveAddressStream: GuestResolveAddressStream; + /// Resolve an internet host name to a list of IP addresses. + /// + /// Unicode domain names are automatically converted to ASCII using IDNA encoding. + /// If the input is an IP address string, the address is parsed and returned + /// as-is without making any external requests. + /// + /// See the wasi-socket proposal README.md for a comparison with getaddrinfo. + /// + /// This function never blocks. It either immediately fails or immediately + /// returns successfully with a `resolve-address-stream` that can be used + /// to (asynchronously) fetch the results. + /// + /// # Typical errors + /// - `invalid-argument`: `name` is a syntactically invalid domain name or IP address. + /// + /// # References: + /// - + /// - + /// - + /// - fn resolve_addresses( network: &Network, name: _rt::String, @@ -16804,7 +17498,6 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { #[link( @@ -16817,7 +17510,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -16828,7 +17520,6 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { #[link( @@ -16841,114 +17532,149 @@ pub mod exports { unsafe { rep(handle) } } } - - fn resolve_next_address(&self) -> Result, ErrorCode>; + /// Returns the next address from the resolver. + /// + /// This function should be called multiple times. On each call, it will + /// return the next address in connection order preference. If all + /// addresses have been exhausted, this function returns `none`. + /// + /// This function never returns IPv4-mapped IPv6 addresses. + /// + /// # Typical errors + /// - `name-unresolvable`: Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY) + /// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN) + /// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL) + /// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN) + fn resolve_next_address( + &self, + ) -> Result, ErrorCode>; + /// Create a `pollable` which will resolve once the stream is ready for I/O. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. fn subscribe(&self) -> Pollable; } #[doc(hidden)] - - macro_rules! __export_wasi_sockets_ip_name_lookup_0_2_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "wasi:sockets/ip-name-lookup@0.2.0#[method]resolve-address-stream.resolve-next-address"] - unsafe extern "C" fn export_method_resolve_address_stream_resolve_next_address(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_resolve_address_stream_resolve_next_address_cabi::<<$ty as $($path_to_types)*::Guest>::ResolveAddressStream>(arg0) - } - #[export_name = "wasi:sockets/ip-name-lookup@0.2.0#[method]resolve-address-stream.subscribe"] - unsafe extern "C" fn export_method_resolve_address_stream_subscribe(arg0: *mut u8,) -> i32 { - $($path_to_types)*::_export_method_resolve_address_stream_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::ResolveAddressStream>(arg0) - } - #[export_name = "wasi:sockets/ip-name-lookup@0.2.0#resolve-addresses"] - unsafe extern "C" fn export_resolve_addresses(arg0: i32,arg1: *mut u8,arg2: usize,) -> *mut u8 { - $($path_to_types)*::_export_resolve_addresses_cabi::<$ty>(arg0, arg1, arg2) - } - - const _: () = { - #[doc(hidden)] - #[export_name = "wasi:sockets/ip-name-lookup@0.2.0#[dtor]resolve-address-stream"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::ResolveAddressStream::dtor::< - <$ty as $($path_to_types)*::Guest>::ResolveAddressStream - >(rep) - } - }; - - };); - } + macro_rules! __export_wasi_sockets_ip_name_lookup_0_2_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "wasi:sockets/ip-name-lookup@0.2.0#[method]resolve-address-stream.resolve-next-address"] + unsafe extern "C" fn + export_method_resolve_address_stream_resolve_next_address(arg0 : + * mut u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_resolve_address_stream_resolve_next_address_cabi::<<$ty + as $($path_to_types)*:: Guest >::ResolveAddressStream > (arg0) } + #[export_name = + "wasi:sockets/ip-name-lookup@0.2.0#[method]resolve-address-stream.subscribe"] + unsafe extern "C" fn + export_method_resolve_address_stream_subscribe(arg0 : * mut u8,) + -> i32 { $($path_to_types)*:: + _export_method_resolve_address_stream_subscribe_cabi::<<$ty as + $($path_to_types)*:: Guest >::ResolveAddressStream > (arg0) } + #[export_name = + "wasi:sockets/ip-name-lookup@0.2.0#resolve-addresses"] unsafe + extern "C" fn export_resolve_addresses(arg0 : i32, arg1 : * mut + u8, arg2 : usize,) -> * mut u8 { $($path_to_types)*:: + _export_resolve_addresses_cabi::<$ty > (arg0, arg1, arg2) } const + _ : () = { #[doc(hidden)] #[export_name = + "wasi:sockets/ip-name-lookup@0.2.0#[dtor]resolve-address-stream"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: ResolveAddressStream::dtor::< <$ty as + $($path_to_types)*:: Guest >::ResolveAddressStream > (rep) } }; + }; + }; + } #[doc(hidden)] pub(crate) use __export_wasi_sockets_ip_name_lookup_0_2_0_cabi; #[repr(align(4))] struct _RetArea([::core::mem::MaybeUninit; 22]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 22]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 22], + ); } - #[allow(dead_code, clippy::all)] pub mod tcp { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; - pub type InputStream = - super::super::super::super::wasi::io0_2_0::streams::InputStream; - pub type OutputStream = - super::super::super::super::wasi::io0_2_0::streams::OutputStream; + pub type InputStream = super::super::super::super::wasi::io0_2_0::streams::InputStream; + pub type OutputStream = super::super::super::super::wasi::io0_2_0::streams::OutputStream; pub type Pollable = super::super::super::super::wasi::io0_2_0::poll::Pollable; - pub type Duration = - super::super::super::super::wasi::clocks0_2_0::monotonic_clock::Duration; + pub type Duration = super::super::super::super::wasi::clocks0_2_0::monotonic_clock::Duration; pub type Network = super::super::super::super::wasi::sockets0_2_0::network::Network; - pub type ErrorCode = - super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; - pub type IpSocketAddress = - super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress; - pub type IpAddressFamily = - super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily; + pub type ErrorCode = super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; + pub type IpSocketAddress = super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress; + pub type IpAddressFamily = super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily; #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum ShutdownType { + /// Similar to `SHUT_RD` in POSIX. Receive, + /// Similar to `SHUT_WR` in POSIX. Send, + /// Similar to `SHUT_RDWR` in POSIX. Both, } impl ::core::fmt::Debug for ShutdownType { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { ShutdownType::Receive => { f.debug_tuple("ShutdownType::Receive").finish() } - ShutdownType::Send => f.debug_tuple("ShutdownType::Send").finish(), - ShutdownType::Both => f.debug_tuple("ShutdownType::Both").finish(), + ShutdownType::Send => { + f.debug_tuple("ShutdownType::Send").finish() + } + ShutdownType::Both => { + f.debug_tuple("ShutdownType::Both").finish() + } } } } - impl ShutdownType { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> ShutdownType { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => ShutdownType::Receive, 1 => ShutdownType::Send, 2 => ShutdownType::Both, - _ => panic!("invalid enum discriminant"), } } } - + /// A TCP socket resource. + /// + /// The socket can be in one of the following states: + /// - `unbound` + /// - `bind-in-progress` + /// - `bound` (See note below) + /// - `listen-in-progress` + /// - `listening` + /// - `connect-in-progress` + /// - `connected` + /// - `closed` + /// See + /// for a more information. + /// + /// Note: Except where explicitly mentioned, whenever this documentation uses + /// the term "bound" without backticks it actually means: in the `bound` state *or higher*. + /// (i.e. `bound`, `listen-in-progress`, `listening`, `connect-in-progress` or `connected`) + /// + /// In addition to the general error codes documented on the + /// `network::error-code` type, TCP socket methods may always return + /// `error(invalid-state)` when in the `closed` state. #[derive(Debug)] #[repr(transparent)] pub struct TcpSocket { handle: _rt::Resource, } - type _TcpSocketRep = Option; - impl TcpSocket { /// Creates a new resource from the specified representation. /// @@ -16958,77 +17684,68 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _TcpSocketRep = Some(val); - let ptr: *mut _TcpSocketRep = _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _TcpSocketRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestTcpSocket` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); let _ = _rt::Box::from_raw(handle as *mut _TcpSocketRep); } - fn as_ptr(&self) -> *mut _TcpSocketRep { TcpSocket::type_guard::(); T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`TcpSocket`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -17037,7 +17754,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a TcpSocket>, } - impl<'a> TcpSocketBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -17046,44 +17762,39 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _TcpSocketRep { TcpSocket::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for TcpSocket { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/tcp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/tcp@0.2.0" + )] extern "C" { #[link_name = "[resource-drop]tcp-socket"] fn drop(_: u32); } - drop(_handle); } } } - #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_start_bind_cabi( + pub unsafe fn _export_method_tcp_socket_start_bind_cabi< + T: GuestTcpSocket, + >( arg0: *mut u8, arg1: i32, arg2: i32, @@ -17099,33 +17810,43 @@ pub mod exports { arg12: i32, arg13: i32, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let handle0; use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V1; let v1 = match arg2 { 0 => { - let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ - port: arg3 as u16, - address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), - }; + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { + port: arg3 as u16, + address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), + }; V1::Ipv4(e1) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ - port: arg3 as u16, - flow_info: arg4 as u32, - address: (arg5 as u16, arg6 as u16, arg7 as u16, arg8 as u16, arg9 as u16, arg10 as u16, arg11 as u16, arg12 as u16), - scope_id: arg13 as u32, - }; + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { + port: arg3 as u16, + flow_info: arg4 as u32, + address: ( + arg5 as u16, + arg6 as u16, + arg7 as u16, + arg8 as u16, + arg9 as u16, + arg10 as u16, + arg11 as u16, + arg12 as u16, + ), + scope_id: arg13 as u32, + }; V1::Ipv6(e1) } }; let result2 = T::start_bind( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), { - handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle(arg1 as u32); + handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle( + arg1 as u32, + ); &handle0 }, v1, @@ -17144,12 +17865,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_finish_bind_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = T::finish_bind(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_finish_bind_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::finish_bind( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(_) => { @@ -17164,7 +17886,9 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_start_connect_cabi( + pub unsafe fn _export_method_tcp_socket_start_connect_cabi< + T: GuestTcpSocket, + >( arg0: *mut u8, arg1: i32, arg2: i32, @@ -17180,33 +17904,43 @@ pub mod exports { arg12: i32, arg13: i32, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let handle0; use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V1; let v1 = match arg2 { 0 => { - let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { port: arg3 as u16, address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), - }; + }; V1::Ipv4(e1) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { port: arg3 as u16, flow_info: arg4 as u32, - address: (arg5 as u16, arg6 as u16, arg7 as u16, arg8 as u16, arg9 as u16, arg10 as u16, arg11 as u16, arg12 as u16), + address: ( + arg5 as u16, + arg6 as u16, + arg7 as u16, + arg8 as u16, + arg9 as u16, + arg10 as u16, + arg11 as u16, + arg12 as u16, + ), scope_id: arg13 as u32, - }; + }; V1::Ipv6(e1) } }; let result2 = T::start_connect( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), { - handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle(arg1 as u32); + handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle( + arg1 as u32, + ); &handle0 }, v1, @@ -17225,13 +17959,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_finish_connect_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::finish_connect(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_finish_connect_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::finish_connect( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17249,13 +17983,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_start_listen_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::start_listen(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_start_listen_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::start_listen( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(_) => { @@ -17270,13 +18004,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_finish_listen_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::finish_listen(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_finish_listen_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::finish_listen( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(_) => { @@ -17294,9 +18028,10 @@ pub mod exports { pub unsafe fn _export_method_tcp_socket_accept_cabi( arg0: *mut u8, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = T::accept(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::accept( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17315,13 +18050,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_local_address_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::local_address(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_local_address_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::local_address( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17330,7 +18065,10 @@ pub mod exports { match e { V6::Ipv4(e) => { *ptr1.add(4).cast::() = (0i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port2, address:address2, } = e; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { + port: port2, + address: address2, + } = e; *ptr1.add(8).cast::() = (_rt::as_i32(port2)) as u16; let (t3_0, t3_1, t3_2, t3_3) = address2; *ptr1.add(10).cast::() = (_rt::as_i32(t3_0)) as u8; @@ -17340,7 +18078,12 @@ pub mod exports { } V6::Ipv6(e) => { *ptr1.add(4).cast::() = (1i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port4, flow_info:flow_info4, address:address4, scope_id:scope_id4, } = e; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { + port: port4, + flow_info: flow_info4, + address: address4, + scope_id: scope_id4, + } = e; *ptr1.add(8).cast::() = (_rt::as_i32(port4)) as u16; *ptr1.add(12).cast::() = _rt::as_i32(flow_info4); let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; @@ -17365,13 +18108,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_remote_address_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::remote_address(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_remote_address_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::remote_address( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17380,7 +18123,10 @@ pub mod exports { match e { V6::Ipv4(e) => { *ptr1.add(4).cast::() = (0i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port2, address:address2, } = e; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { + port: port2, + address: address2, + } = e; *ptr1.add(8).cast::() = (_rt::as_i32(port2)) as u16; let (t3_0, t3_1, t3_2, t3_3) = address2; *ptr1.add(10).cast::() = (_rt::as_i32(t3_0)) as u8; @@ -17390,7 +18136,12 @@ pub mod exports { } V6::Ipv6(e) => { *ptr1.add(4).cast::() = (1i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port4, flow_info:flow_info4, address:address4, scope_id:scope_id4, } = e; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { + port: port4, + flow_info: flow_info4, + address: address4, + scope_id: scope_id4, + } = e; *ptr1.add(8).cast::() = (_rt::as_i32(port4)) as u16; *ptr1.add(12).cast::() = _rt::as_i32(flow_info4); let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; @@ -17415,13 +18166,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_is_listening_cabi( - arg0: *mut u8, - ) -> i32 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::is_listening(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_is_listening_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> i32 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::is_listening( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); match result0 { true => 1, false => 0, @@ -17429,25 +18180,21 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_address_family_cabi( - arg0: *mut u8, - ) -> i32 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::address_family(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_address_family_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> i32 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::address_family( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); result0.clone() as i32 } #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_set_listen_backlog_size_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - arg1: i64, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i64) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_listen_backlog_size( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u64, @@ -17468,13 +18215,11 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_keep_alive_enabled_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::keep_alive_enabled(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::keep_alive_enabled( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17495,12 +18240,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_set_keep_alive_enabled_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - arg1: i32, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i32) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_keep_alive_enabled( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), _rt::bool_lift(arg1 as u8), @@ -17521,13 +18262,11 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_keep_alive_idle_time_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::keep_alive_idle_time(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::keep_alive_idle_time( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17545,12 +18284,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_set_keep_alive_idle_time_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - arg1: i64, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i64) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_keep_alive_idle_time( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u64, @@ -17571,13 +18306,11 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_keep_alive_interval_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::keep_alive_interval(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::keep_alive_interval( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17595,12 +18328,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_set_keep_alive_interval_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - arg1: i64, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i64) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_keep_alive_interval( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u64, @@ -17619,13 +18348,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_keep_alive_count_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::keep_alive_count(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_keep_alive_count_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::keep_alive_count( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17643,12 +18372,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_set_keep_alive_count_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - arg1: i32, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i32) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_keep_alive_count( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u32, @@ -17667,12 +18392,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_hop_limit_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = T::hop_limit(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_hop_limit_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::hop_limit( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17688,12 +18414,10 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_set_hop_limit_cabi( - arg0: *mut u8, - arg1: i32, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + pub unsafe fn _export_method_tcp_socket_set_hop_limit_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8, arg1: i32) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_hop_limit( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u8, @@ -17714,13 +18438,11 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_receive_buffer_size_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::receive_buffer_size(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::receive_buffer_size( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17738,12 +18460,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_set_receive_buffer_size_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - arg1: i64, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i64) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_receive_buffer_size( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u64, @@ -17762,13 +18480,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_send_buffer_size_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::send_buffer_size(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_send_buffer_size_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::send_buffer_size( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -17786,12 +18504,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_tcp_socket_set_send_buffer_size_cabi< T: GuestTcpSocket, - >( - arg0: *mut u8, - arg1: i64, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i64) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_send_buffer_size( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u64, @@ -17810,12 +18524,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_tcp_socket_subscribe_cabi( - arg0: *mut u8, - ) -> i32 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = T::subscribe(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_tcp_socket_subscribe_cabi< + T: GuestTcpSocket, + >(arg0: *mut u8) -> i32 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::subscribe( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); (result0).take_handle() as i32 } #[doc(hidden)] @@ -17824,8 +18539,7 @@ pub mod exports { arg0: *mut u8, arg1: i32, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::shutdown( TcpSocketBorrow::lift(arg0 as u32 as usize).get(), ShutdownType::_lift(arg1 as u8), @@ -17856,10 +18570,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/tcp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/tcp@0.2.0" + )] extern "C" { #[link_name = "[resource-new]tcp-socket"] fn new(_: *mut u8) -> u32; @@ -17867,7 +18582,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -17878,10 +18592,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/tcp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/tcp@0.2.0" + )] extern "C" { #[link_name = "[resource-rep]tcp-socket"] fn rep(_: u32) -> *mut u8; @@ -17889,233 +18604,676 @@ pub mod exports { unsafe { rep(handle) } } } - + /// Bind the socket to a specific network on the provided IP address and port. + /// + /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which + /// network interface(s) to bind to. + /// If the TCP/UDP port is zero, the socket will be bound to a random free port. + /// + /// Bind can be attempted multiple times on the same socket, even with + /// different arguments on each iteration. But never concurrently and + /// only as long as the previous bind failed. Once a bind succeeds, the + /// binding can't be changed anymore. + /// + /// # Typical errors + /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) + /// - `invalid-argument`: `local-address` is not a unicast address. (EINVAL) + /// - `invalid-argument`: `local-address` is an IPv4-mapped IPv6 address. (EINVAL) + /// - `invalid-state`: The socket is already bound. (EINVAL) + /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) + /// - `address-in-use`: Address is already in use. (EADDRINUSE) + /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) + /// - `not-in-progress`: A `bind` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT + /// state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR + /// socket option should be set implicitly on all platforms, except on Windows where this is the default behavior + /// and SO_REUSEADDR performs something different entirely. + /// + /// Unlike in POSIX, in WASI the bind operation is async. This enables + /// interactive WASI hosts to inject permission prompts. Runtimes that + /// don't want to make use of this ability can simply call the native + /// `bind` as part of either `start-bind` or `finish-bind`. + /// + /// # References + /// - + /// - + /// - + /// - fn start_bind( &self, network: &Network, local_address: IpSocketAddress, ) -> Result<(), ErrorCode>; fn finish_bind(&self) -> Result<(), ErrorCode>; + /// Connect to a remote endpoint. + /// + /// On success: + /// - the socket is transitioned into the `connection` state. + /// - a pair of streams is returned that can be used to read & write to the connection + /// + /// After a failed connection attempt, the socket will be in the `closed` + /// state and the only valid action left is to `drop` the socket. A single + /// socket can not be used to connect more than once. + /// + /// # Typical errors + /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-argument`: `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS) + /// - `invalid-argument`: `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos) + /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows) + /// - `invalid-argument`: The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows) + /// - `invalid-argument`: The socket is already attached to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`. + /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN) + /// - `invalid-state`: The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows) + /// - `timeout`: Connection timed out. (ETIMEDOUT) + /// - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED) + /// - `connection-reset`: The connection was reset. (ECONNRESET) + /// - `connection-aborted`: The connection was aborted. (ECONNABORTED) + /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) + /// - `not-in-progress`: A connect operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// The POSIX equivalent of `start-connect` is the regular `connect` syscall. + /// Because all WASI sockets are non-blocking this is expected to return + /// EINPROGRESS, which should be translated to `ok()` in WASI. + /// + /// The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT` + /// with a timeout of 0 on the socket descriptor. Followed by a check for + /// the `SO_ERROR` socket option, in case the poll signaled readiness. + /// + /// # References + /// - + /// - + /// - + /// - fn start_connect( &self, network: &Network, remote_address: IpSocketAddress, ) -> Result<(), ErrorCode>; - fn finish_connect(&self) -> Result<(InputStream, OutputStream), ErrorCode>; + fn finish_connect( + &self, + ) -> Result<(InputStream, OutputStream), ErrorCode>; + /// Start listening for new connections. + /// + /// Transitions the socket into the `listening` state. + /// + /// Unlike POSIX, the socket must already be explicitly bound. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not bound to any local address. (EDESTADDRREQ) + /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN, EINVAL on BSD) + /// - `invalid-state`: The socket is already in the `listening` state. + /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) + /// - `not-in-progress`: A listen operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// Unlike in POSIX, in WASI the listen operation is async. This enables + /// interactive WASI hosts to inject permission prompts. Runtimes that + /// don't want to make use of this ability can simply call the native + /// `listen` as part of either `start-listen` or `finish-listen`. + /// + /// # References + /// - + /// - + /// - + /// - fn start_listen(&self) -> Result<(), ErrorCode>; fn finish_listen(&self) -> Result<(), ErrorCode>; - fn accept(&self) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode>; + /// Accept a new client socket. + /// + /// The returned socket is bound and in the `connected` state. The following properties are inherited from the listener socket: + /// - `address-family` + /// - `keep-alive-enabled` + /// - `keep-alive-idle-time` + /// - `keep-alive-interval` + /// - `keep-alive-count` + /// - `hop-limit` + /// - `receive-buffer-size` + /// - `send-buffer-size` + /// + /// On success, this function returns the newly accepted client socket along with + /// a pair of streams that can be used to read & write to the connection. + /// + /// # Typical errors + /// - `invalid-state`: Socket is not in the `listening` state. (EINVAL) + /// - `would-block`: No pending connections at the moment. (EWOULDBLOCK, EAGAIN) + /// - `connection-aborted`: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References + /// - + /// - + /// - + /// - + fn accept( + &self, + ) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode>; + /// Get the bound local address. + /// + /// POSIX mentions: + /// > If the socket has not been bound to a local name, the value + /// > stored in the object pointed to by `address` is unspecified. + /// + /// WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not bound to any local address. + /// + /// # References + /// - + /// - + /// - + /// - fn local_address(&self) -> Result; + /// Get the remote address. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - fn remote_address(&self) -> Result; + /// Whether the socket is in the `listening` state. + /// + /// Equivalent to the SO_ACCEPTCONN socket option. fn is_listening(&self) -> bool; + /// Whether this is a IPv4 or IPv6 socket. + /// + /// Equivalent to the SO_DOMAIN socket option. fn address_family(&self) -> IpAddressFamily; - fn set_listen_backlog_size(&self, value: u64) -> Result<(), ErrorCode>; + /// Hints the desired listen queue size. Implementations are free to ignore this. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// + /// # Typical errors + /// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen. + /// - `invalid-argument`: (set) The provided value was 0. + /// - `invalid-state`: (set) The socket is in the `connect-in-progress` or `connected` state. + fn set_listen_backlog_size( + &self, + value: u64, + ) -> Result<(), ErrorCode>; + /// Enables or disables keepalive. + /// + /// The keepalive behavior can be adjusted using: + /// - `keep-alive-idle-time` + /// - `keep-alive-interval` + /// - `keep-alive-count` + /// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true. + /// + /// Equivalent to the SO_KEEPALIVE socket option. fn keep_alive_enabled(&self) -> Result; - fn set_keep_alive_enabled(&self, value: bool) -> Result<(), ErrorCode>; + fn set_keep_alive_enabled( + &self, + value: bool, + ) -> Result<(), ErrorCode>; + /// Amount of time the connection has to be idle before TCP starts sending keepalive packets. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS) + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. fn keep_alive_idle_time(&self) -> Result; - fn set_keep_alive_idle_time(&self, value: Duration) -> Result<(), ErrorCode>; + fn set_keep_alive_idle_time( + &self, + value: Duration, + ) -> Result<(), ErrorCode>; + /// The time between keepalive packets. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the TCP_KEEPINTVL socket option. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. fn keep_alive_interval(&self) -> Result; - fn set_keep_alive_interval(&self, value: Duration) -> Result<(), ErrorCode>; + fn set_keep_alive_interval( + &self, + value: Duration, + ) -> Result<(), ErrorCode>; + /// The maximum amount of keepalive packets TCP should send before aborting the connection. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the TCP_KEEPCNT socket option. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. fn keep_alive_count(&self) -> Result; fn set_keep_alive_count(&self, value: u32) -> Result<(), ErrorCode>; + /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The TTL value must be 1 or higher. fn hop_limit(&self) -> Result; fn set_hop_limit(&self, value: u8) -> Result<(), ErrorCode>; + /// The kernel buffer space reserved for sends/receives on this socket. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. fn receive_buffer_size(&self) -> Result; - fn set_receive_buffer_size(&self, value: u64) -> Result<(), ErrorCode>; + fn set_receive_buffer_size( + &self, + value: u64, + ) -> Result<(), ErrorCode>; fn send_buffer_size(&self) -> Result; fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode>; + /// Create a `pollable` which can be used to poll for, or block on, + /// completion of any of the asynchronous operations of this socket. + /// + /// When `finish-bind`, `finish-listen`, `finish-connect` or `accept` + /// return `error(would-block)`, this pollable can be used to wait for + /// their success or failure, after which the method can be retried. + /// + /// The pollable is not limited to the async operation that happens to be + /// in progress at the time of calling `subscribe` (if any). Theoretically, + /// `subscribe` only has to be called once per socket and can then be + /// (re)used for the remainder of the socket's lifetime. + /// + /// See + /// for a more information. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. fn subscribe(&self) -> Pollable; - fn shutdown(&self, shutdown_type: ShutdownType) -> Result<(), ErrorCode>; + /// Initiate a graceful shutdown. + /// + /// - `receive`: The socket is not expecting to receive any data from + /// the peer. The `input-stream` associated with this socket will be + /// closed. Any data still in the receive queue at time of calling + /// this method will be discarded. + /// - `send`: The socket has no more data to send to the peer. The `output-stream` + /// associated with this socket will be closed and a FIN packet will be sent. + /// - `both`: Same effect as `receive` & `send` combined. + /// + /// This function is idempotent. Shutting a down a direction more than once + /// has no effect and returns `ok`. + /// + /// The shutdown function does not close (drop) the socket. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + fn shutdown( + &self, + shutdown_type: ShutdownType, + ) -> Result<(), ErrorCode>; } #[doc(hidden)] - - macro_rules! __export_wasi_sockets_tcp_0_2_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.start-bind"] - unsafe extern "C" fn export_method_tcp_socket_start_bind(arg0: *mut u8,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_start_bind_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.finish-bind"] - unsafe extern "C" fn export_method_tcp_socket_finish_bind(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_finish_bind_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.start-connect"] - unsafe extern "C" fn export_method_tcp_socket_start_connect(arg0: *mut u8,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_start_connect_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.finish-connect"] - unsafe extern "C" fn export_method_tcp_socket_finish_connect(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_finish_connect_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.start-listen"] - unsafe extern "C" fn export_method_tcp_socket_start_listen(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_start_listen_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.finish-listen"] - unsafe extern "C" fn export_method_tcp_socket_finish_listen(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_finish_listen_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.accept"] - unsafe extern "C" fn export_method_tcp_socket_accept(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_accept_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.local-address"] - unsafe extern "C" fn export_method_tcp_socket_local_address(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_local_address_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.remote-address"] - unsafe extern "C" fn export_method_tcp_socket_remote_address(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_remote_address_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.is-listening"] - unsafe extern "C" fn export_method_tcp_socket_is_listening(arg0: *mut u8,) -> i32 { - $($path_to_types)*::_export_method_tcp_socket_is_listening_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.address-family"] - unsafe extern "C" fn export_method_tcp_socket_address_family(arg0: *mut u8,) -> i32 { - $($path_to_types)*::_export_method_tcp_socket_address_family_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-listen-backlog-size"] - unsafe extern "C" fn export_method_tcp_socket_set_listen_backlog_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_set_listen_backlog_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-enabled"] - unsafe extern "C" fn export_method_tcp_socket_keep_alive_enabled(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_keep_alive_enabled_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-enabled"] - unsafe extern "C" fn export_method_tcp_socket_set_keep_alive_enabled(arg0: *mut u8,arg1: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_set_keep_alive_enabled_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-idle-time"] - unsafe extern "C" fn export_method_tcp_socket_keep_alive_idle_time(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_keep_alive_idle_time_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-idle-time"] - unsafe extern "C" fn export_method_tcp_socket_set_keep_alive_idle_time(arg0: *mut u8,arg1: i64,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_set_keep_alive_idle_time_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-interval"] - unsafe extern "C" fn export_method_tcp_socket_keep_alive_interval(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_keep_alive_interval_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-interval"] - unsafe extern "C" fn export_method_tcp_socket_set_keep_alive_interval(arg0: *mut u8,arg1: i64,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_set_keep_alive_interval_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-count"] - unsafe extern "C" fn export_method_tcp_socket_keep_alive_count(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_keep_alive_count_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-count"] - unsafe extern "C" fn export_method_tcp_socket_set_keep_alive_count(arg0: *mut u8,arg1: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_set_keep_alive_count_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.hop-limit"] - unsafe extern "C" fn export_method_tcp_socket_hop_limit(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_hop_limit_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-hop-limit"] - unsafe extern "C" fn export_method_tcp_socket_set_hop_limit(arg0: *mut u8,arg1: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_set_hop_limit_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.receive-buffer-size"] - unsafe extern "C" fn export_method_tcp_socket_receive_buffer_size(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_receive_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-receive-buffer-size"] - unsafe extern "C" fn export_method_tcp_socket_set_receive_buffer_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_set_receive_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.send-buffer-size"] - unsafe extern "C" fn export_method_tcp_socket_send_buffer_size(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_send_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-send-buffer-size"] - unsafe extern "C" fn export_method_tcp_socket_set_send_buffer_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_set_send_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.subscribe"] - unsafe extern "C" fn export_method_tcp_socket_subscribe(arg0: *mut u8,) -> i32 { - $($path_to_types)*::_export_method_tcp_socket_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) - } - #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.shutdown"] - unsafe extern "C" fn export_method_tcp_socket_shutdown(arg0: *mut u8,arg1: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_tcp_socket_shutdown_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) - } - - const _: () = { - #[doc(hidden)] - #[export_name = "wasi:sockets/tcp@0.2.0#[dtor]tcp-socket"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::TcpSocket::dtor::< - <$ty as $($path_to_types)*::Guest>::TcpSocket - >(rep) - } - }; - - };); -} + macro_rules! __export_wasi_sockets_tcp_0_2_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.start-bind"] unsafe + extern "C" fn export_method_tcp_socket_start_bind(arg0 : * mut + u8, arg1 : i32, arg2 : i32, arg3 : i32, arg4 : i32, arg5 : i32, + arg6 : i32, arg7 : i32, arg8 : i32, arg9 : i32, arg10 : i32, + arg11 : i32, arg12 : i32, arg13 : i32,) -> * mut u8 { + $($path_to_types)*:: + _export_method_tcp_socket_start_bind_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1, arg2, + arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, + arg13) } #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.finish-bind"] unsafe + extern "C" fn export_method_tcp_socket_finish_bind(arg0 : * mut + u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_finish_bind_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.start-connect"] + unsafe extern "C" fn export_method_tcp_socket_start_connect(arg0 + : * mut u8, arg1 : i32, arg2 : i32, arg3 : i32, arg4 : i32, arg5 + : i32, arg6 : i32, arg7 : i32, arg8 : i32, arg9 : i32, arg10 : + i32, arg11 : i32, arg12 : i32, arg13 : i32,) -> * mut u8 { + $($path_to_types)*:: + _export_method_tcp_socket_start_connect_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1, arg2, + arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, + arg13) } #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.finish-connect"] + unsafe extern "C" fn export_method_tcp_socket_finish_connect(arg0 + : * mut u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_finish_connect_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.start-listen"] + unsafe extern "C" fn export_method_tcp_socket_start_listen(arg0 : + * mut u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_start_listen_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.finish-listen"] + unsafe extern "C" fn export_method_tcp_socket_finish_listen(arg0 + : * mut u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_finish_listen_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.accept"] unsafe + extern "C" fn export_method_tcp_socket_accept(arg0 : * mut u8,) + -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_accept_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.local-address"] + unsafe extern "C" fn export_method_tcp_socket_local_address(arg0 + : * mut u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_local_address_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.remote-address"] + unsafe extern "C" fn export_method_tcp_socket_remote_address(arg0 + : * mut u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_remote_address_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.is-listening"] + unsafe extern "C" fn export_method_tcp_socket_is_listening(arg0 : + * mut u8,) -> i32 { $($path_to_types)*:: + _export_method_tcp_socket_is_listening_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.address-family"] + unsafe extern "C" fn export_method_tcp_socket_address_family(arg0 + : * mut u8,) -> i32 { $($path_to_types)*:: + _export_method_tcp_socket_address_family_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-listen-backlog-size"] + unsafe extern "C" fn + export_method_tcp_socket_set_listen_backlog_size(arg0 : * mut u8, + arg1 : i64,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_set_listen_backlog_size_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-enabled"] + unsafe extern "C" fn + export_method_tcp_socket_keep_alive_enabled(arg0 : * mut u8,) -> + * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_keep_alive_enabled_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-enabled"] + unsafe extern "C" fn + export_method_tcp_socket_set_keep_alive_enabled(arg0 : * mut u8, + arg1 : i32,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_set_keep_alive_enabled_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-idle-time"] + unsafe extern "C" fn + export_method_tcp_socket_keep_alive_idle_time(arg0 : * mut u8,) + -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_keep_alive_idle_time_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-idle-time"] + unsafe extern "C" fn + export_method_tcp_socket_set_keep_alive_idle_time(arg0 : * mut + u8, arg1 : i64,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_set_keep_alive_idle_time_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-interval"] + unsafe extern "C" fn + export_method_tcp_socket_keep_alive_interval(arg0 : * mut u8,) -> + * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_keep_alive_interval_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-interval"] + unsafe extern "C" fn + export_method_tcp_socket_set_keep_alive_interval(arg0 : * mut u8, + arg1 : i64,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_set_keep_alive_interval_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-count"] + unsafe extern "C" fn + export_method_tcp_socket_keep_alive_count(arg0 : * mut u8,) -> * + mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_keep_alive_count_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-count"] + unsafe extern "C" fn + export_method_tcp_socket_set_keep_alive_count(arg0 : * mut u8, + arg1 : i32,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_set_keep_alive_count_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.hop-limit"] unsafe + extern "C" fn export_method_tcp_socket_hop_limit(arg0 : * mut + u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_hop_limit_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-hop-limit"] + unsafe extern "C" fn export_method_tcp_socket_set_hop_limit(arg0 + : * mut u8, arg1 : i32,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_set_hop_limit_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.receive-buffer-size"] + unsafe extern "C" fn + export_method_tcp_socket_receive_buffer_size(arg0 : * mut u8,) -> + * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_receive_buffer_size_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-receive-buffer-size"] + unsafe extern "C" fn + export_method_tcp_socket_set_receive_buffer_size(arg0 : * mut u8, + arg1 : i64,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_set_receive_buffer_size_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.send-buffer-size"] + unsafe extern "C" fn + export_method_tcp_socket_send_buffer_size(arg0 : * mut u8,) -> * + mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_send_buffer_size_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-send-buffer-size"] + unsafe extern "C" fn + export_method_tcp_socket_set_send_buffer_size(arg0 : * mut u8, + arg1 : i64,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_set_send_buffer_size_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/tcp@0.2.0#[method]tcp-socket.subscribe"] unsafe + extern "C" fn export_method_tcp_socket_subscribe(arg0 : * mut + u8,) -> i32 { $($path_to_types)*:: + _export_method_tcp_socket_subscribe_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0) } #[export_name + = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.shutdown"] unsafe + extern "C" fn export_method_tcp_socket_shutdown(arg0 : * mut u8, + arg1 : i32,) -> * mut u8 { $($path_to_types)*:: + _export_method_tcp_socket_shutdown_cabi::<<$ty as + $($path_to_types)*:: Guest >::TcpSocket > (arg0, arg1) } const _ + : () = { #[doc(hidden)] #[export_name = + "wasi:sockets/tcp@0.2.0#[dtor]tcp-socket"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: TcpSocket::dtor::< <$ty as + $($path_to_types)*:: Guest >::TcpSocket > (rep) } }; }; + }; + } #[doc(hidden)] pub(crate) use __export_wasi_sockets_tcp_0_2_0_cabi; #[repr(align(8))] struct _RetArea([::core::mem::MaybeUninit; 36]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 36]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 36], + ); + } + #[allow(dead_code, clippy::all)] + pub mod tcp_create_socket { + #[used] + #[doc(hidden)] + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type ErrorCode = super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; + pub type IpAddressFamily = super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily; + pub type TcpSocket = super::super::super::super::exports::wasi::sockets0_2_0::tcp::TcpSocket; + pub type TcpSocketBorrow<'a> = super::super::super::super::exports::wasi::sockets0_2_0::tcp::TcpSocketBorrow< + 'a, + >; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_create_tcp_socket_cabi( + arg0: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::create_tcp_socket( + super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily::_lift( + arg0 as u8, + ), + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(4).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + pub trait Guest { + /// Create a new TCP socket. + /// + /// Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX. + /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. + /// + /// This function does not require a network capability handle. This is considered to be safe because + /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`connect` + /// is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world. + /// + /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. + /// + /// # Typical errors + /// - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References + /// - + /// - + /// - + /// - + fn create_tcp_socket( + address_family: IpAddressFamily, + ) -> Result; + } + #[doc(hidden)] + macro_rules! __export_wasi_sockets_tcp_create_socket_0_2_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "wasi:sockets/tcp-create-socket@0.2.0#create-tcp-socket"] unsafe + extern "C" fn export_create_tcp_socket(arg0 : i32,) -> * mut u8 { + $($path_to_types)*:: _export_create_tcp_socket_cabi::<$ty > + (arg0) } }; + }; + } + #[doc(hidden)] + pub(crate) use __export_wasi_sockets_tcp_create_socket_0_2_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 8]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); } - #[allow(dead_code, clippy::all)] pub mod udp { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; pub type Pollable = super::super::super::super::wasi::io0_2_0::poll::Pollable; pub type Network = super::super::super::super::wasi::sockets0_2_0::network::Network; - pub type ErrorCode = - super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; - pub type IpSocketAddress = - super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress; - pub type IpAddressFamily = - super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily; + pub type ErrorCode = super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; + pub type IpSocketAddress = super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress; + pub type IpAddressFamily = super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily; + /// A received datagram. #[derive(Clone)] pub struct IncomingDatagram { + /// The payload. + /// + /// Theoretical max size: ~64 KiB. In practice, typically less than 1500 bytes. pub data: _rt::Vec, + /// The source address. + /// + /// This field is guaranteed to match the remote address the stream was initialized with, if any. + /// + /// Equivalent to the `src_addr` out parameter of `recvfrom`. pub remote_address: IpSocketAddress, } impl ::core::fmt::Debug for IncomingDatagram { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("IncomingDatagram") .field("data", &self.data) .field("remote-address", &self.remote_address) .finish() } } + /// A datagram to be sent out. #[derive(Clone)] pub struct OutgoingDatagram { + /// The payload. pub data: _rt::Vec, + /// The destination address. + /// + /// The requirements on this field depend on how the stream was initialized: + /// - with a remote address: this field must be None or match the stream's remote address exactly. + /// - without a remote address: this field is required. + /// + /// If this value is None, the send operation is equivalent to `send` in POSIX. Otherwise it is equivalent to `sendto`. pub remote_address: Option, } impl ::core::fmt::Debug for OutgoingDatagram { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("OutgoingDatagram") .field("data", &self.data) .field("remote-address", &self.remote_address) .finish() } } - + /// A UDP socket handle. #[derive(Debug)] #[repr(transparent)] pub struct UdpSocket { handle: _rt::Resource, } - type _UdpSocketRep = Option; - impl UdpSocket { /// Creates a new resource from the specified representation. /// @@ -18125,77 +19283,68 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _UdpSocketRep = Some(val); - let ptr: *mut _UdpSocketRep = _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _UdpSocketRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestUdpSocket` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); let _ = _rt::Box::from_raw(handle as *mut _UdpSocketRep); } - fn as_ptr(&self) -> *mut _UdpSocketRep { UdpSocket::type_guard::(); T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`UdpSocket`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -18204,7 +19353,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a UdpSocket>, } - impl<'a> UdpSocketBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -18213,49 +19361,40 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _UdpSocketRep { UdpSocket::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for UdpSocket { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/udp@0.2.0" + )] extern "C" { #[link_name = "[resource-drop]udp-socket"] fn drop(_: u32); } - drop(_handle); } } } - #[derive(Debug)] #[repr(transparent)] pub struct IncomingDatagramStream { handle: _rt::Resource, } - type _IncomingDatagramStreamRep = Option; - impl IncomingDatagramStream { /// Creates a new resource from the specified representation. /// @@ -18265,72 +19404,65 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _IncomingDatagramStreamRep = Some(val); - let ptr: *mut _IncomingDatagramStreamRep = - _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _IncomingDatagramStreamRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestIncomingDatagramStream` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); - let _ = _rt::Box::from_raw(handle as *mut _IncomingDatagramStreamRep); + let _ = _rt::Box::from_raw( + handle as *mut _IncomingDatagramStreamRep, + ); } - fn as_ptr( &self, ) -> *mut _IncomingDatagramStreamRep { @@ -18338,7 +19470,6 @@ pub mod exports { T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`IncomingDatagramStream`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -18347,7 +19478,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a IncomingDatagramStream>, } - impl<'a> IncomingDatagramStreamBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -18356,49 +19486,40 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _IncomingDatagramStreamRep { IncomingDatagramStream::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for IncomingDatagramStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/udp@0.2.0" + )] extern "C" { #[link_name = "[resource-drop]incoming-datagram-stream"] fn drop(_: u32); } - drop(_handle); } } } - #[derive(Debug)] #[repr(transparent)] pub struct OutgoingDatagramStream { handle: _rt::Resource, } - type _OutgoingDatagramStreamRep = Option; - impl OutgoingDatagramStream { /// Creates a new resource from the specified representation. /// @@ -18408,72 +19529,65 @@ pub mod exports { pub fn new(val: T) -> Self { Self::type_guard::(); let val: _OutgoingDatagramStreamRep = Some(val); - let ptr: *mut _OutgoingDatagramStreamRep = - _rt::Box::into_raw(_rt::Box::new(val)); + let ptr: *mut _OutgoingDatagramStreamRep = _rt::Box::into_raw( + _rt::Box::new(val), + ); unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } } - /// Gets access to the underlying `T` which represents this resource. pub fn get(&self) -> &T { let ptr = unsafe { &*self.as_ptr::() }; ptr.as_ref().unwrap() } - /// Gets mutable access to the underlying `T` which represents this /// resource. pub fn get_mut(&mut self) -> &mut T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_mut().unwrap() } - /// Consumes this resource and returns the underlying `T`. pub fn into_inner(self) -> T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.take().unwrap() } - #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { handle: _rt::Resource::from_handle(handle), } } - #[doc(hidden)] pub fn take_handle(&self) -> u32 { _rt::Resource::take_handle(&self.handle) } - #[doc(hidden)] pub fn handle(&self) -> u32 { _rt::Resource::handle(&self.handle) } - - // It's theoretically possible to implement the `GuestOutgoingDatagramStream` trait twice - // so guard against using it with two different types here. #[doc(hidden)] fn type_guard() { use core::any::TypeId; static mut LAST_TYPE: Option = None; unsafe { - assert!(!cfg!(target_feature = "threads")); + assert!(! cfg!(target_feature = "atomics")); let id = TypeId::of::(); match LAST_TYPE { - Some(ty) => assert!( - ty == id, - "cannot use two types with this resource type" - ), + Some(ty) => { + assert!( + ty == id, "cannot use two types with this resource type" + ) + } None => LAST_TYPE = Some(id), } } } - #[doc(hidden)] pub unsafe fn dtor(handle: *mut u8) { Self::type_guard::(); - let _ = _rt::Box::from_raw(handle as *mut _OutgoingDatagramStreamRep); + let _ = _rt::Box::from_raw( + handle as *mut _OutgoingDatagramStreamRep, + ); } - fn as_ptr( &self, ) -> *mut _OutgoingDatagramStreamRep { @@ -18481,7 +19595,6 @@ pub mod exports { T::_resource_rep(self.handle()).cast() } } - /// A borrowed version of [`OutgoingDatagramStream`] which represents a borrowed value /// with the lifetime `'a`. #[derive(Debug)] @@ -18490,7 +19603,6 @@ pub mod exports { rep: *mut u8, _marker: core::marker::PhantomData<&'a OutgoingDatagramStream>, } - impl<'a> OutgoingDatagramStreamBorrow<'a> { #[doc(hidden)] pub unsafe fn lift(rep: usize) -> Self { @@ -18499,44 +19611,39 @@ pub mod exports { _marker: core::marker::PhantomData, } } - /// Gets access to the underlying `T` in this resource. pub fn get(&self) -> &T { let ptr = unsafe { &mut *self.as_ptr::() }; ptr.as_ref().unwrap() } - - // NB: mutable access is not allowed due to the component model allowing - // multiple borrows of the same resource. - fn as_ptr(&self) -> *mut _OutgoingDatagramStreamRep { OutgoingDatagramStream::type_guard::(); self.rep.cast() } } - unsafe impl _rt::WasmResource for OutgoingDatagramStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/udp@0.2.0" + )] extern "C" { #[link_name = "[resource-drop]outgoing-datagram-stream"] fn drop(_: u32); } - drop(_handle); } } } - #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_udp_socket_start_bind_cabi( + pub unsafe fn _export_method_udp_socket_start_bind_cabi< + T: GuestUdpSocket, + >( arg0: *mut u8, arg1: i32, arg2: i32, @@ -18552,33 +19659,43 @@ pub mod exports { arg12: i32, arg13: i32, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let handle0; use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V1; let v1 = match arg2 { 0 => { - let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ - port: arg3 as u16, - address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), - }; + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { + port: arg3 as u16, + address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), + }; V1::Ipv4(e1) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ - port: arg3 as u16, - flow_info: arg4 as u32, - address: (arg5 as u16, arg6 as u16, arg7 as u16, arg8 as u16, arg9 as u16, arg10 as u16, arg11 as u16, arg12 as u16), - scope_id: arg13 as u32, - }; + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { + port: arg3 as u16, + flow_info: arg4 as u32, + address: ( + arg5 as u16, + arg6 as u16, + arg7 as u16, + arg8 as u16, + arg9 as u16, + arg10 as u16, + arg11 as u16, + arg12 as u16, + ), + scope_id: arg13 as u32, + }; V1::Ipv6(e1) } }; let result2 = T::start_bind( UdpSocketBorrow::lift(arg0 as u32 as usize).get(), { - handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle(arg1 as u32); + handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle( + arg1 as u32, + ); &handle0 }, v1, @@ -18597,12 +19714,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_udp_socket_finish_bind_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = T::finish_bind(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_udp_socket_finish_bind_cabi< + T: GuestUdpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::finish_bind( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(_) => { @@ -18633,8 +19751,7 @@ pub mod exports { arg12: i32, arg13: i32, ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result1 = T::stream( UdpSocketBorrow::lift(arg0 as u32 as usize).get(), match arg1 { @@ -18644,24 +19761,32 @@ pub mod exports { use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V0; let v0 = match arg2 { 0 => { - let e0 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ - port: arg3 as u16, - address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), - }; + let e0 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { + port: arg3 as u16, + address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), + }; V0::Ipv4(e0) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e0 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ - port: arg3 as u16, - flow_info: arg4 as u32, - address: (arg5 as u16, arg6 as u16, arg7 as u16, arg8 as u16, arg9 as u16, arg10 as u16, arg11 as u16, arg12 as u16), - scope_id: arg13 as u32, - }; + let e0 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { + port: arg3 as u16, + flow_info: arg4 as u32, + address: ( + arg5 as u16, + arg6 as u16, + arg7 as u16, + arg8 as u16, + arg9 as u16, + arg10 as u16, + arg11 as u16, + arg12 as u16, + ), + scope_id: arg13 as u32, + }; V0::Ipv6(e0) } }; - v0 }; Some(e) @@ -18686,13 +19811,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_udp_socket_local_address_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::local_address(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_udp_socket_local_address_cabi< + T: GuestUdpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::local_address( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -18701,7 +19826,10 @@ pub mod exports { match e { V6::Ipv4(e) => { *ptr1.add(4).cast::() = (0i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port2, address:address2, } = e; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { + port: port2, + address: address2, + } = e; *ptr1.add(8).cast::() = (_rt::as_i32(port2)) as u16; let (t3_0, t3_1, t3_2, t3_3) = address2; *ptr1.add(10).cast::() = (_rt::as_i32(t3_0)) as u8; @@ -18711,7 +19839,12 @@ pub mod exports { } V6::Ipv6(e) => { *ptr1.add(4).cast::() = (1i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port4, flow_info:flow_info4, address:address4, scope_id:scope_id4, } = e; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { + port: port4, + flow_info: flow_info4, + address: address4, + scope_id: scope_id4, + } = e; *ptr1.add(8).cast::() = (_rt::as_i32(port4)) as u16; *ptr1.add(12).cast::() = _rt::as_i32(flow_info4); let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; @@ -18736,13 +19869,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_udp_socket_remote_address_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::remote_address(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_udp_socket_remote_address_cabi< + T: GuestUdpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::remote_address( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -18751,7 +19884,10 @@ pub mod exports { match e { V6::Ipv4(e) => { *ptr1.add(4).cast::() = (0i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port2, address:address2, } = e; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { + port: port2, + address: address2, + } = e; *ptr1.add(8).cast::() = (_rt::as_i32(port2)) as u16; let (t3_0, t3_1, t3_2, t3_3) = address2; *ptr1.add(10).cast::() = (_rt::as_i32(t3_0)) as u8; @@ -18761,7 +19897,12 @@ pub mod exports { } V6::Ipv6(e) => { *ptr1.add(4).cast::() = (1i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port4, flow_info:flow_info4, address:address4, scope_id:scope_id4, } = e; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { + port: port4, + flow_info: flow_info4, + address: address4, + scope_id: scope_id4, + } = e; *ptr1.add(8).cast::() = (_rt::as_i32(port4)) as u16; *ptr1.add(12).cast::() = _rt::as_i32(flow_info4); let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; @@ -18786,26 +19927,24 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_udp_socket_address_family_cabi( - arg0: *mut u8, - ) -> i32 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::address_family(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_udp_socket_address_family_cabi< + T: GuestUdpSocket, + >(arg0: *mut u8) -> i32 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::address_family( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); result0.clone() as i32 } #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_method_udp_socket_unicast_hop_limit_cabi< T: GuestUdpSocket, - >( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::unicast_hop_limit(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::unicast_hop_limit( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -18823,12 +19962,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_udp_socket_set_unicast_hop_limit_cabi< T: GuestUdpSocket, - >( - arg0: *mut u8, - arg1: i32, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i32) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_unicast_hop_limit( UdpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u8, @@ -18849,13 +19984,11 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_udp_socket_receive_buffer_size_cabi< T: GuestUdpSocket, - >( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::receive_buffer_size(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::receive_buffer_size( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -18873,12 +20006,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_udp_socket_set_receive_buffer_size_cabi< T: GuestUdpSocket, - >( - arg0: *mut u8, - arg1: i64, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i64) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_receive_buffer_size( UdpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u64, @@ -18897,13 +20026,13 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_udp_socket_send_buffer_size_cabi( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = - T::send_buffer_size(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_udp_socket_send_buffer_size_cabi< + T: GuestUdpSocket, + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::send_buffer_size( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); match result0 { Ok(e) => { @@ -18921,12 +20050,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_udp_socket_set_send_buffer_size_cabi< T: GuestUdpSocket, - >( - arg0: *mut u8, - arg1: i64, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i64) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::set_send_buffer_size( UdpSocketBorrow::lift(arg0 as u32 as usize).get(), arg1 as u64, @@ -18945,24 +20070,21 @@ pub mod exports { } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_udp_socket_subscribe_cabi( - arg0: *mut u8, - ) -> i32 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); - let result0 = T::subscribe(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_udp_socket_subscribe_cabi< + T: GuestUdpSocket, + >(arg0: *mut u8) -> i32 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::subscribe( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + ); (result0).take_handle() as i32 } #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_method_incoming_datagram_stream_receive_cabi< T: GuestIncomingDatagramStream, - >( - arg0: *mut u8, - arg1: i64, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: i64) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::receive( IncomingDatagramStreamBorrow::lift(arg0 as u32 as usize).get(), arg1 as u64, @@ -18973,8 +20095,10 @@ pub mod exports { *ptr1.add(0).cast::() = (0i32) as u8; let vec9 = e; let len9 = vec9.len(); - let layout9 = - _rt::alloc::Layout::from_size_align_unchecked(vec9.len() * 40, 4); + let layout9 = _rt::alloc::Layout::from_size_align_unchecked( + vec9.len() * 40, + 4, + ); let result9 = if layout9.size() != 0 { let ptr = _rt::alloc::alloc(layout9).cast::(); if ptr.is_null() { @@ -18982,9 +20106,7 @@ pub mod exports { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec9.into_iter().enumerate() { let base = result9.add(i * 40); @@ -19003,9 +20125,11 @@ pub mod exports { match remote_address2 { V8::Ipv4(e) => { *base.add(8).cast::() = (0i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port4, address:address4, } = e; - *base.add(12).cast::() = - (_rt::as_i32(port4)) as u16; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { + port: port4, + address: address4, + } = e; + *base.add(12).cast::() = (_rt::as_i32(port4)) as u16; let (t5_0, t5_1, t5_2, t5_3) = address4; *base.add(14).cast::() = (_rt::as_i32(t5_0)) as u8; *base.add(15).cast::() = (_rt::as_i32(t5_1)) as u8; @@ -19014,28 +20138,23 @@ pub mod exports { } V8::Ipv6(e) => { *base.add(8).cast::() = (1i32) as u8; - let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port6, flow_info:flow_info6, address:address6, scope_id:scope_id6, } = e; - *base.add(12).cast::() = - (_rt::as_i32(port6)) as u16; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { + port: port6, + flow_info: flow_info6, + address: address6, + scope_id: scope_id6, + } = e; + *base.add(12).cast::() = (_rt::as_i32(port6)) as u16; *base.add(16).cast::() = _rt::as_i32(flow_info6); - let (t7_0, t7_1, t7_2, t7_3, t7_4, t7_5, t7_6, t7_7) = - address6; - *base.add(20).cast::() = - (_rt::as_i32(t7_0)) as u16; - *base.add(22).cast::() = - (_rt::as_i32(t7_1)) as u16; - *base.add(24).cast::() = - (_rt::as_i32(t7_2)) as u16; - *base.add(26).cast::() = - (_rt::as_i32(t7_3)) as u16; - *base.add(28).cast::() = - (_rt::as_i32(t7_4)) as u16; - *base.add(30).cast::() = - (_rt::as_i32(t7_5)) as u16; - *base.add(32).cast::() = - (_rt::as_i32(t7_6)) as u16; - *base.add(34).cast::() = - (_rt::as_i32(t7_7)) as u16; + let (t7_0, t7_1, t7_2, t7_3, t7_4, t7_5, t7_6, t7_7) = address6; + *base.add(20).cast::() = (_rt::as_i32(t7_0)) as u16; + *base.add(22).cast::() = (_rt::as_i32(t7_1)) as u16; + *base.add(24).cast::() = (_rt::as_i32(t7_2)) as u16; + *base.add(26).cast::() = (_rt::as_i32(t7_3)) as u16; + *base.add(28).cast::() = (_rt::as_i32(t7_4)) as u16; + *base.add(30).cast::() = (_rt::as_i32(t7_5)) as u16; + *base.add(32).cast::() = (_rt::as_i32(t7_6)) as u16; + *base.add(34).cast::() = (_rt::as_i32(t7_7)) as u16; *base.add(36).cast::() = _rt::as_i32(scope_id6); } } @@ -19055,40 +20174,35 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn __post_return_method_incoming_datagram_stream_receive< T: GuestIncomingDatagramStream, - >( - arg0: *mut u8, - ) { + >(arg0: *mut u8) { let l0 = i32::from(*arg0.add(0).cast::()); match l0 { 0 => { - let l4 = *arg0.add(4).cast::<*mut u8>(); - let l5 = *arg0.add(8).cast::(); - let base6 = l4; - let len6 = l5; + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + let base6 = l1; + let len6 = l2; for i in 0..len6 { let base = base6.add(i * 40); { - let l1 = *base.add(0).cast::<*mut u8>(); - let l2 = *base.add(4).cast::(); - let base3 = l1; - let len3 = l2; - _rt::cabi_dealloc(base3, len3 * 1, 1); + let l3 = *base.add(0).cast::<*mut u8>(); + let l4 = *base.add(4).cast::(); + let base5 = l3; + let len5 = l4; + _rt::cabi_dealloc(base5, len5 * 1, 1); } } _rt::cabi_dealloc(base6, len6 * 40, 4); } - _ => (), + _ => {} } } #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_method_incoming_datagram_stream_subscribe_cabi< T: GuestIncomingDatagramStream, - >( - arg0: *mut u8, - ) -> i32 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8) -> i32 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::subscribe( IncomingDatagramStreamBorrow::lift(arg0 as u32 as usize).get(), ); @@ -19098,11 +20212,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_outgoing_datagram_stream_check_send_cabi< T: GuestOutgoingDatagramStream, - >( - arg0: *mut u8, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::check_send( OutgoingDatagramStreamBorrow::lift(arg0 as u32 as usize).get(), ); @@ -19123,13 +20234,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_outgoing_datagram_stream_send_cabi< T: GuestOutgoingDatagramStream, - >( - arg0: *mut u8, - arg1: *mut u8, - arg2: usize, - ) -> *mut u8 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8, arg1: *mut u8, arg2: usize) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let base22 = arg1; let len22 = arg2; let mut result22 = _rt::Vec::with_capacity(len22); @@ -19140,7 +20246,6 @@ pub mod exports { let l1 = *base.add(4).cast::(); let len2 = l1; let l3 = i32::from(*base.add(8).cast::()); - OutgoingDatagram { data: _rt::Vec::from_raw_parts(l0.cast(), len2, len2), remote_address: match l3 { @@ -19152,62 +20257,51 @@ pub mod exports { let v21 = match l4 { 0 => { let e21 = { - let l5 = - i32::from(*base.add(16).cast::()); - let l6 = - i32::from(*base.add(18).cast::()); - let l7 = - i32::from(*base.add(19).cast::()); - let l8 = - i32::from(*base.add(20).cast::()); - let l9 = - i32::from(*base.add(21).cast::()); - - super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ - port: l5 as u16, - address: (l6 as u8, l7 as u8, l8 as u8, l9 as u8), - } + let l5 = i32::from(*base.add(16).cast::()); + let l6 = i32::from(*base.add(18).cast::()); + let l7 = i32::from(*base.add(19).cast::()); + let l8 = i32::from(*base.add(20).cast::()); + let l9 = i32::from(*base.add(21).cast::()); + super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress { + port: l5 as u16, + address: (l6 as u8, l7 as u8, l8 as u8, l9 as u8), + } }; V21::Ipv4(e21) } n => { - debug_assert_eq!( - n, 1, - "invalid enum discriminant" - ); + debug_assert_eq!(n, 1, "invalid enum discriminant"); let e21 = { - let l10 = - i32::from(*base.add(16).cast::()); + let l10 = i32::from(*base.add(16).cast::()); let l11 = *base.add(20).cast::(); - let l12 = - i32::from(*base.add(24).cast::()); - let l13 = - i32::from(*base.add(26).cast::()); - let l14 = - i32::from(*base.add(28).cast::()); - let l15 = - i32::from(*base.add(30).cast::()); - let l16 = - i32::from(*base.add(32).cast::()); - let l17 = - i32::from(*base.add(34).cast::()); - let l18 = - i32::from(*base.add(36).cast::()); - let l19 = - i32::from(*base.add(38).cast::()); + let l12 = i32::from(*base.add(24).cast::()); + let l13 = i32::from(*base.add(26).cast::()); + let l14 = i32::from(*base.add(28).cast::()); + let l15 = i32::from(*base.add(30).cast::()); + let l16 = i32::from(*base.add(32).cast::()); + let l17 = i32::from(*base.add(34).cast::()); + let l18 = i32::from(*base.add(36).cast::()); + let l19 = i32::from(*base.add(38).cast::()); let l20 = *base.add(40).cast::(); - - super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ - port: l10 as u16, - flow_info: l11 as u32, - address: (l12 as u16, l13 as u16, l14 as u16, l15 as u16, l16 as u16, l17 as u16, l18 as u16, l19 as u16), - scope_id: l20 as u32, - } + super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress { + port: l10 as u16, + flow_info: l11 as u32, + address: ( + l12 as u16, + l13 as u16, + l14 as u16, + l15 as u16, + l16 as u16, + l17 as u16, + l18 as u16, + l19 as u16, + ), + scope_id: l20 as u32, + } }; V21::Ipv6(e21) } }; - v21 }; Some(e) @@ -19240,11 +20334,8 @@ pub mod exports { #[allow(non_snake_case)] pub unsafe fn _export_method_outgoing_datagram_stream_subscribe_cabi< T: GuestOutgoingDatagramStream, - >( - arg0: *mut u8, - ) -> i32 { - #[cfg(target_arch = "wasm32")] - _rt::run_ctors_once(); + >(arg0: *mut u8) -> i32 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::subscribe( OutgoingDatagramStreamBorrow::lift(arg0 as u32 as usize).get(), ); @@ -19266,10 +20357,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/udp@0.2.0" + )] extern "C" { #[link_name = "[resource-new]udp-socket"] fn new(_: *mut u8) -> u32; @@ -19277,7 +20369,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -19288,10 +20379,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/udp@0.2.0" + )] extern "C" { #[link_name = "[resource-rep]udp-socket"] fn rep(_: u32) -> *mut u8; @@ -19299,26 +20391,146 @@ pub mod exports { unsafe { rep(handle) } } } - + /// Bind the socket to a specific network on the provided IP address and port. + /// + /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which + /// network interface(s) to bind to. + /// If the port is zero, the socket will be bound to a random free port. + /// + /// # Typical errors + /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) + /// - `invalid-state`: The socket is already bound. (EINVAL) + /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) + /// - `address-in-use`: Address is already in use. (EADDRINUSE) + /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) + /// - `not-in-progress`: A `bind` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// Unlike in POSIX, in WASI the bind operation is async. This enables + /// interactive WASI hosts to inject permission prompts. Runtimes that + /// don't want to make use of this ability can simply call the native + /// `bind` as part of either `start-bind` or `finish-bind`. + /// + /// # References + /// - + /// - + /// - + /// - fn start_bind( &self, network: &Network, local_address: IpSocketAddress, ) -> Result<(), ErrorCode>; fn finish_bind(&self) -> Result<(), ErrorCode>; + /// Set up inbound & outbound communication channels, optionally to a specific peer. + /// + /// This function only changes the local socket configuration and does not generate any network traffic. + /// On success, the `remote-address` of the socket is updated. The `local-address` may be updated as well, + /// based on the best network path to `remote-address`. + /// + /// When a `remote-address` is provided, the returned streams are limited to communicating with that specific peer: + /// - `send` can only be used to send to this destination. + /// - `receive` will only return datagrams sent from the provided `remote-address`. + /// + /// This method may be called multiple times on the same socket to change its association, but + /// only the most recently returned pair of streams will be operational. Implementations may trap if + /// the streams returned by a previous invocation haven't been dropped yet before calling `stream` again. + /// + /// The POSIX equivalent in pseudo-code is: + /// ```text + /// if (was previously connected) { + /// connect(s, AF_UNSPEC) + /// } + /// if (remote_address is Some) { + /// connect(s, remote_address) + /// } + /// ``` + /// + /// Unlike in POSIX, the socket must already be explicitly bound. + /// + /// # Typical errors + /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-state`: The socket is not bound. + /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) + /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `connection-refused`: The connection was refused. (ECONNREFUSED) + /// + /// # References + /// - + /// - + /// - + /// - fn stream( &self, remote_address: Option, - ) -> Result<(IncomingDatagramStream, OutgoingDatagramStream), ErrorCode>; + ) -> Result< + (IncomingDatagramStream, OutgoingDatagramStream), + ErrorCode, + >; + /// Get the current bound address. + /// + /// POSIX mentions: + /// > If the socket has not been bound to a local name, the value + /// > stored in the object pointed to by `address` is unspecified. + /// + /// WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not bound to any local address. + /// + /// # References + /// - + /// - + /// - + /// - fn local_address(&self) -> Result; + /// Get the address the socket is currently streaming to. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not streaming to a specific remote address. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - fn remote_address(&self) -> Result; + /// Whether this is a IPv4 or IPv6 socket. + /// + /// Equivalent to the SO_DOMAIN socket option. fn address_family(&self) -> IpAddressFamily; + /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The TTL value must be 1 or higher. fn unicast_hop_limit(&self) -> Result; fn set_unicast_hop_limit(&self, value: u8) -> Result<(), ErrorCode>; + /// The kernel buffer space reserved for sends/receives on this socket. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. fn receive_buffer_size(&self) -> Result; - fn set_receive_buffer_size(&self, value: u64) -> Result<(), ErrorCode>; + fn set_receive_buffer_size( + &self, + value: u64, + ) -> Result<(), ErrorCode>; fn send_buffer_size(&self) -> Result; fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode>; + /// Create a `pollable` which will resolve once the socket is ready for I/O. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. fn subscribe(&self) -> Pollable; } pub trait GuestIncomingDatagramStream: 'static { @@ -19332,10 +20544,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/udp@0.2.0" + )] extern "C" { #[link_name = "[resource-new]incoming-datagram-stream"] fn new(_: *mut u8) -> u32; @@ -19343,7 +20556,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -19354,10 +20566,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/udp@0.2.0" + )] extern "C" { #[link_name = "[resource-rep]incoming-datagram-stream"] fn rep(_: u32) -> *mut u8; @@ -19365,11 +20578,37 @@ pub mod exports { unsafe { rep(handle) } } } - + /// Receive messages on the socket. + /// + /// This function attempts to receive up to `max-results` datagrams on the socket without blocking. + /// The returned list may contain fewer elements than requested, but never more. + /// + /// This function returns successfully with an empty list when either: + /// - `max-results` is 0, or: + /// - `max-results` is greater than 0, but no results are immediately available. + /// This function never returns `error(would-block)`. + /// + /// # Typical errors + /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `connection-refused`: The connection was refused. (ECONNREFUSED) + /// + /// # References + /// - + /// - + /// - + /// - + /// - + /// - + /// - + /// - fn receive( &self, max_results: u64, ) -> Result<_rt::Vec, ErrorCode>; + /// Create a `pollable` which will resolve once the stream is ready to receive again. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. fn subscribe(&self) -> Pollable; } pub trait GuestOutgoingDatagramStream: 'static { @@ -19383,10 +20622,11 @@ pub mod exports { let _ = val; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/udp@0.2.0" + )] extern "C" { #[link_name = "[resource-new]outgoing-datagram-stream"] fn new(_: *mut u8) -> u32; @@ -19394,7 +20634,6 @@ pub mod exports { new(val) } } - #[doc(hidden)] fn _resource_rep(handle: u32) -> *mut u8 where @@ -19405,10 +20644,11 @@ pub mod exports { let _ = handle; unreachable!(); } - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + #[link( + wasm_import_module = "[export]wasi:sockets/udp@0.2.0" + )] extern "C" { #[link_name = "[resource-rep]outgoing-datagram-stream"] fn rep(_: u32) -> *mut u8; @@ -19416,146 +20656,306 @@ pub mod exports { unsafe { rep(handle) } } } - + /// Check readiness for sending. This function never blocks. + /// + /// Returns the number of datagrams permitted for the next call to `send`, + /// or an error. Calling `send` with more datagrams than this function has + /// permitted will trap. + /// + /// When this function returns ok(0), the `subscribe` pollable will + /// become ready when this function will report at least ok(1), or an + /// error. + /// + /// Never returns `would-block`. fn check_send(&self) -> Result; - fn send(&self, datagrams: _rt::Vec) - -> Result; + /// Send messages on the socket. + /// + /// This function attempts to send all provided `datagrams` on the socket without blocking and + /// returns how many messages were actually sent (or queued for sending). This function never + /// returns `error(would-block)`. If none of the datagrams were able to be sent, `ok(0)` is returned. + /// + /// This function semantically behaves the same as iterating the `datagrams` list and sequentially + /// sending each individual datagram until either the end of the list has been reached or the first error occurred. + /// If at least one datagram has been sent successfully, this function never returns an error. + /// + /// If the input list is empty, the function returns `ok(0)`. + /// + /// Each call to `send` must be permitted by a preceding `check-send`. Implementations must trap if + /// either `check-send` was not called or `datagrams` contains more items than `check-send` permitted. + /// + /// # Typical errors + /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-argument`: The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `stream`. (EISCONN) + /// - `invalid-argument`: The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ) + /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `connection-refused`: The connection was refused. (ECONNREFUSED) + /// - `datagram-too-large`: The datagram is too large. (EMSGSIZE) + /// + /// # References + /// - + /// - + /// - + /// - + /// - + /// - + /// - + /// - + fn send( + &self, + datagrams: _rt::Vec, + ) -> Result; + /// Create a `pollable` which will resolve once the stream is ready to send again. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. fn subscribe(&self) -> Pollable; } #[doc(hidden)] - - macro_rules! __export_wasi_sockets_udp_0_2_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.start-bind"] - unsafe extern "C" fn export_method_udp_socket_start_bind(arg0: *mut u8,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_start_bind_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.finish-bind"] - unsafe extern "C" fn export_method_udp_socket_finish_bind(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_finish_bind_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.stream"] - unsafe extern "C" fn export_method_udp_socket_stream(arg0: *mut u8,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_stream_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.local-address"] - unsafe extern "C" fn export_method_udp_socket_local_address(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_local_address_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.remote-address"] - unsafe extern "C" fn export_method_udp_socket_remote_address(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_remote_address_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.address-family"] - unsafe extern "C" fn export_method_udp_socket_address_family(arg0: *mut u8,) -> i32 { - $($path_to_types)*::_export_method_udp_socket_address_family_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.unicast-hop-limit"] - unsafe extern "C" fn export_method_udp_socket_unicast_hop_limit(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_unicast_hop_limit_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.set-unicast-hop-limit"] - unsafe extern "C" fn export_method_udp_socket_set_unicast_hop_limit(arg0: *mut u8,arg1: i32,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_set_unicast_hop_limit_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.receive-buffer-size"] - unsafe extern "C" fn export_method_udp_socket_receive_buffer_size(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_receive_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.set-receive-buffer-size"] - unsafe extern "C" fn export_method_udp_socket_set_receive_buffer_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_set_receive_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.send-buffer-size"] - unsafe extern "C" fn export_method_udp_socket_send_buffer_size(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_send_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.set-send-buffer-size"] - unsafe extern "C" fn export_method_udp_socket_set_send_buffer_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { - $($path_to_types)*::_export_method_udp_socket_set_send_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.subscribe"] - unsafe extern "C" fn export_method_udp_socket_subscribe(arg0: *mut u8,) -> i32 { - $($path_to_types)*::_export_method_udp_socket_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]incoming-datagram-stream.receive"] - unsafe extern "C" fn export_method_incoming_datagram_stream_receive(arg0: *mut u8,arg1: i64,) -> *mut u8 { - $($path_to_types)*::_export_method_incoming_datagram_stream_receive_cabi::<<$ty as $($path_to_types)*::Guest>::IncomingDatagramStream>(arg0, arg1) - } - #[export_name = "cabi_post_wasi:sockets/udp@0.2.0#[method]incoming-datagram-stream.receive"] - unsafe extern "C" fn _post_return_method_incoming_datagram_stream_receive(arg0: *mut u8,) { - $($path_to_types)*::__post_return_method_incoming_datagram_stream_receive::<<$ty as $($path_to_types)*::Guest>::IncomingDatagramStream>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]incoming-datagram-stream.subscribe"] - unsafe extern "C" fn export_method_incoming_datagram_stream_subscribe(arg0: *mut u8,) -> i32 { - $($path_to_types)*::_export_method_incoming_datagram_stream_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::IncomingDatagramStream>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]outgoing-datagram-stream.check-send"] - unsafe extern "C" fn export_method_outgoing_datagram_stream_check_send(arg0: *mut u8,) -> *mut u8 { - $($path_to_types)*::_export_method_outgoing_datagram_stream_check_send_cabi::<<$ty as $($path_to_types)*::Guest>::OutgoingDatagramStream>(arg0) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]outgoing-datagram-stream.send"] - unsafe extern "C" fn export_method_outgoing_datagram_stream_send(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { - $($path_to_types)*::_export_method_outgoing_datagram_stream_send_cabi::<<$ty as $($path_to_types)*::Guest>::OutgoingDatagramStream>(arg0, arg1, arg2) - } - #[export_name = "wasi:sockets/udp@0.2.0#[method]outgoing-datagram-stream.subscribe"] - unsafe extern "C" fn export_method_outgoing_datagram_stream_subscribe(arg0: *mut u8,) -> i32 { - $($path_to_types)*::_export_method_outgoing_datagram_stream_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::OutgoingDatagramStream>(arg0) - } - - const _: () = { - #[doc(hidden)] - #[export_name = "wasi:sockets/udp@0.2.0#[dtor]udp-socket"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::UdpSocket::dtor::< - <$ty as $($path_to_types)*::Guest>::UdpSocket - >(rep) - } - }; - - - const _: () = { - #[doc(hidden)] - #[export_name = "wasi:sockets/udp@0.2.0#[dtor]incoming-datagram-stream"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::IncomingDatagramStream::dtor::< - <$ty as $($path_to_types)*::Guest>::IncomingDatagramStream - >(rep) - } - }; - - - const _: () = { - #[doc(hidden)] - #[export_name = "wasi:sockets/udp@0.2.0#[dtor]outgoing-datagram-stream"] - #[allow(non_snake_case)] - unsafe extern "C" fn dtor(rep: *mut u8) { - $($path_to_types)*::OutgoingDatagramStream::dtor::< - <$ty as $($path_to_types)*::Guest>::OutgoingDatagramStream - >(rep) - } - }; - - };); -} + macro_rules! __export_wasi_sockets_udp_0_2_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "wasi:sockets/udp@0.2.0#[method]udp-socket.start-bind"] unsafe + extern "C" fn export_method_udp_socket_start_bind(arg0 : * mut + u8, arg1 : i32, arg2 : i32, arg3 : i32, arg4 : i32, arg5 : i32, + arg6 : i32, arg7 : i32, arg8 : i32, arg9 : i32, arg10 : i32, + arg11 : i32, arg12 : i32, arg13 : i32,) -> * mut u8 { + $($path_to_types)*:: + _export_method_udp_socket_start_bind_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0, arg1, arg2, + arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, + arg13) } #[export_name = + "wasi:sockets/udp@0.2.0#[method]udp-socket.finish-bind"] unsafe + extern "C" fn export_method_udp_socket_finish_bind(arg0 : * mut + u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_udp_socket_finish_bind_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0) } #[export_name + = "wasi:sockets/udp@0.2.0#[method]udp-socket.stream"] unsafe + extern "C" fn export_method_udp_socket_stream(arg0 : * mut u8, + arg1 : i32, arg2 : i32, arg3 : i32, arg4 : i32, arg5 : i32, arg6 + : i32, arg7 : i32, arg8 : i32, arg9 : i32, arg10 : i32, arg11 : + i32, arg12 : i32, arg13 : i32,) -> * mut u8 { + $($path_to_types)*:: _export_method_udp_socket_stream_cabi::<<$ty + as $($path_to_types)*:: Guest >::UdpSocket > (arg0, arg1, arg2, + arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, + arg13) } #[export_name = + "wasi:sockets/udp@0.2.0#[method]udp-socket.local-address"] unsafe + extern "C" fn export_method_udp_socket_local_address(arg0 : * mut + u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_udp_socket_local_address_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0) } #[export_name + = "wasi:sockets/udp@0.2.0#[method]udp-socket.remote-address"] + unsafe extern "C" fn export_method_udp_socket_remote_address(arg0 + : * mut u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_udp_socket_remote_address_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0) } #[export_name + = "wasi:sockets/udp@0.2.0#[method]udp-socket.address-family"] + unsafe extern "C" fn export_method_udp_socket_address_family(arg0 + : * mut u8,) -> i32 { $($path_to_types)*:: + _export_method_udp_socket_address_family_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0) } #[export_name + = "wasi:sockets/udp@0.2.0#[method]udp-socket.unicast-hop-limit"] + unsafe extern "C" fn + export_method_udp_socket_unicast_hop_limit(arg0 : * mut u8,) -> * + mut u8 { $($path_to_types)*:: + _export_method_udp_socket_unicast_hop_limit_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0) } #[export_name + = + "wasi:sockets/udp@0.2.0#[method]udp-socket.set-unicast-hop-limit"] + unsafe extern "C" fn + export_method_udp_socket_set_unicast_hop_limit(arg0 : * mut u8, + arg1 : i32,) -> * mut u8 { $($path_to_types)*:: + _export_method_udp_socket_set_unicast_hop_limit_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/udp@0.2.0#[method]udp-socket.receive-buffer-size"] + unsafe extern "C" fn + export_method_udp_socket_receive_buffer_size(arg0 : * mut u8,) -> + * mut u8 { $($path_to_types)*:: + _export_method_udp_socket_receive_buffer_size_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0) } #[export_name + = + "wasi:sockets/udp@0.2.0#[method]udp-socket.set-receive-buffer-size"] + unsafe extern "C" fn + export_method_udp_socket_set_receive_buffer_size(arg0 : * mut u8, + arg1 : i64,) -> * mut u8 { $($path_to_types)*:: + _export_method_udp_socket_set_receive_buffer_size_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/udp@0.2.0#[method]udp-socket.send-buffer-size"] + unsafe extern "C" fn + export_method_udp_socket_send_buffer_size(arg0 : * mut u8,) -> * + mut u8 { $($path_to_types)*:: + _export_method_udp_socket_send_buffer_size_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0) } #[export_name + = + "wasi:sockets/udp@0.2.0#[method]udp-socket.set-send-buffer-size"] + unsafe extern "C" fn + export_method_udp_socket_set_send_buffer_size(arg0 : * mut u8, + arg1 : i64,) -> * mut u8 { $($path_to_types)*:: + _export_method_udp_socket_set_send_buffer_size_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0, arg1) } + #[export_name = + "wasi:sockets/udp@0.2.0#[method]udp-socket.subscribe"] unsafe + extern "C" fn export_method_udp_socket_subscribe(arg0 : * mut + u8,) -> i32 { $($path_to_types)*:: + _export_method_udp_socket_subscribe_cabi::<<$ty as + $($path_to_types)*:: Guest >::UdpSocket > (arg0) } #[export_name + = + "wasi:sockets/udp@0.2.0#[method]incoming-datagram-stream.receive"] + unsafe extern "C" fn + export_method_incoming_datagram_stream_receive(arg0 : * mut u8, + arg1 : i64,) -> * mut u8 { $($path_to_types)*:: + _export_method_incoming_datagram_stream_receive_cabi::<<$ty as + $($path_to_types)*:: Guest >::IncomingDatagramStream > (arg0, + arg1) } #[export_name = + "cabi_post_wasi:sockets/udp@0.2.0#[method]incoming-datagram-stream.receive"] + unsafe extern "C" fn + _post_return_method_incoming_datagram_stream_receive(arg0 : * mut + u8,) { $($path_to_types)*:: + __post_return_method_incoming_datagram_stream_receive::<<$ty as + $($path_to_types)*:: Guest >::IncomingDatagramStream > (arg0) } + #[export_name = + "wasi:sockets/udp@0.2.0#[method]incoming-datagram-stream.subscribe"] + unsafe extern "C" fn + export_method_incoming_datagram_stream_subscribe(arg0 : * mut + u8,) -> i32 { $($path_to_types)*:: + _export_method_incoming_datagram_stream_subscribe_cabi::<<$ty as + $($path_to_types)*:: Guest >::IncomingDatagramStream > (arg0) } + #[export_name = + "wasi:sockets/udp@0.2.0#[method]outgoing-datagram-stream.check-send"] + unsafe extern "C" fn + export_method_outgoing_datagram_stream_check_send(arg0 : * mut + u8,) -> * mut u8 { $($path_to_types)*:: + _export_method_outgoing_datagram_stream_check_send_cabi::<<$ty as + $($path_to_types)*:: Guest >::OutgoingDatagramStream > (arg0) } + #[export_name = + "wasi:sockets/udp@0.2.0#[method]outgoing-datagram-stream.send"] + unsafe extern "C" fn + export_method_outgoing_datagram_stream_send(arg0 : * mut u8, arg1 + : * mut u8, arg2 : usize,) -> * mut u8 { $($path_to_types)*:: + _export_method_outgoing_datagram_stream_send_cabi::<<$ty as + $($path_to_types)*:: Guest >::OutgoingDatagramStream > (arg0, + arg1, arg2) } #[export_name = + "wasi:sockets/udp@0.2.0#[method]outgoing-datagram-stream.subscribe"] + unsafe extern "C" fn + export_method_outgoing_datagram_stream_subscribe(arg0 : * mut + u8,) -> i32 { $($path_to_types)*:: + _export_method_outgoing_datagram_stream_subscribe_cabi::<<$ty as + $($path_to_types)*:: Guest >::OutgoingDatagramStream > (arg0) } + const _ : () = { #[doc(hidden)] #[export_name = + "wasi:sockets/udp@0.2.0#[dtor]udp-socket"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: UdpSocket::dtor::< <$ty as + $($path_to_types)*:: Guest >::UdpSocket > (rep) } }; const _ : () + = { #[doc(hidden)] #[export_name = + "wasi:sockets/udp@0.2.0#[dtor]incoming-datagram-stream"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: IncomingDatagramStream::dtor::< <$ty + as $($path_to_types)*:: Guest >::IncomingDatagramStream > (rep) } + }; const _ : () = { #[doc(hidden)] #[export_name = + "wasi:sockets/udp@0.2.0#[dtor]outgoing-datagram-stream"] + #[allow(non_snake_case)] unsafe extern "C" fn dtor(rep : * mut + u8) { $($path_to_types)*:: OutgoingDatagramStream::dtor::< <$ty + as $($path_to_types)*:: Guest >::OutgoingDatagramStream > (rep) } + }; }; + }; + } #[doc(hidden)] pub(crate) use __export_wasi_sockets_udp_0_2_0_cabi; #[repr(align(8))] struct _RetArea([::core::mem::MaybeUninit; 36]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 36]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 36], + ); + } + #[allow(dead_code, clippy::all)] + pub mod udp_create_socket { + #[used] + #[doc(hidden)] + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type ErrorCode = super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; + pub type IpAddressFamily = super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily; + pub type UdpSocket = super::super::super::super::exports::wasi::sockets0_2_0::udp::UdpSocket; + pub type UdpSocketBorrow<'a> = super::super::super::super::exports::wasi::sockets0_2_0::udp::UdpSocketBorrow< + 'a, + >; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_create_udp_socket_cabi( + arg0: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = T::create_udp_socket( + super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily::_lift( + arg0 as u8, + ), + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(4).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + pub trait Guest { + /// Create a new UDP socket. + /// + /// Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX. + /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. + /// + /// This function does not require a network capability handle. This is considered to be safe because + /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind` is called, + /// the socket is effectively an in-memory configuration object, unable to communicate with the outside world. + /// + /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. + /// + /// # Typical errors + /// - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References: + /// - + /// - + /// - + /// - + fn create_udp_socket( + address_family: IpAddressFamily, + ) -> Result; + } + #[doc(hidden)] + macro_rules! __export_wasi_sockets_udp_create_socket_0_2_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[export_name = + "wasi:sockets/udp-create-socket@0.2.0#create-udp-socket"] unsafe + extern "C" fn export_create_udp_socket(arg0 : i32,) -> * mut u8 { + $($path_to_types)*:: _export_create_udp_socket_cabi::<$ty > + (arg0) } }; + }; + } + #[doc(hidden)] + pub(crate) use __export_wasi_sockets_udp_create_socket_0_2_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 8]); + static mut _RET_AREA: _RetArea = _RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); } } } } mod _rt { - use core::fmt; use core::marker; use core::sync::atomic::{AtomicU32, Ordering::Relaxed}; - /// A type which represents a component model resource, either imported or /// exported into this component. /// @@ -19570,16 +20970,9 @@ mod _rt { /// resources. #[repr(transparent)] pub struct Resource { - // NB: This would ideally be `u32` but it is not. The fact that this has - // interior mutability is not exposed in the API of this type except for the - // `take_handle` method which is supposed to in theory be private. - // - // This represents, almost all the time, a valid handle value. When it's - // invalid it's stored as `u32::MAX`. handle: AtomicU32, _marker: marker::PhantomData, } - /// A trait which all wasm resources implement, namely providing the ability to /// drop a resource. /// @@ -19589,7 +20982,6 @@ mod _rt { /// Invokes the `[resource-drop]...` intrinsic. unsafe fn drop(handle: u32); } - impl Resource { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -19599,7 +20991,6 @@ mod _rt { _marker: marker::PhantomData, } } - /// Takes ownership of the handle owned by `resource`. /// /// Note that this ideally would be `into_handle` taking `Resource` by @@ -19616,31 +21007,21 @@ mod _rt { pub fn take_handle(resource: &Resource) -> u32 { resource.handle.swap(u32::MAX, Relaxed) } - #[doc(hidden)] pub fn handle(resource: &Resource) -> u32 { resource.handle.load(Relaxed) } } - impl fmt::Debug for Resource { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Resource") - .field("handle", &self.handle) - .finish() + f.debug_struct("Resource").field("handle", &self.handle).finish() } } - impl Drop for Resource { fn drop(&mut self) { unsafe { match self.handle.load(Relaxed) { - // If this handle was "taken" then don't do anything in the - // destructor. u32::MAX => {} - - // ... but otherwise do actually destroy it with the imported - // component model intrinsic as defined through `T`. other => T::drop(other), } } @@ -19667,28 +21048,23 @@ mod _rt { } } pub use alloc_crate::alloc; - pub fn as_i64(t: T) -> i64 { t.as_i64() } - pub trait AsI64 { fn as_i64(self) -> i64; } - impl<'a, T: Copy + AsI64> AsI64 for &'a T { fn as_i64(self) -> i64 { (*self).as_i64() } } - impl AsI64 for i64 { #[inline] fn as_i64(self) -> i64 { self as i64 } } - impl AsI64 for u64 { #[inline] fn as_i64(self) -> i64 { @@ -19702,70 +21078,59 @@ mod _rt { core::hint::unreachable_unchecked() } } - pub fn as_i32(t: T) -> i32 { t.as_i32() } - pub trait AsI32 { fn as_i32(self) -> i32; } - impl<'a, T: Copy + AsI32> AsI32 for &'a T { fn as_i32(self) -> i32 { (*self).as_i32() } } - impl AsI32 for i32 { #[inline] fn as_i32(self) -> i32 { self as i32 } } - impl AsI32 for u32 { #[inline] fn as_i32(self) -> i32 { self as i32 } } - impl AsI32 for i16 { #[inline] fn as_i32(self) -> i32 { self as i32 } } - impl AsI32 for u16 { #[inline] fn as_i32(self) -> i32 { self as i32 } } - impl AsI32 for i8 { #[inline] fn as_i32(self) -> i32 { self as i32 } } - impl AsI32 for u8 { #[inline] fn as_i32(self) -> i32 { self as i32 } } - impl AsI32 for char { #[inline] fn as_i32(self) -> i32 { self as i32 } } - impl AsI32 for usize { #[inline] fn as_i32(self) -> i32 { @@ -19777,50 +21142,41 @@ mod _rt { return; } let layout = alloc::Layout::from_size_align_unchecked(size, align); - alloc::dealloc(ptr as *mut u8, layout); + alloc::dealloc(ptr, layout); } - #[cfg(target_arch = "wasm32")] pub fn run_ctors_once() { wit_bindgen_rt::run_ctors_once(); } pub use alloc_crate::boxed::Box; - pub fn as_f32(t: T) -> f32 { t.as_f32() } - pub trait AsF32 { fn as_f32(self) -> f32; } - impl<'a, T: Copy + AsF32> AsF32 for &'a T { fn as_f32(self) -> f32 { (*self).as_f32() } } - impl AsF32 for f32 { #[inline] fn as_f32(self) -> f32 { self as f32 } } - pub fn as_f64(t: T) -> f64 { t.as_f64() } - pub trait AsF64 { fn as_f64(self) -> f64; } - impl<'a, T: Copy + AsF64> AsF64 for &'a T { fn as_f64(self) -> f64 { (*self).as_f64() } } - impl AsF64 for f64 { #[inline] fn as_f64(self) -> f64 { @@ -19829,7 +21185,6 @@ mod _rt { } extern crate alloc as alloc_crate; } - /// Generates `#[no_mangle]` functions to export the specified type as the /// root implementation of all generated traits. /// @@ -19848,44 +21203,80 @@ mod _rt { /// ``` #[allow(unused_macros)] #[doc(hidden)] - macro_rules! __export_deny_all_impl { - ($ty:ident) => (self::export!($ty with_types_in self);); - ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( - $($path_to_types_root)*::exports::wasi::cli0_2_0::environment::__export_wasi_cli_environment_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::cli0_2_0::environment); - $($path_to_types_root)*::exports::wasi::filesystem0_2_0::preopens::__export_wasi_filesystem_preopens_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::filesystem0_2_0::preopens); - $($path_to_types_root)*::exports::wasi::http0_2_0::outgoing_handler::__export_wasi_http_outgoing_handler_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::http0_2_0::outgoing_handler); - $($path_to_types_root)*::exports::wasi::sockets0_2_0::ip_name_lookup::__export_wasi_sockets_ip_name_lookup_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::sockets0_2_0::ip_name_lookup); - $($path_to_types_root)*::exports::wasi::sockets0_2_0::tcp::__export_wasi_sockets_tcp_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::sockets0_2_0::tcp); - $($path_to_types_root)*::exports::wasi::sockets0_2_0::udp::__export_wasi_sockets_udp_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::sockets0_2_0::udp); - $($path_to_types_root)*::exports::fermyon::spin::llm::__export_fermyon_spin_llm_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::llm); - $($path_to_types_root)*::exports::fermyon::spin::redis::__export_fermyon_spin_redis_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::redis); - $($path_to_types_root)*::exports::fermyon::spin::mqtt::__export_fermyon_spin_mqtt_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::mqtt); - $($path_to_types_root)*::exports::fermyon::spin::rdbms_types::__export_fermyon_spin_rdbms_types_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::rdbms_types); - $($path_to_types_root)*::exports::fermyon::spin::postgres::__export_fermyon_spin_postgres_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::postgres); - $($path_to_types_root)*::exports::fermyon::spin::mysql::__export_fermyon_spin_mysql_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::mysql); - $($path_to_types_root)*::exports::fermyon::spin::sqlite::__export_fermyon_spin_sqlite_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::sqlite); - $($path_to_types_root)*::exports::fermyon::spin::key_value::__export_fermyon_spin_key_value_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::key_value); - $($path_to_types_root)*::exports::fermyon::spin::variables::__export_fermyon_spin_variables_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::variables); - ) + ($ty:ident) => { + self::export!($ty with_types_in self); + }; + ($ty:ident with_types_in $($path_to_types_root:tt)*) => { + $($path_to_types_root)*:: + exports::wasi::cli0_2_0::environment::__export_wasi_cli_environment_0_2_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::wasi::cli0_2_0::environment); + $($path_to_types_root)*:: + exports::wasi::filesystem0_2_0::preopens::__export_wasi_filesystem_preopens_0_2_0_cabi!($ty + with_types_in $($path_to_types_root)*:: + exports::wasi::filesystem0_2_0::preopens); $($path_to_types_root)*:: + exports::wasi::http0_2_0::outgoing_handler::__export_wasi_http_outgoing_handler_0_2_0_cabi!($ty + with_types_in $($path_to_types_root)*:: + exports::wasi::http0_2_0::outgoing_handler); $($path_to_types_root)*:: + exports::wasi::sockets0_2_0::ip_name_lookup::__export_wasi_sockets_ip_name_lookup_0_2_0_cabi!($ty + with_types_in $($path_to_types_root)*:: + exports::wasi::sockets0_2_0::ip_name_lookup); $($path_to_types_root)*:: + exports::wasi::sockets0_2_0::tcp::__export_wasi_sockets_tcp_0_2_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::wasi::sockets0_2_0::tcp); + $($path_to_types_root)*:: + exports::wasi::sockets0_2_0::tcp_create_socket::__export_wasi_sockets_tcp_create_socket_0_2_0_cabi!($ty + with_types_in $($path_to_types_root)*:: + exports::wasi::sockets0_2_0::tcp_create_socket); $($path_to_types_root)*:: + exports::wasi::sockets0_2_0::udp::__export_wasi_sockets_udp_0_2_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::wasi::sockets0_2_0::udp); + $($path_to_types_root)*:: + exports::wasi::sockets0_2_0::udp_create_socket::__export_wasi_sockets_udp_create_socket_0_2_0_cabi!($ty + with_types_in $($path_to_types_root)*:: + exports::wasi::sockets0_2_0::udp_create_socket); $($path_to_types_root)*:: + exports::fermyon::spin::llm::__export_fermyon_spin_llm_2_0_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::fermyon::spin::llm); + $($path_to_types_root)*:: + exports::fermyon::spin::redis::__export_fermyon_spin_redis_2_0_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::fermyon::spin::redis); + $($path_to_types_root)*:: + exports::fermyon::spin::mqtt::__export_fermyon_spin_mqtt_2_0_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::fermyon::spin::mqtt); + $($path_to_types_root)*:: + exports::fermyon::spin::rdbms_types::__export_fermyon_spin_rdbms_types_2_0_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::fermyon::spin::rdbms_types); + $($path_to_types_root)*:: + exports::fermyon::spin::postgres::__export_fermyon_spin_postgres_2_0_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::fermyon::spin::postgres); + $($path_to_types_root)*:: + exports::fermyon::spin::mysql::__export_fermyon_spin_mysql_2_0_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::fermyon::spin::mysql); + $($path_to_types_root)*:: + exports::fermyon::spin::sqlite::__export_fermyon_spin_sqlite_2_0_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::fermyon::spin::sqlite); + $($path_to_types_root)*:: + exports::fermyon::spin::key_value::__export_fermyon_spin_key_value_2_0_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::fermyon::spin::key_value); + $($path_to_types_root)*:: + exports::fermyon::spin::variables::__export_fermyon_spin_variables_2_0_0_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::fermyon::spin::variables); + }; } #[doc(inline)] pub(crate) use __export_deny_all_impl as export; - #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.25.0:deny-all:encoded world"] +#[link_section = "component-type:wit-bindgen:0.35.0:fermyon:spin-virt:deny-all:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 18084] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xa4\x8c\x01\x01A\x02\ -\x01AB\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\x04\0\x1d[\ -method]error.to-debug-string\x01\x02\x03\x01\x13wasi:io/error@0.2.0\x05\0\x01B\x0a\ +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 18482] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xb2\x8f\x01\x01A\x02\ +\x01AH\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\x04\0\x1d[\ +method]error.to-debug-string\x01\x02\x03\0\x13wasi:io/error@0.2.0\x05\0\x01B\x0a\ \x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[method]po\ llable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.block\x01\ -\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\x01\x12wa\ -si:io/poll@0.2.0\x05\x01\x02\x03\0\0\x05error\x02\x03\0\x01\x08pollable\x01B(\x02\ -\x03\x02\x01\x02\x04\0\x05error\x03\0\0\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\ -\0\x02\x01i\x01\x01q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0c\ -stream-error\x03\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\ +\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\0\x12wasi\ +:io/poll@0.2.0\x05\x01\x02\x03\0\0\x05error\x02\x03\0\x01\x08pollable\x01B(\x02\x03\ +\x02\x01\x02\x04\0\x05error\x03\0\0\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\x02\ +\x01i\x01\x01q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstr\ +eam-error\x03\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\ \x01h\x07\x01p}\x01j\x01\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19\ [method]input-stream.read\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\ \x01j\x01w\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-str\ @@ -19900,33 +21291,33 @@ utput-stream.subscribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method ]output-stream.write-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-z\ eroes-and-flush\x01\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[\ method]output-stream.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\ -\x18\x03\x01\x15wasi:io/streams@0.2.0\x05\x04\x01B\x05\x01r\x02\x07secondsw\x0bn\ -anosecondsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0a\ -resolution\x01\x02\x03\x01\x1cwasi:clocks/wall-clock@0.2.0\x05\x05\x02\x03\0\x02\ -\x0cinput-stream\x02\x03\0\x02\x0doutput-stream\x02\x03\0\x02\x05error\x02\x03\0\ -\x03\x08datetime\x01Br\x02\x03\x02\x01\x06\x04\0\x0cinput-stream\x03\0\0\x02\x03\ -\x02\x01\x07\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x08\x04\0\x05error\ -\x03\0\x04\x02\x03\x02\x01\x09\x04\0\x08datetime\x03\0\x06\x01w\x04\0\x08filesiz\ -e\x03\0\x08\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09directory\ -\x04fifo\x0dsymbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-type\x03\ -\0\x0a\x01n\x06\x04read\x05write\x13file-integrity-sync\x13data-integrity-sync\x14\ -requested-write-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\x0c\x01\ -n\x01\x0esymlink-follow\x04\0\x0apath-flags\x03\0\x0e\x01n\x04\x06create\x09dire\ -ctory\x09exclusive\x08truncate\x04\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0alink-\ -count\x03\0\x12\x01k\x07\x01r\x06\x04type\x0b\x0alink-count\x13\x04size\x09\x15d\ -ata-access-timestamp\x14\x1bdata-modification-timestamp\x14\x17status-change-tim\ -estamp\x14\x04\0\x0fdescriptor-stat\x03\0\x15\x01q\x03\x09no-change\0\0\x03now\0\ -\0\x09timestamp\x01\x07\0\x04\0\x0dnew-timestamp\x03\0\x17\x01r\x02\x04type\x0b\x04\ -names\x04\0\x0fdirectory-entry\x03\0\x19\x01m%\x06access\x0bwould-block\x07alrea\ -dy\x0ebad-descriptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-large\x15\ -illegal-byte-sequence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-direc\ -tory\x04loop\x0etoo-many-links\x0cmessage-size\x0dname-too-long\x09no-device\x08\ -no-entry\x07no-lock\x13insufficient-memory\x12insufficient-space\x0dnot-director\ -y\x09not-empty\x0fnot-recoverable\x0bunsupported\x06no-tty\x0eno-such-device\x08\ -overflow\x0dnot-permitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file-busy\ -\x0ccross-device\x04\0\x0aerror-code\x03\0\x1b\x01m\x06\x06normal\x0asequential\x06\ -random\x09will-need\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x1d\x01r\x02\x05\ -lowerw\x05upperw\x04\0\x13metadata-hash-value\x03\0\x1f\x04\0\x0adescriptor\x03\x01\ +\x18\x03\0\x15wasi:io/streams@0.2.0\x05\x04\x01B\x05\x01r\x02\x07secondsw\x0bnan\ +osecondsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0ar\ +esolution\x01\x02\x03\0\x1cwasi:clocks/wall-clock@0.2.0\x05\x05\x02\x03\0\x02\x0c\ +input-stream\x02\x03\0\x02\x0doutput-stream\x02\x03\0\x02\x05error\x02\x03\0\x03\ +\x08datetime\x01Br\x02\x03\x02\x01\x06\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\ +\x01\x07\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x08\x04\0\x05error\x03\ +\0\x04\x02\x03\x02\x01\x09\x04\0\x08datetime\x03\0\x06\x01w\x04\0\x08filesize\x03\ +\0\x08\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09directory\x04f\ +ifo\x0dsymbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-type\x03\0\x0a\ +\x01n\x06\x04read\x05write\x13file-integrity-sync\x13data-integrity-sync\x14requ\ +ested-write-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\x0c\x01n\x01\ +\x0esymlink-follow\x04\0\x0apath-flags\x03\0\x0e\x01n\x04\x06create\x09directory\ +\x09exclusive\x08truncate\x04\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0alink-count\ +\x03\0\x12\x01k\x07\x01r\x06\x04type\x0b\x0alink-count\x13\x04size\x09\x15data-a\ +ccess-timestamp\x14\x1bdata-modification-timestamp\x14\x17status-change-timestam\ +p\x14\x04\0\x0fdescriptor-stat\x03\0\x15\x01q\x03\x09no-change\0\0\x03now\0\0\x09\ +timestamp\x01\x07\0\x04\0\x0dnew-timestamp\x03\0\x17\x01r\x02\x04type\x0b\x04nam\ +es\x04\0\x0fdirectory-entry\x03\0\x19\x01m%\x06access\x0bwould-block\x07already\x0e\ +bad-descriptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-large\x15illega\ +l-byte-sequence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-directory\x04\ +loop\x0etoo-many-links\x0cmessage-size\x0dname-too-long\x09no-device\x08no-entry\ +\x07no-lock\x13insufficient-memory\x12insufficient-space\x0dnot-directory\x09not\ +-empty\x0fnot-recoverable\x0bunsupported\x06no-tty\x0eno-such-device\x08overflow\ +\x0dnot-permitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file-busy\x0ccros\ +s-device\x04\0\x0aerror-code\x03\0\x1b\x01m\x06\x06normal\x0asequential\x06rando\ +m\x09will-need\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x1d\x01r\x02\x05lo\ +werw\x05upperw\x04\0\x13metadata-hash-value\x03\0\x1f\x04\0\x0adescriptor\x03\x01\ \x04\0\x16directory-entry-stream\x03\x01\x01h!\x01i\x01\x01j\x01$\x01\x1c\x01@\x02\ \x04self#\x06offset\x09\0%\x04\0\"[method]descriptor.read-via-stream\x01&\x01i\x03\ \x01j\x01'\x01\x1c\x01@\x02\x04self#\x06offset\x09\0(\x04\0#[method]descriptor.w\ @@ -19961,14 +21352,14 @@ self#\x05other#\0\x7f\x04\0![method]descriptor.is-same-object\x01J\x01j\x01\x20\ @\x03\x04self#\x0apath-flags\x0f\x04paths\0\xcb\0\x04\0#[method]descriptor.metad\ ata-hash-at\x01M\x01h\"\x01k\x1a\x01j\x01\xcf\0\x01\x1c\x01@\x01\x04self\xce\0\0\ \xd0\0\x04\03[method]directory-entry-stream.read-directory-entry\x01Q\x01h\x05\x01\ -k\x1c\x01@\x01\x03err\xd2\0\0\xd3\0\x04\0\x15filesystem-error-code\x01T\x03\x01\x1b\ +k\x1c\x01@\x01\x03err\xd2\0\0\xd3\0\x04\0\x15filesystem-error-code\x01T\x03\0\x1b\ wasi:filesystem/types@0.2.0\x05\x0a\x01B\x0f\x02\x03\x02\x01\x03\x04\0\x08pollab\ le\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duration\x03\0\x04\x01@\ \0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\x07\x01i\x01\x01\ @\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\x01\x04when\x05\0\ -\x08\x04\0\x12subscribe-duration\x01\x0a\x03\x01!wasi:clocks/monotonic-clock@0.2\ -.0\x05\x0b\x02\x03\0\x05\x08duration\x01B\xc0\x01\x02\x03\x02\x01\x0c\x04\0\x08d\ -uration\x03\0\0\x02\x03\x02\x01\x06\x04\0\x0cinput-stream\x03\0\x02\x02\x03\x02\x01\ +\x08\x04\0\x12subscribe-duration\x01\x0a\x03\0!wasi:clocks/monotonic-clock@0.2.0\ +\x05\x0b\x02\x03\0\x05\x08duration\x01B\xc0\x01\x02\x03\x02\x01\x0c\x04\0\x08dur\ +ation\x03\0\0\x02\x03\x02\x01\x06\x04\0\x0cinput-stream\x03\0\x02\x02\x03\x02\x01\ \x07\x04\0\x0doutput-stream\x03\0\x04\x02\x03\x02\x01\x02\x04\0\x08io-error\x03\0\ \x06\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\x08\x01q\x0a\x03get\0\0\x04head\ \0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07connect\0\0\x07options\0\0\x05trace\ @@ -20055,196 +21446,203 @@ trailers\xf2\0\0\x81\x01\x04\0\x1c[static]outgoing-body.finish\x01\x82\x01\x01h0 be\x01\x84\x01\x01i+\x01j\x01\x85\x01\x01\x1b\x01j\x01\x86\x01\0\x01k\x87\x01\x01\ @\x01\x04self\x83\x01\0\x88\x01\x04\0$[method]future-incoming-response.get\x01\x89\ \x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8a\x01\0\x8b\x01\x04\0\x0fhttp-error-cod\ -e\x01\x8c\x01\x03\x01\x15wasi:http/types@0.2.0\x05\x0d\x01B\x11\x04\0\x07network\ -\x03\x01\x01m\x15\x07unknown\x0daccess-denied\x0dnot-supported\x10invalid-argume\ -nt\x0dout-of-memory\x07timeout\x14concurrency-conflict\x0fnot-in-progress\x0bwou\ -ld-block\x0dinvalid-state\x10new-socket-limit\x14address-not-bindable\x0eaddress\ --in-use\x12remote-unreachable\x12connection-refused\x10connection-reset\x12conne\ -ction-aborted\x12datagram-too-large\x11name-unresolvable\x1atemporary-resolver-f\ -ailure\x1apermanent-resolver-failure\x04\0\x0aerror-code\x03\0\x01\x01m\x02\x04i\ -pv4\x04ipv6\x04\0\x11ip-address-family\x03\0\x03\x01o\x04}}}}\x04\0\x0cipv4-addr\ -ess\x03\0\x05\x01o\x08{{{{{{{{\x04\0\x0cipv6-address\x03\0\x07\x01q\x02\x04ipv4\x01\ -\x06\0\x04ipv6\x01\x08\0\x04\0\x0aip-address\x03\0\x09\x01r\x02\x04port{\x07addr\ -ess\x06\x04\0\x13ipv4-socket-address\x03\0\x0b\x01r\x04\x04port{\x09flow-infoy\x07\ -address\x08\x08scope-idy\x04\0\x13ipv6-socket-address\x03\0\x0d\x01q\x02\x04ipv4\ -\x01\x0c\0\x04ipv6\x01\x0e\0\x04\0\x11ip-socket-address\x03\0\x0f\x03\x01\x1awas\ -i:sockets/network@0.2.0\x05\x0e\x01B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0f\ -get-environment\x01\x02\x01ps\x01@\0\0\x03\x04\0\x0dget-arguments\x01\x04\x01ks\x01\ -@\0\0\x05\x04\0\x0binitial-cwd\x01\x06\x04\x01\x1awasi:cli/environment@0.2.0\x05\ -\x0f\x02\x03\0\x04\x0adescriptor\x01B\x07\x02\x03\x02\x01\x10\x04\0\x0adescripto\ -r\x03\0\0\x01i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\x04\x04\0\x0fget-directories\x01\ -\x05\x04\x01\x1ewasi:filesystem/preopens@0.2.0\x05\x11\x02\x03\0\x06\x10outgoing\ --request\x02\x03\0\x06\x0frequest-options\x02\x03\0\x06\x18future-incoming-respo\ -nse\x02\x03\0\x06\x0aerror-code\x01B\x0f\x02\x03\x02\x01\x12\x04\0\x10outgoing-r\ -equest\x03\0\0\x02\x03\x02\x01\x13\x04\0\x0frequest-options\x03\0\x02\x02\x03\x02\ -\x01\x14\x04\0\x18future-incoming-response\x03\0\x04\x02\x03\x02\x01\x15\x04\0\x0a\ -error-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01i\x05\x01j\x01\x0b\x01\x07\x01\ -@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06handle\x01\x0d\x04\x01\x20was\ -i:http/outgoing-handler@0.2.0\x05\x16\x02\x03\0\x07\x07network\x02\x03\0\x07\x0a\ -error-code\x02\x03\0\x07\x0aip-address\x01B\x16\x02\x03\x02\x01\x03\x04\0\x08pol\ -lable\x03\0\0\x02\x03\x02\x01\x17\x04\0\x07network\x03\0\x02\x02\x03\x02\x01\x18\ -\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01\x19\x04\0\x0aip-address\x03\0\x06\ -\x04\0\x16resolve-address-stream\x03\x01\x01h\x08\x01k\x07\x01j\x01\x0a\x01\x05\x01\ -@\x01\x04self\x09\0\x0b\x04\03[method]resolve-address-stream.resolve-next-addres\ -s\x01\x0c\x01i\x01\x01@\x01\x04self\x09\0\x0d\x04\0([method]resolve-address-stre\ -am.subscribe\x01\x0e\x01h\x03\x01i\x08\x01j\x01\x10\x01\x05\x01@\x02\x07network\x0f\ -\x04names\0\x11\x04\0\x11resolve-addresses\x01\x12\x04\x01!wasi:sockets/ip-name-\ -lookup@0.2.0\x05\x1a\x02\x03\0\x07\x11ip-socket-address\x02\x03\0\x07\x11ip-addr\ -ess-family\x01BT\x02\x03\x02\x01\x06\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\ -\x07\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\ -\x04\x02\x03\x02\x01\x0c\x04\0\x08duration\x03\0\x06\x02\x03\x02\x01\x17\x04\0\x07\ -network\x03\0\x08\x02\x03\x02\x01\x18\x04\0\x0aerror-code\x03\0\x0a\x02\x03\x02\x01\ -\x1b\x04\0\x11ip-socket-address\x03\0\x0c\x02\x03\x02\x01\x1c\x04\0\x11ip-addres\ -s-family\x03\0\x0e\x01m\x03\x07receive\x04send\x04both\x04\0\x0dshutdown-type\x03\ -\0\x10\x04\0\x0atcp-socket\x03\x01\x01h\x12\x01h\x09\x01j\0\x01\x0b\x01@\x03\x04\ -self\x13\x07network\x14\x0dlocal-address\x0d\0\x15\x04\0\x1d[method]tcp-socket.s\ -tart-bind\x01\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e[method]tcp-socket.finish-\ -bind\x01\x17\x01@\x03\x04self\x13\x07network\x14\x0eremote-address\x0d\0\x15\x04\ -\0\x20[method]tcp-socket.start-connect\x01\x18\x01i\x01\x01i\x03\x01o\x02\x19\x1a\ -\x01j\x01\x1b\x01\x0b\x01@\x01\x04self\x13\0\x1c\x04\0![method]tcp-socket.finish\ --connect\x01\x1d\x04\0\x1f[method]tcp-socket.start-listen\x01\x17\x04\0\x20[meth\ -od]tcp-socket.finish-listen\x01\x17\x01i\x12\x01o\x03\x1e\x19\x1a\x01j\x01\x1f\x01\ -\x0b\x01@\x01\x04self\x13\0\x20\x04\0\x19[method]tcp-socket.accept\x01!\x01j\x01\ -\x0d\x01\x0b\x01@\x01\x04self\x13\0\"\x04\0\x20[method]tcp-socket.local-address\x01\ -#\x04\0![method]tcp-socket.remote-address\x01#\x01@\x01\x04self\x13\0\x7f\x04\0\x1f\ -[method]tcp-socket.is-listening\x01$\x01@\x01\x04self\x13\0\x0f\x04\0![method]tc\ -p-socket.address-family\x01%\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0*[method]\ -tcp-socket.set-listen-backlog-size\x01&\x01j\x01\x7f\x01\x0b\x01@\x01\x04self\x13\ -\0'\x04\0%[method]tcp-socket.keep-alive-enabled\x01(\x01@\x02\x04self\x13\x05val\ -ue\x7f\0\x15\x04\0)[method]tcp-socket.set-keep-alive-enabled\x01)\x01j\x01\x07\x01\ -\x0b\x01@\x01\x04self\x13\0*\x04\0'[method]tcp-socket.keep-alive-idle-time\x01+\x01\ -@\x02\x04self\x13\x05value\x07\0\x15\x04\0+[method]tcp-socket.set-keep-alive-idl\ -e-time\x01,\x04\0&[method]tcp-socket.keep-alive-interval\x01+\x04\0*[method]tcp-\ -socket.set-keep-alive-interval\x01,\x01j\x01y\x01\x0b\x01@\x01\x04self\x13\0-\x04\ -\0#[method]tcp-socket.keep-alive-count\x01.\x01@\x02\x04self\x13\x05valuey\0\x15\ -\x04\0'[method]tcp-socket.set-keep-alive-count\x01/\x01j\x01}\x01\x0b\x01@\x01\x04\ -self\x13\00\x04\0\x1c[method]tcp-socket.hop-limit\x011\x01@\x02\x04self\x13\x05v\ -alue}\0\x15\x04\0\x20[method]tcp-socket.set-hop-limit\x012\x01j\x01w\x01\x0b\x01\ -@\x01\x04self\x13\03\x04\0&[method]tcp-socket.receive-buffer-size\x014\x04\0*[me\ -thod]tcp-socket.set-receive-buffer-size\x01&\x04\0#[method]tcp-socket.send-buffe\ -r-size\x014\x04\0'[method]tcp-socket.set-send-buffer-size\x01&\x01i\x05\x01@\x01\ -\x04self\x13\05\x04\0\x1c[method]tcp-socket.subscribe\x016\x01@\x02\x04self\x13\x0d\ -shutdown-type\x11\0\x15\x04\0\x1b[method]tcp-socket.shutdown\x017\x04\x01\x16was\ -i:sockets/tcp@0.2.0\x05\x1d\x01BD\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\0\x02\ -\x03\x02\x01\x17\x04\0\x07network\x03\0\x02\x02\x03\x02\x01\x18\x04\0\x0aerror-c\ -ode\x03\0\x04\x02\x03\x02\x01\x1b\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\x02\ -\x01\x1c\x04\0\x11ip-address-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0eremo\ -te-address\x07\x04\0\x11incoming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\ -\x0eremote-address\x0d\x04\0\x11outgoing-datagram\x03\0\x0e\x04\0\x0audp-socket\x03\ -\x01\x04\0\x18incoming-datagram-stream\x03\x01\x04\0\x18outgoing-datagram-stream\ -\x03\x01\x01h\x10\x01h\x03\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0d\ -local-address\x07\0\x15\x04\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04\ -self\x13\0\x15\x04\0\x1e[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\ -\x01o\x02\x18\x19\x01j\x01\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\ -\0\x1b\x04\0\x19[method]udp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04\ -self\x13\0\x1d\x04\0\x20[method]udp-socket.local-address\x01\x1e\x04\0![method]u\ -dp-socket.remote-address\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-so\ -cket.address-family\x01\x1f\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[\ -method]udp-socket.unicast-hop-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\ -\0([method]udp-socket.set-unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04\ -self\x13\0#\x04\0&[method]udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\ -\x05valuew\0\x15\x04\0*[method]udp-socket.set-receive-buffer-size\x01%\x04\0#[me\ -thod]udp-socket.send-buffer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-s\ -ize\x01%\x01i\x01\x01@\x01\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01\ -'\x01h\x11\x01p\x0c\x01j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0\ -([method]incoming-datagram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[metho\ -d]incoming-datagram-stream.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[m\ -ethod]outgoing-datagram-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09dat\ -agrams/\0#\x04\0%[method]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\ -\x04\0*[method]outgoing-datagram-stream.subscribe\x011\x04\x01\x16wasi:sockets/u\ -dp@0.2.0\x05\x1e\x01B\x1a\x01s\x04\0\x11inferencing-model\x03\0\0\x01r\x06\x0ama\ -x-tokensy\x0erepeat-penaltyv!repeat-penalty-last-n-token-county\x0btemperaturev\x05\ -top-ky\x05top-pv\x04\0\x12inferencing-params\x03\0\x02\x01q\x03\x13model-not-sup\ -ported\0\0\x0druntime-error\x01s\0\x0dinvalid-input\x01s\0\x04\0\x05error\x03\0\x04\ -\x01r\x02\x12prompt-token-county\x15generated-token-county\x04\0\x11inferencing-\ -usage\x03\0\x06\x01r\x02\x04texts\x05usage\x07\x04\0\x12inferencing-result\x03\0\ -\x08\x01s\x04\0\x0fembedding-model\x03\0\x0a\x01r\x01\x12prompt-token-county\x04\ -\0\x10embeddings-usage\x03\0\x0c\x01pv\x01p\x0e\x01r\x02\x0aembeddings\x0f\x05us\ -age\x0d\x04\0\x11embeddings-result\x03\0\x10\x01k\x03\x01j\x01\x09\x01\x05\x01@\x03\ -\x05model\x01\x06prompts\x06params\x12\0\x13\x04\0\x05infer\x01\x14\x01ps\x01j\x01\ -\x11\x01\x05\x01@\x02\x05model\x0b\x04text\x15\0\x16\x04\0\x13generate-embedding\ -s\x01\x17\x04\x01\x16fermyon:spin/llm@2.0.0\x05\x1f\x01B)\x01q\x04\x0finvalid-ad\ -dress\0\0\x14too-many-connections\0\0\x0atype-error\0\0\x05other\x01s\0\x04\0\x05\ -error\x03\0\0\x04\0\x0aconnection\x03\x01\x01p}\x04\0\x07payload\x03\0\x03\x01q\x02\ -\x05int64\x01x\0\x06binary\x01\x04\0\x04\0\x0fredis-parameter\x03\0\x05\x01q\x04\ -\x03nil\0\0\x06status\x01s\0\x05int64\x01x\0\x06binary\x01\x04\0\x04\0\x0credis-\ -result\x03\0\x07\x01i\x02\x01j\x01\x09\x01\x01\x01@\x01\x07addresss\0\x0a\x04\0\x17\ -[static]connection.open\x01\x0b\x01h\x02\x01j\0\x01\x01\x01@\x03\x04self\x0c\x07\ -channels\x07payload\x04\0\x0d\x04\0\x1a[method]connection.publish\x01\x0e\x01k\x04\ -\x01j\x01\x0f\x01\x01\x01@\x02\x04self\x0c\x03keys\0\x10\x04\0\x16[method]connec\ -tion.get\x01\x11\x01@\x03\x04self\x0c\x03keys\x05value\x04\0\x0d\x04\0\x16[metho\ -d]connection.set\x01\x12\x01j\x01x\x01\x01\x01@\x02\x04self\x0c\x03keys\0\x13\x04\ -\0\x17[method]connection.incr\x01\x14\x01ps\x01j\x01y\x01\x01\x01@\x02\x04self\x0c\ -\x04keys\x15\0\x16\x04\0\x16[method]connection.del\x01\x17\x01@\x03\x04self\x0c\x03\ -keys\x06values\x15\0\x16\x04\0\x17[method]connection.sadd\x01\x18\x01j\x01\x15\x01\ -\x01\x01@\x02\x04self\x0c\x03keys\0\x19\x04\0\x1b[method]connection.smembers\x01\ -\x1a\x04\0\x17[method]connection.srem\x01\x18\x01p\x06\x01p\x08\x01j\x01\x1c\x01\ -\x01\x01@\x03\x04self\x0c\x07commands\x09arguments\x1b\0\x1d\x04\0\x1a[method]co\ -nnection.execute\x01\x1e\x04\x01\x18fermyon:spin/redis@2.0.0\x05\x20\x01B\x0f\x01\ -q\x04\x0finvalid-address\0\0\x14too-many-connections\0\0\x11connection-failed\x01\ -s\0\x05other\x01s\0\x04\0\x05error\x03\0\0\x01m\x03\x0cat-most-once\x0dat-least-\ -once\x0cexactly-once\x04\0\x03qos\x03\0\x02\x04\0\x0aconnection\x03\x01\x01p}\x04\ -\0\x07payload\x03\0\x05\x01i\x04\x01j\x01\x07\x01\x01\x01@\x04\x07addresss\x08us\ -ernames\x08passwords\x1bkeep-alive-interval-in-secsw\0\x08\x04\0\x17[static]conn\ -ection.open\x01\x09\x01h\x04\x01j\0\x01\x01\x01@\x04\x04self\x0a\x05topics\x07pa\ -yload\x06\x03qos\x03\0\x0b\x04\0\x1a[method]connection.publish\x01\x0c\x04\x01\x17\ -fermyon:spin/mqtt@2.0.0\x05!\x01B\x11\x01q\x05\x11connection-failed\x01s\0\x0dba\ -d-parameter\x01s\0\x0cquery-failed\x01s\0\x17value-conversion-failed\x01s\0\x05o\ -ther\x01s\0\x04\0\x05error\x03\0\0\x01m\x0e\x07boolean\x04int8\x05int16\x05int32\ -\x05int64\x05uint8\x06uint16\x06uint32\x06uint64\x0afloating32\x0afloating64\x03\ -str\x06binary\x05other\x04\0\x0cdb-data-type\x03\0\x02\x01p}\x01q\x0f\x07boolean\ -\x01\x7f\0\x04int8\x01~\0\x05int16\x01|\0\x05int32\x01z\0\x05int64\x01x\0\x05uin\ -t8\x01}\0\x06uint16\x01{\0\x06uint32\x01y\0\x06uint64\x01w\0\x0afloating32\x01v\0\ -\x0afloating64\x01u\0\x03str\x01s\0\x06binary\x01\x04\0\x07db-null\0\0\x0bunsupp\ -orted\0\0\x04\0\x08db-value\x03\0\x05\x01q\x0e\x07boolean\x01\x7f\0\x04int8\x01~\ -\0\x05int16\x01|\0\x05int32\x01z\0\x05int64\x01x\0\x05uint8\x01}\0\x06uint16\x01\ -{\0\x06uint32\x01y\0\x06uint64\x01w\0\x0afloating32\x01v\0\x0afloating64\x01u\0\x03\ -str\x01s\0\x06binary\x01\x04\0\x07db-null\0\0\x04\0\x0fparameter-value\x03\0\x07\ -\x01r\x02\x04names\x09data-type\x03\x04\0\x06column\x03\0\x09\x01p\x06\x04\0\x03\ -row\x03\0\x0b\x01p\x0a\x01p\x0c\x01r\x02\x07columns\x0d\x04rows\x0e\x04\0\x07row\ --set\x03\0\x0f\x04\x01\x1efermyon:spin/rdbms-types@2.0.0\x05\"\x02\x03\0\x11\x0f\ -parameter-value\x02\x03\0\x11\x07row-set\x02\x03\0\x11\x05error\x01B\x13\x02\x03\ -\x02\x01#\x04\0\x0fparameter-value\x03\0\0\x02\x03\x02\x01$\x04\0\x07row-set\x03\ -\0\x02\x02\x03\x02\x01%\x04\0\x05error\x03\0\x04\x04\0\x0aconnection\x03\x01\x01\ -i\x06\x01j\x01\x07\x01\x05\x01@\x01\x07addresss\0\x08\x04\0\x17[static]connectio\ -n.open\x01\x09\x01h\x06\x01p\x01\x01j\x01\x03\x01\x05\x01@\x03\x04self\x0a\x09st\ -atements\x06params\x0b\0\x0c\x04\0\x18[method]connection.query\x01\x0d\x01j\x01w\ -\x01\x05\x01@\x03\x04self\x0a\x09statements\x06params\x0b\0\x0e\x04\0\x1a[method\ -]connection.execute\x01\x0f\x04\x01\x1bfermyon:spin/postgres@2.0.0\x05&\x01B\x13\ -\x02\x03\x02\x01#\x04\0\x0fparameter-value\x03\0\0\x02\x03\x02\x01$\x04\0\x07row\ --set\x03\0\x02\x02\x03\x02\x01%\x04\0\x05error\x03\0\x04\x04\0\x0aconnection\x03\ -\x01\x01i\x06\x01j\x01\x07\x01\x05\x01@\x01\x07addresss\0\x08\x04\0\x17[static]c\ -onnection.open\x01\x09\x01h\x06\x01p\x01\x01j\x01\x03\x01\x05\x01@\x03\x04self\x0a\ -\x09statements\x06params\x0b\0\x0c\x04\0\x18[method]connection.query\x01\x0d\x01\ -j\0\x01\x05\x01@\x03\x04self\x0a\x09statements\x06params\x0b\0\x0e\x04\0\x1a[met\ -hod]connection.execute\x01\x0f\x04\x01\x18fermyon:spin/mysql@2.0.0\x05'\x01B\x15\ -\x04\0\x0aconnection\x03\x01\x01q\x05\x10no-such-database\0\0\x0daccess-denied\0\ -\0\x12invalid-connection\0\0\x0ddatabase-full\0\0\x02io\x01s\0\x04\0\x05error\x03\ -\0\x01\x01p}\x01q\x05\x07integer\x01x\0\x04real\x01u\0\x04text\x01s\0\x04blob\x01\ -\x03\0\x04null\0\0\x04\0\x05value\x03\0\x04\x01p\x05\x01r\x01\x06values\x06\x04\0\ -\x0arow-result\x03\0\x07\x01ps\x01p\x08\x01r\x02\x07columns\x09\x04rows\x0a\x04\0\ -\x0cquery-result\x03\0\x0b\x01i\0\x01j\x01\x0d\x01\x02\x01@\x01\x08databases\0\x0e\ -\x04\0\x17[static]connection.open\x01\x0f\x01h\0\x01j\x01\x0c\x01\x02\x01@\x03\x04\ -self\x10\x09statements\x0aparameters\x06\0\x11\x04\0\x1a[method]connection.execu\ -te\x01\x12\x04\x01\x19fermyon:spin/sqlite@2.0.0\x05(\x01B\x19\x04\0\x05store\x03\ -\x01\x01q\x04\x10store-table-full\0\0\x0dno-such-store\0\0\x0daccess-denied\0\0\x05\ -other\x01s\0\x04\0\x05error\x03\0\x01\x01i\0\x01j\x01\x03\x01\x02\x01@\x01\x05la\ -bels\0\x04\x04\0\x12[static]store.open\x01\x05\x01h\0\x01p}\x01k\x07\x01j\x01\x08\ -\x01\x02\x01@\x02\x04self\x06\x03keys\0\x09\x04\0\x11[method]store.get\x01\x0a\x01\ -j\0\x01\x02\x01@\x03\x04self\x06\x03keys\x05value\x07\0\x0b\x04\0\x11[method]sto\ -re.set\x01\x0c\x01@\x02\x04self\x06\x03keys\0\x0b\x04\0\x14[method]store.delete\x01\ -\x0d\x01j\x01\x7f\x01\x02\x01@\x02\x04self\x06\x03keys\0\x0e\x04\0\x14[method]st\ -ore.exists\x01\x0f\x01ps\x01j\x01\x10\x01\x02\x01@\x01\x04self\x06\0\x11\x04\0\x16\ -[method]store.get-keys\x01\x12\x04\x01\x1cfermyon:spin/key-value@2.0.0\x05)\x01B\ -\x05\x01q\x04\x0cinvalid-name\x01s\0\x09undefined\x01s\0\x08provider\x01s\0\x05o\ -ther\x01s\0\x04\0\x05error\x03\0\0\x01j\x01s\x01\x01\x01@\x01\x04names\0\x02\x04\ -\0\x03get\x01\x03\x04\x01\x1cfermyon:spin/variables@2.0.0\x05*\x04\x01\x1afermyo\ +e\x01\x8c\x01\x03\0\x15wasi:http/types@0.2.0\x05\x0d\x01B\x11\x04\0\x07network\x03\ +\x01\x01m\x15\x07unknown\x0daccess-denied\x0dnot-supported\x10invalid-argument\x0d\ +out-of-memory\x07timeout\x14concurrency-conflict\x0fnot-in-progress\x0bwould-blo\ +ck\x0dinvalid-state\x10new-socket-limit\x14address-not-bindable\x0eaddress-in-us\ +e\x12remote-unreachable\x12connection-refused\x10connection-reset\x12connection-\ +aborted\x12datagram-too-large\x11name-unresolvable\x1atemporary-resolver-failure\ +\x1apermanent-resolver-failure\x04\0\x0aerror-code\x03\0\x01\x01m\x02\x04ipv4\x04\ +ipv6\x04\0\x11ip-address-family\x03\0\x03\x01o\x04}}}}\x04\0\x0cipv4-address\x03\ +\0\x05\x01o\x08{{{{{{{{\x04\0\x0cipv6-address\x03\0\x07\x01q\x02\x04ipv4\x01\x06\ +\0\x04ipv6\x01\x08\0\x04\0\x0aip-address\x03\0\x09\x01r\x02\x04port{\x07address\x06\ +\x04\0\x13ipv4-socket-address\x03\0\x0b\x01r\x04\x04port{\x09flow-infoy\x07addre\ +ss\x08\x08scope-idy\x04\0\x13ipv6-socket-address\x03\0\x0d\x01q\x02\x04ipv4\x01\x0c\ +\0\x04ipv6\x01\x0e\0\x04\0\x11ip-socket-address\x03\0\x0f\x03\0\x1awasi:sockets/\ +network@0.2.0\x05\x0e\x01B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0fget-envir\ +onment\x01\x02\x01ps\x01@\0\0\x03\x04\0\x0dget-arguments\x01\x04\x01ks\x01@\0\0\x05\ +\x04\0\x0binitial-cwd\x01\x06\x04\0\x1awasi:cli/environment@0.2.0\x05\x0f\x02\x03\ +\0\x04\x0adescriptor\x01B\x07\x02\x03\x02\x01\x10\x04\0\x0adescriptor\x03\0\0\x01\ +i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\x04\x04\0\x0fget-directories\x01\x05\x04\0\ +\x1ewasi:filesystem/preopens@0.2.0\x05\x11\x02\x03\0\x06\x10outgoing-request\x02\ +\x03\0\x06\x0frequest-options\x02\x03\0\x06\x18future-incoming-response\x02\x03\0\ +\x06\x0aerror-code\x01B\x0f\x02\x03\x02\x01\x12\x04\0\x10outgoing-request\x03\0\0\ +\x02\x03\x02\x01\x13\x04\0\x0frequest-options\x03\0\x02\x02\x03\x02\x01\x14\x04\0\ +\x18future-incoming-response\x03\0\x04\x02\x03\x02\x01\x15\x04\0\x0aerror-code\x03\ +\0\x06\x01i\x01\x01i\x03\x01k\x09\x01i\x05\x01j\x01\x0b\x01\x07\x01@\x02\x07requ\ +est\x08\x07options\x0a\0\x0c\x04\0\x06handle\x01\x0d\x04\0\x20wasi:http/outgoing\ +-handler@0.2.0\x05\x16\x02\x03\0\x07\x07network\x02\x03\0\x07\x0aerror-code\x02\x03\ +\0\x07\x0aip-address\x01B\x16\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\0\x02\x03\ +\x02\x01\x17\x04\0\x07network\x03\0\x02\x02\x03\x02\x01\x18\x04\0\x0aerror-code\x03\ +\0\x04\x02\x03\x02\x01\x19\x04\0\x0aip-address\x03\0\x06\x04\0\x16resolve-addres\ +s-stream\x03\x01\x01h\x08\x01k\x07\x01j\x01\x0a\x01\x05\x01@\x01\x04self\x09\0\x0b\ +\x04\03[method]resolve-address-stream.resolve-next-address\x01\x0c\x01i\x01\x01@\ +\x01\x04self\x09\0\x0d\x04\0([method]resolve-address-stream.subscribe\x01\x0e\x01\ +h\x03\x01i\x08\x01j\x01\x10\x01\x05\x01@\x02\x07network\x0f\x04names\0\x11\x04\0\ +\x11resolve-addresses\x01\x12\x04\0!wasi:sockets/ip-name-lookup@0.2.0\x05\x1a\x02\ +\x03\0\x07\x11ip-socket-address\x02\x03\0\x07\x11ip-address-family\x01BT\x02\x03\ +\x02\x01\x06\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\x07\x04\0\x0doutput-s\ +tream\x03\0\x02\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\x04\x02\x03\x02\x01\x0c\ +\x04\0\x08duration\x03\0\x06\x02\x03\x02\x01\x17\x04\0\x07network\x03\0\x08\x02\x03\ +\x02\x01\x18\x04\0\x0aerror-code\x03\0\x0a\x02\x03\x02\x01\x1b\x04\0\x11ip-socke\ +t-address\x03\0\x0c\x02\x03\x02\x01\x1c\x04\0\x11ip-address-family\x03\0\x0e\x01\ +m\x03\x07receive\x04send\x04both\x04\0\x0dshutdown-type\x03\0\x10\x04\0\x0atcp-s\ +ocket\x03\x01\x01h\x12\x01h\x09\x01j\0\x01\x0b\x01@\x03\x04self\x13\x07network\x14\ +\x0dlocal-address\x0d\0\x15\x04\0\x1d[method]tcp-socket.start-bind\x01\x16\x01@\x01\ +\x04self\x13\0\x15\x04\0\x1e[method]tcp-socket.finish-bind\x01\x17\x01@\x03\x04s\ +elf\x13\x07network\x14\x0eremote-address\x0d\0\x15\x04\0\x20[method]tcp-socket.s\ +tart-connect\x01\x18\x01i\x01\x01i\x03\x01o\x02\x19\x1a\x01j\x01\x1b\x01\x0b\x01\ +@\x01\x04self\x13\0\x1c\x04\0![method]tcp-socket.finish-connect\x01\x1d\x04\0\x1f\ +[method]tcp-socket.start-listen\x01\x17\x04\0\x20[method]tcp-socket.finish-liste\ +n\x01\x17\x01i\x12\x01o\x03\x1e\x19\x1a\x01j\x01\x1f\x01\x0b\x01@\x01\x04self\x13\ +\0\x20\x04\0\x19[method]tcp-socket.accept\x01!\x01j\x01\x0d\x01\x0b\x01@\x01\x04\ +self\x13\0\"\x04\0\x20[method]tcp-socket.local-address\x01#\x04\0![method]tcp-so\ +cket.remote-address\x01#\x01@\x01\x04self\x13\0\x7f\x04\0\x1f[method]tcp-socket.\ +is-listening\x01$\x01@\x01\x04self\x13\0\x0f\x04\0![method]tcp-socket.address-fa\ +mily\x01%\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0*[method]tcp-socket.set-list\ +en-backlog-size\x01&\x01j\x01\x7f\x01\x0b\x01@\x01\x04self\x13\0'\x04\0%[method]\ +tcp-socket.keep-alive-enabled\x01(\x01@\x02\x04self\x13\x05value\x7f\0\x15\x04\0\ +)[method]tcp-socket.set-keep-alive-enabled\x01)\x01j\x01\x07\x01\x0b\x01@\x01\x04\ +self\x13\0*\x04\0'[method]tcp-socket.keep-alive-idle-time\x01+\x01@\x02\x04self\x13\ +\x05value\x07\0\x15\x04\0+[method]tcp-socket.set-keep-alive-idle-time\x01,\x04\0\ +&[method]tcp-socket.keep-alive-interval\x01+\x04\0*[method]tcp-socket.set-keep-a\ +live-interval\x01,\x01j\x01y\x01\x0b\x01@\x01\x04self\x13\0-\x04\0#[method]tcp-s\ +ocket.keep-alive-count\x01.\x01@\x02\x04self\x13\x05valuey\0\x15\x04\0'[method]t\ +cp-socket.set-keep-alive-count\x01/\x01j\x01}\x01\x0b\x01@\x01\x04self\x13\00\x04\ +\0\x1c[method]tcp-socket.hop-limit\x011\x01@\x02\x04self\x13\x05value}\0\x15\x04\ +\0\x20[method]tcp-socket.set-hop-limit\x012\x01j\x01w\x01\x0b\x01@\x01\x04self\x13\ +\03\x04\0&[method]tcp-socket.receive-buffer-size\x014\x04\0*[method]tcp-socket.s\ +et-receive-buffer-size\x01&\x04\0#[method]tcp-socket.send-buffer-size\x014\x04\0\ +'[method]tcp-socket.set-send-buffer-size\x01&\x01i\x05\x01@\x01\x04self\x13\05\x04\ +\0\x1c[method]tcp-socket.subscribe\x016\x01@\x02\x04self\x13\x0dshutdown-type\x11\ +\0\x15\x04\0\x1b[method]tcp-socket.shutdown\x017\x04\0\x16wasi:sockets/tcp@0.2.0\ +\x05\x1d\x02\x03\0\x0c\x0atcp-socket\x01B\x0c\x02\x03\x02\x01\x17\x04\0\x07netwo\ +rk\x03\0\0\x02\x03\x02\x01\x18\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01\x1c\ +\x04\0\x11ip-address-family\x03\0\x04\x02\x03\x02\x01\x1e\x04\0\x0atcp-socket\x03\ +\0\x06\x01i\x07\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11\ +create-tcp-socket\x01\x0a\x04\0$wasi:sockets/tcp-create-socket@0.2.0\x05\x1f\x01\ +BD\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\0\x02\x03\x02\x01\x17\x04\0\x07ne\ +twork\x03\0\x02\x02\x03\x02\x01\x18\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01\ +\x1b\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\x02\x01\x1c\x04\0\x11ip-addres\ +s-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0eremote-address\x07\x04\0\x11inc\ +oming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\x0eremote-address\x0d\x04\ +\0\x11outgoing-datagram\x03\0\x0e\x04\0\x0audp-socket\x03\x01\x04\0\x18incoming-\ +datagram-stream\x03\x01\x04\0\x18outgoing-datagram-stream\x03\x01\x01h\x10\x01h\x03\ +\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0dlocal-address\x07\0\x15\x04\ +\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e\ +[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\x01o\x02\x18\x19\x01j\x01\ +\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\0\x1b\x04\0\x19[method]u\ +dp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04self\x13\0\x1d\x04\0\x20\ +[method]udp-socket.local-address\x01\x1e\x04\0![method]udp-socket.remote-address\ +\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-socket.address-family\x01\x1f\ +\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[method]udp-socket.unicast-h\ +op-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\0([method]udp-socket.set-\ +unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04self\x13\0#\x04\0&[method]\ +udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0*[\ +method]udp-socket.set-receive-buffer-size\x01%\x04\0#[method]udp-socket.send-buf\ +fer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-size\x01%\x01i\x01\x01@\x01\ +\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01'\x01h\x11\x01p\x0c\x01\ +j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0([method]incoming-datag\ +ram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[method]incoming-datagram-str\ +eam.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[method]outgoing-datagram\ +-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09datagrams/\0#\x04\0%[metho\ +d]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\x04\0*[method]outgoing\ +-datagram-stream.subscribe\x011\x04\0\x16wasi:sockets/udp@0.2.0\x05\x20\x02\x03\0\ +\x0e\x0audp-socket\x01B\x0c\x02\x03\x02\x01\x17\x04\0\x07network\x03\0\0\x02\x03\ +\x02\x01\x18\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01\x1c\x04\0\x11ip-addre\ +ss-family\x03\0\x04\x02\x03\x02\x01!\x04\0\x0audp-socket\x03\0\x06\x01i\x07\x01j\ +\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-udp-socket\ +\x01\x0a\x04\0$wasi:sockets/udp-create-socket@0.2.0\x05\"\x01B\x1a\x01s\x04\0\x11\ +inferencing-model\x03\0\0\x01r\x06\x0amax-tokensy\x0erepeat-penaltyv!repeat-pena\ +lty-last-n-token-county\x0btemperaturev\x05top-ky\x05top-pv\x04\0\x12inferencing\ +-params\x03\0\x02\x01q\x03\x13model-not-supported\0\0\x0druntime-error\x01s\0\x0d\ +invalid-input\x01s\0\x04\0\x05error\x03\0\x04\x01r\x02\x12prompt-token-county\x15\ +generated-token-county\x04\0\x11inferencing-usage\x03\0\x06\x01r\x02\x04texts\x05\ +usage\x07\x04\0\x12inferencing-result\x03\0\x08\x01s\x04\0\x0fembedding-model\x03\ +\0\x0a\x01r\x01\x12prompt-token-county\x04\0\x10embeddings-usage\x03\0\x0c\x01pv\ +\x01p\x0e\x01r\x02\x0aembeddings\x0f\x05usage\x0d\x04\0\x11embeddings-result\x03\ +\0\x10\x01k\x03\x01j\x01\x09\x01\x05\x01@\x03\x05model\x01\x06prompts\x06params\x12\ +\0\x13\x04\0\x05infer\x01\x14\x01ps\x01j\x01\x11\x01\x05\x01@\x02\x05model\x0b\x04\ +text\x15\0\x16\x04\0\x13generate-embeddings\x01\x17\x04\0\x16fermyon:spin/llm@2.\ +0.0\x05#\x01B)\x01q\x04\x0finvalid-address\0\0\x14too-many-connections\0\0\x0aty\ +pe-error\0\0\x05other\x01s\0\x04\0\x05error\x03\0\0\x04\0\x0aconnection\x03\x01\x01\ +p}\x04\0\x07payload\x03\0\x03\x01q\x02\x05int64\x01x\0\x06binary\x01\x04\0\x04\0\ +\x0fredis-parameter\x03\0\x05\x01q\x04\x03nil\0\0\x06status\x01s\0\x05int64\x01x\ +\0\x06binary\x01\x04\0\x04\0\x0credis-result\x03\0\x07\x01i\x02\x01j\x01\x09\x01\ +\x01\x01@\x01\x07addresss\0\x0a\x04\0\x17[static]connection.open\x01\x0b\x01h\x02\ +\x01j\0\x01\x01\x01@\x03\x04self\x0c\x07channels\x07payload\x04\0\x0d\x04\0\x1a[\ +method]connection.publish\x01\x0e\x01k\x04\x01j\x01\x0f\x01\x01\x01@\x02\x04self\ +\x0c\x03keys\0\x10\x04\0\x16[method]connection.get\x01\x11\x01@\x03\x04self\x0c\x03\ +keys\x05value\x04\0\x0d\x04\0\x16[method]connection.set\x01\x12\x01j\x01x\x01\x01\ +\x01@\x02\x04self\x0c\x03keys\0\x13\x04\0\x17[method]connection.incr\x01\x14\x01\ +ps\x01j\x01y\x01\x01\x01@\x02\x04self\x0c\x04keys\x15\0\x16\x04\0\x16[method]con\ +nection.del\x01\x17\x01@\x03\x04self\x0c\x03keys\x06values\x15\0\x16\x04\0\x17[m\ +ethod]connection.sadd\x01\x18\x01j\x01\x15\x01\x01\x01@\x02\x04self\x0c\x03keys\0\ +\x19\x04\0\x1b[method]connection.smembers\x01\x1a\x04\0\x17[method]connection.sr\ +em\x01\x18\x01p\x06\x01p\x08\x01j\x01\x1c\x01\x01\x01@\x03\x04self\x0c\x07comman\ +ds\x09arguments\x1b\0\x1d\x04\0\x1a[method]connection.execute\x01\x1e\x04\0\x18f\ +ermyon:spin/redis@2.0.0\x05$\x01B\x0f\x01q\x04\x0finvalid-address\0\0\x14too-man\ +y-connections\0\0\x11connection-failed\x01s\0\x05other\x01s\0\x04\0\x05error\x03\ +\0\0\x01m\x03\x0cat-most-once\x0dat-least-once\x0cexactly-once\x04\0\x03qos\x03\0\ +\x02\x04\0\x0aconnection\x03\x01\x01p}\x04\0\x07payload\x03\0\x05\x01i\x04\x01j\x01\ +\x07\x01\x01\x01@\x04\x07addresss\x08usernames\x08passwords\x1bkeep-alive-interv\ +al-in-secsw\0\x08\x04\0\x17[static]connection.open\x01\x09\x01h\x04\x01j\0\x01\x01\ +\x01@\x04\x04self\x0a\x05topics\x07payload\x06\x03qos\x03\0\x0b\x04\0\x1a[method\ +]connection.publish\x01\x0c\x04\0\x17fermyon:spin/mqtt@2.0.0\x05%\x01B\x11\x01q\x05\ +\x11connection-failed\x01s\0\x0dbad-parameter\x01s\0\x0cquery-failed\x01s\0\x17v\ +alue-conversion-failed\x01s\0\x05other\x01s\0\x04\0\x05error\x03\0\0\x01m\x0e\x07\ +boolean\x04int8\x05int16\x05int32\x05int64\x05uint8\x06uint16\x06uint32\x06uint6\ +4\x0afloating32\x0afloating64\x03str\x06binary\x05other\x04\0\x0cdb-data-type\x03\ +\0\x02\x01p}\x01q\x0f\x07boolean\x01\x7f\0\x04int8\x01~\0\x05int16\x01|\0\x05int\ +32\x01z\0\x05int64\x01x\0\x05uint8\x01}\0\x06uint16\x01{\0\x06uint32\x01y\0\x06u\ +int64\x01w\0\x0afloating32\x01v\0\x0afloating64\x01u\0\x03str\x01s\0\x06binary\x01\ +\x04\0\x07db-null\0\0\x0bunsupported\0\0\x04\0\x08db-value\x03\0\x05\x01q\x0e\x07\ +boolean\x01\x7f\0\x04int8\x01~\0\x05int16\x01|\0\x05int32\x01z\0\x05int64\x01x\0\ +\x05uint8\x01}\0\x06uint16\x01{\0\x06uint32\x01y\0\x06uint64\x01w\0\x0afloating3\ +2\x01v\0\x0afloating64\x01u\0\x03str\x01s\0\x06binary\x01\x04\0\x07db-null\0\0\x04\ +\0\x0fparameter-value\x03\0\x07\x01r\x02\x04names\x09data-type\x03\x04\0\x06colu\ +mn\x03\0\x09\x01p\x06\x04\0\x03row\x03\0\x0b\x01p\x0a\x01p\x0c\x01r\x02\x07colum\ +ns\x0d\x04rows\x0e\x04\0\x07row-set\x03\0\x0f\x04\0\x1efermyon:spin/rdbms-types@\ +2.0.0\x05&\x02\x03\0\x13\x0fparameter-value\x02\x03\0\x13\x07row-set\x02\x03\0\x13\ +\x05error\x01B\x13\x02\x03\x02\x01'\x04\0\x0fparameter-value\x03\0\0\x02\x03\x02\ +\x01(\x04\0\x07row-set\x03\0\x02\x02\x03\x02\x01)\x04\0\x05error\x03\0\x04\x04\0\ +\x0aconnection\x03\x01\x01i\x06\x01j\x01\x07\x01\x05\x01@\x01\x07addresss\0\x08\x04\ +\0\x17[static]connection.open\x01\x09\x01h\x06\x01p\x01\x01j\x01\x03\x01\x05\x01\ +@\x03\x04self\x0a\x09statements\x06params\x0b\0\x0c\x04\0\x18[method]connection.\ +query\x01\x0d\x01j\x01w\x01\x05\x01@\x03\x04self\x0a\x09statements\x06params\x0b\ +\0\x0e\x04\0\x1a[method]connection.execute\x01\x0f\x04\0\x1bfermyon:spin/postgre\ +s@2.0.0\x05*\x01B\x13\x02\x03\x02\x01'\x04\0\x0fparameter-value\x03\0\0\x02\x03\x02\ +\x01(\x04\0\x07row-set\x03\0\x02\x02\x03\x02\x01)\x04\0\x05error\x03\0\x04\x04\0\ +\x0aconnection\x03\x01\x01i\x06\x01j\x01\x07\x01\x05\x01@\x01\x07addresss\0\x08\x04\ +\0\x17[static]connection.open\x01\x09\x01h\x06\x01p\x01\x01j\x01\x03\x01\x05\x01\ +@\x03\x04self\x0a\x09statements\x06params\x0b\0\x0c\x04\0\x18[method]connection.\ +query\x01\x0d\x01j\0\x01\x05\x01@\x03\x04self\x0a\x09statements\x06params\x0b\0\x0e\ +\x04\0\x1a[method]connection.execute\x01\x0f\x04\0\x18fermyon:spin/mysql@2.0.0\x05\ ++\x01B\x15\x04\0\x0aconnection\x03\x01\x01q\x05\x10no-such-database\0\0\x0dacces\ +s-denied\0\0\x12invalid-connection\0\0\x0ddatabase-full\0\0\x02io\x01s\0\x04\0\x05\ +error\x03\0\x01\x01p}\x01q\x05\x07integer\x01x\0\x04real\x01u\0\x04text\x01s\0\x04\ +blob\x01\x03\0\x04null\0\0\x04\0\x05value\x03\0\x04\x01p\x05\x01r\x01\x06values\x06\ +\x04\0\x0arow-result\x03\0\x07\x01ps\x01p\x08\x01r\x02\x07columns\x09\x04rows\x0a\ +\x04\0\x0cquery-result\x03\0\x0b\x01i\0\x01j\x01\x0d\x01\x02\x01@\x01\x08databas\ +es\0\x0e\x04\0\x17[static]connection.open\x01\x0f\x01h\0\x01j\x01\x0c\x01\x02\x01\ +@\x03\x04self\x10\x09statements\x0aparameters\x06\0\x11\x04\0\x1a[method]connect\ +ion.execute\x01\x12\x04\0\x19fermyon:spin/sqlite@2.0.0\x05,\x01B\x19\x04\0\x05st\ +ore\x03\x01\x01q\x04\x10store-table-full\0\0\x0dno-such-store\0\0\x0daccess-deni\ +ed\0\0\x05other\x01s\0\x04\0\x05error\x03\0\x01\x01i\0\x01j\x01\x03\x01\x02\x01@\ +\x01\x05labels\0\x04\x04\0\x12[static]store.open\x01\x05\x01h\0\x01p}\x01k\x07\x01\ +j\x01\x08\x01\x02\x01@\x02\x04self\x06\x03keys\0\x09\x04\0\x11[method]store.get\x01\ +\x0a\x01j\0\x01\x02\x01@\x03\x04self\x06\x03keys\x05value\x07\0\x0b\x04\0\x11[me\ +thod]store.set\x01\x0c\x01@\x02\x04self\x06\x03keys\0\x0b\x04\0\x14[method]store\ +.delete\x01\x0d\x01j\x01\x7f\x01\x02\x01@\x02\x04self\x06\x03keys\0\x0e\x04\0\x14\ +[method]store.exists\x01\x0f\x01ps\x01j\x01\x10\x01\x02\x01@\x01\x04self\x06\0\x11\ +\x04\0\x16[method]store.get-keys\x01\x12\x04\0\x1cfermyon:spin/key-value@2.0.0\x05\ +-\x01B\x05\x01q\x04\x0cinvalid-name\x01s\0\x09undefined\x01s\0\x08provider\x01s\0\ +\x05other\x01s\0\x04\0\x05error\x03\0\0\x01j\x01s\x01\x01\x01@\x01\x04names\0\x02\ +\x04\0\x03get\x01\x03\x04\0\x1cfermyon:spin/variables@2.0.0\x05.\x04\0\x1afermyo\ n:spin-virt/deny-all\x04\0\x0b\x0e\x01\0\x08deny-all\x03\0\0\0G\x09producers\x01\ -\x0cprocessed-by\x02\x0dwit-component\x070.208.1\x10wit-bindgen-rust\x060.25.0"; - +\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rust\x060.35.0"; #[inline(never)] #[doc(hidden)] -#[cfg(target_arch = "wasm32")] pub fn __link_custom_section_describing_imports() { wit_bindgen_rt::maybe_link_cabi_realloc(); } diff --git a/crates/compose/deny-all/src/wasi.rs b/crates/compose/deny-all/src/wasi.rs index 7bbc9480e1..f913492a82 100644 --- a/crates/compose/deny-all/src/wasi.rs +++ b/crates/compose/deny-all/src/wasi.rs @@ -1,8 +1,11 @@ -use crate::bindings::exports::wasi::{ - cli0_2_0 as cli, - filesystem0_2_0 as filesystem, - http0_2_0 as http, - sockets0_2_0 as sockets, +use crate::bindings::{ + exports::wasi::{ + cli0_2_0 as cli, + filesystem0_2_0 as filesystem, + http0_2_0 as http, + sockets0_2_0 as sockets, + }, + wasi::sockets0_2_0::network, }; use crate::format_deny_error; @@ -228,6 +231,22 @@ impl sockets::tcp::Guest for crate::Component { type TcpSocket = TcpSocket; } +impl sockets::tcp_create_socket::Guest for crate::Component { + fn create_tcp_socket( + address_family: network::IpAddressFamily, + ) -> Result { + Err(network::ErrorCode::AccessDenied) + } +} + +impl sockets::udp_create_socket::Guest for crate::Component { + fn create_udp_socket( + address_family: network::IpAddressFamily, + ) -> Result { + Err(network::ErrorCode::AccessDenied) + } +} + pub struct UdpSocket; impl sockets::udp::GuestUdpSocket for UdpSocket { diff --git a/crates/compose/deny-all/wit/world.wit b/crates/compose/deny-all/wit/world.wit index d212359fdc..480bcc10f0 100644 --- a/crates/compose/deny-all/wit/world.wit +++ b/crates/compose/deny-all/wit/world.wit @@ -5,7 +5,9 @@ world deny-all { export wasi:filesystem/preopens@0.2.0; export wasi:http/outgoing-handler@0.2.0; export wasi:sockets/ip-name-lookup@0.2.0; + export wasi:sockets/tcp-create-socket@0.2.0; export wasi:sockets/tcp@0.2.0; + export wasi:sockets/udp-create-socket@0.2.0; export wasi:sockets/udp@0.2.0; export fermyon:spin/llm@2.0.0; diff --git a/crates/compose/deny_all.wasm b/crates/compose/deny_all.wasm index e5a7eadfcd82bd04adfe5582a4b83af11a53eba3..55c05c4457269b9008c612516376ffc1d9b4c4cf 100644 GIT binary patch delta 45493 zcmeFa34B!5`9FN0duK}~%VgifonZ@0U?$5<0;svcu!yMCwRM54lCXs&D7MN3MFmBS zUh(1%YF$A=s8F?vmR7W=(7Iqn3sqZfU9j5L{)+YeKIh&$nS_AQU*Grt{y(1vX6{*^ z^PFcp&pq3$UE{g^8+T7WNjDXYB5Bj)MMRSEd?97)zo8IGo1JpA!`PiqMf$Zal-hi+ zYqXOjePLSm<`2DVWd!%973k|yP}%5NNQL^xDT9%ioO+Rw!cdl`PDf6VgCC0Eo&p4? z`p!b3yM2Mde_HO4>O1F=BuR8DWz3SJQHst|qT)eO2?_f9zNPxSv~eVJv--1XeuVa? zmCLef)Yns%e)nLnUYTBi)EViwL}le~^c6WJms@ct9!Yk~vQu%Ie+Y^{mz*H}ks>E1 zlI%_NCR%?*zMxMwu)04P@Gf|f1#AMkaODU8>GCnCOvYhIZWhu%bDMjXQ z@kKJ1Kn+P&6qk$eBuSPOm*h&5Q&JRiq3@C_-7QH@7Z8<^Eh&;yNpRvJ%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