// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
// Options used:
//   * std_feature
//   * type_section_suffix: "rust-wasip3-0.6.0+wasi-0.3.0-rc-2026-03-15-from-crates-io"
#[rustfmt::skip]
#[allow(dead_code, clippy::all)]
pub mod wasi {
    pub mod cli {
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod environment {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            #[allow(unused_unsafe, clippy::all)]
            /// Get the POSIX-style environment variables.
            ///
            /// Each environment variable is provided as a pair of string variable names
            /// and string value.
            ///
            /// Morally, these are a value import, but until value imports are available
            /// in the component model, this import function should return the same
            /// values each time it is called.
            #[allow(async_fn_in_trait)]
            pub fn get_environment() -> _rt::Vec<(_rt::String, _rt::String)> {
                unsafe {
                    #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                    #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                    struct RetArea(
                        [::core::mem::MaybeUninit<
                            u8,
                        >; 2 * ::core::mem::size_of::<*const u8>()],
                    );
                    let mut ret_area = RetArea(
                        [::core::mem::MaybeUninit::uninit(); 2
                            * ::core::mem::size_of::<*const u8>()],
                    );
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:cli/environment@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-environment"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = *ptr0.add(0).cast::<*mut u8>();
                    let l3 = *ptr0
                        .add(::core::mem::size_of::<*const u8>())
                        .cast::<usize>();
                    let base10 = l2;
                    let len10 = l3;
                    let mut result10 = _rt::Vec::with_capacity(len10);
                    for i in 0..len10 {
                        let base = base10
                            .add(i * (4 * ::core::mem::size_of::<*const u8>()));
                        let e10 = {
                            let l4 = *base.add(0).cast::<*mut u8>();
                            let l5 = *base
                                .add(::core::mem::size_of::<*const u8>())
                                .cast::<usize>();
                            let len6 = l5;
                            let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6);
                            let l7 = *base
                                .add(2 * ::core::mem::size_of::<*const u8>())
                                .cast::<*mut u8>();
                            let l8 = *base
                                .add(3 * ::core::mem::size_of::<*const u8>())
                                .cast::<usize>();
                            let len9 = l8;
                            let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9);
                            (_rt::string_lift(bytes6), _rt::string_lift(bytes9))
                        };
                        result10.push(e10);
                    }
                    _rt::cabi_dealloc(
                        base10,
                        len10 * (4 * ::core::mem::size_of::<*const u8>()),
                        ::core::mem::size_of::<*const u8>(),
                    );
                    let result11 = result10;
                    result11
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Get the POSIX-style arguments to the program.
            #[allow(async_fn_in_trait)]
            pub fn get_arguments() -> _rt::Vec<_rt::String> {
                unsafe {
                    #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                    #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                    struct RetArea(
                        [::core::mem::MaybeUninit<
                            u8,
                        >; 2 * ::core::mem::size_of::<*const u8>()],
                    );
                    let mut ret_area = RetArea(
                        [::core::mem::MaybeUninit::uninit(); 2
                            * ::core::mem::size_of::<*const u8>()],
                    );
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:cli/environment@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-arguments"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = *ptr0.add(0).cast::<*mut u8>();
                    let l3 = *ptr0
                        .add(::core::mem::size_of::<*const u8>())
                        .cast::<usize>();
                    let base7 = l2;
                    let len7 = l3;
                    let mut result7 = _rt::Vec::with_capacity(len7);
                    for i in 0..len7 {
                        let base = base7
                            .add(i * (2 * ::core::mem::size_of::<*const u8>()));
                        let e7 = {
                            let l4 = *base.add(0).cast::<*mut u8>();
                            let l5 = *base
                                .add(::core::mem::size_of::<*const u8>())
                                .cast::<usize>();
                            let len6 = l5;
                            let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6);
                            _rt::string_lift(bytes6)
                        };
                        result7.push(e7);
                    }
                    _rt::cabi_dealloc(
                        base7,
                        len7 * (2 * ::core::mem::size_of::<*const u8>()),
                        ::core::mem::size_of::<*const u8>(),
                    );
                    let result8 = result7;
                    result8
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Return a path that programs should use as their initial current working
            /// directory, interpreting `.` as shorthand for this.
            #[allow(async_fn_in_trait)]
            pub fn get_initial_cwd() -> Option<_rt::String> {
                unsafe {
                    #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                    #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                    struct RetArea(
                        [::core::mem::MaybeUninit<
                            u8,
                        >; 3 * ::core::mem::size_of::<*const u8>()],
                    );
                    let mut ret_area = RetArea(
                        [::core::mem::MaybeUninit::uninit(); 3
                            * ::core::mem::size_of::<*const u8>()],
                    );
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:cli/environment@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-initial-cwd"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                    let result6 = match l2 {
                        0 => None,
                        1 => {
                            let e = {
                                let l3 = *ptr0
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<*mut u8>();
                                let l4 = *ptr0
                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                    .cast::<usize>();
                                let len5 = l4;
                                let bytes5 = _rt::Vec::from_raw_parts(
                                    l3.cast(),
                                    len5,
                                    len5,
                                );
                                _rt::string_lift(bytes5)
                            };
                            Some(e)
                        }
                        _ => _rt::invalid_enum_discriminant(),
                    };
                    result6
                }
            }
        }
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod exit {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            #[allow(unused_unsafe, clippy::all)]
            /// Exit the current instance and any linked instances.
            #[allow(async_fn_in_trait)]
            pub fn exit(status: Result<(), ()>) -> () {
                unsafe {
                    let result0 = match status {
                        Ok(_) => 0i32,
                        Err(_) => 1i32,
                    };
                    #[cfg(target_arch = "wasm32")]
                    #[link(wasm_import_module = "wasi:cli/exit@0.3.0-rc-2026-03-15")]
                    unsafe extern "C" {
                        #[link_name = "exit"]
                        fn wit_import1(_: i32);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: i32) {
                        unreachable!()
                    }
                    wit_import1(result0);
                }
            }
        }
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod types {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            #[repr(u8)]
            #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
            pub enum ErrorCode {
                /// Input/output error
                Io,
                /// Invalid or incomplete multibyte or wide character
                IllegalByteSequence,
                /// Broken pipe
                Pipe,
            }
            impl ::core::fmt::Debug for ErrorCode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        ErrorCode::Io => f.debug_tuple("ErrorCode::Io").finish(),
                        ErrorCode::IllegalByteSequence => {
                            f.debug_tuple("ErrorCode::IllegalByteSequence").finish()
                        }
                        ErrorCode::Pipe => f.debug_tuple("ErrorCode::Pipe").finish(),
                    }
                }
            }
            impl ErrorCode {
                #[doc(hidden)]
                pub unsafe fn _lift(val: u8) -> ErrorCode {
                    if !cfg!(debug_assertions) {
                        return unsafe { ::core::mem::transmute(val) };
                    }
                    match val {
                        0 => ErrorCode::Io,
                        1 => ErrorCode::IllegalByteSequence,
                        2 => ErrorCode::Pipe,
                        _ => panic!("invalid enum discriminant"),
                    }
                }
            }
        }
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod stdin {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            pub type ErrorCode = super::super::super::wasi::cli::types::ErrorCode;
            #[allow(unused_unsafe, clippy::all)]
            /// Return a stream for reading from stdin.
            ///
            /// This function returns a stream which provides data read from stdin,
            /// and a future to signal read results.
            ///
            /// If the stream's readable end is dropped the future will resolve to success.
            ///
            /// If the stream's writable end is dropped the future will either resolve to
            /// success if stdin was closed by the writer or to an error-code if reading
            /// failed for some other reason.
            ///
            /// Multiple streams may be active at the same time. The behavior of concurrent
            /// reads is implementation-specific.
            #[allow(async_fn_in_trait)]
            pub fn read_via_stream() -> (
                wit_bindgen::rt::async_support::StreamReader<u8>,
                wit_bindgen::rt::async_support::FutureReader<Result<(), ErrorCode>>,
            ) {
                unsafe {
                    #[repr(align(4))]
                    struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
                    let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(wasm_import_module = "wasi:cli/stdin@0.3.0-rc-2026-03-15")]
                    unsafe extern "C" {
                        #[link_name = "read-via-stream"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = *ptr0.add(0).cast::<i32>();
                    let l3 = *ptr0.add(4).cast::<i32>();
                    let result4 = (
                        wit_bindgen::rt::async_support::StreamReader::new(
                            l2 as u32,
                            &<u8 as super::super::super::wit_stream::StreamPayload>::VTABLE,
                        ),
                        wit_bindgen::rt::async_support::FutureReader::new(
                            l3 as u32,
                            &<Result<
                                (),
                                ErrorCode,
                            > as super::super::super::wit_future::FuturePayload>::VTABLE,
                        ),
                    );
                    result4
                }
            }
        }
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod stdout {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            pub type ErrorCode = super::super::super::wasi::cli::types::ErrorCode;
            #[allow(unused_unsafe, clippy::all)]
            /// Write the given stream to stdout.
            ///
            /// If the stream's writable end is dropped this function will either return
            /// success once the entire contents of the stream have been written or an
            /// error-code representing a failure.
            ///
            /// Otherwise if there is an error the readable end of the stream will be
            /// dropped and this function will return an error-code.
            #[allow(async_fn_in_trait)]
            pub fn write_via_stream(
                data: wit_bindgen::rt::async_support::StreamReader<u8>,
            ) -> wit_bindgen::rt::async_support::FutureReader<Result<(), ErrorCode>> {
                unsafe {
                    #[cfg(target_arch = "wasm32")]
                    #[link(wasm_import_module = "wasi:cli/stdout@0.3.0-rc-2026-03-15")]
                    unsafe extern "C" {
                        #[link_name = "write-via-stream"]
                        fn wit_import0(_: i32) -> i32;
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import0(_: i32) -> i32 {
                        unreachable!()
                    }
                    let ret = wit_import0((&data).take_handle() as i32);
                    wit_bindgen::rt::async_support::FutureReader::new(
                        ret as u32,
                        &<Result<
                            (),
                            ErrorCode,
                        > as super::super::super::wit_future::FuturePayload>::VTABLE,
                    )
                }
            }
        }
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod stderr {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            pub type ErrorCode = super::super::super::wasi::cli::types::ErrorCode;
            #[allow(unused_unsafe, clippy::all)]
            /// Write the given stream to stderr.
            ///
            /// If the stream's writable end is dropped this function will either return
            /// success once the entire contents of the stream have been written or an
            /// error-code representing a failure.
            ///
            /// Otherwise if there is an error the readable end of the stream will be
            /// dropped and this function will return an error-code.
            #[allow(async_fn_in_trait)]
            pub fn write_via_stream(
                data: wit_bindgen::rt::async_support::StreamReader<u8>,
            ) -> wit_bindgen::rt::async_support::FutureReader<Result<(), ErrorCode>> {
                unsafe {
                    #[cfg(target_arch = "wasm32")]
                    #[link(wasm_import_module = "wasi:cli/stderr@0.3.0-rc-2026-03-15")]
                    unsafe extern "C" {
                        #[link_name = "write-via-stream"]
                        fn wit_import0(_: i32) -> i32;
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import0(_: i32) -> i32 {
                        unreachable!()
                    }
                    let ret = wit_import0((&data).take_handle() as i32);
                    wit_bindgen::rt::async_support::FutureReader::new(
                        ret as u32,
                        &<Result<
                            (),
                            ErrorCode,
                        > as super::super::super::wit_future::FuturePayload>::VTABLE,
                    )
                }
            }
        }
        /// Terminal input.
        ///
        /// In the future, this may include functions for disabling echoing,
        /// disabling input buffering so that keyboard events are sent through
        /// immediately, querying supported features, and so on.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod terminal_input {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            /// The input side of a terminal.
            #[derive(Debug)]
            #[repr(transparent)]
            pub struct TerminalInput {
                handle: _rt::Resource<TerminalInput>,
            }
            impl TerminalInput {
                #[doc(hidden)]
                pub unsafe fn from_handle(handle: u32) -> Self {
                    Self {
                        handle: unsafe { _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 TerminalInput {
                #[inline]
                unsafe fn drop(_handle: u32) {
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:cli/terminal-input@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "[resource-drop]terminal-input"]
                        fn drop(_: i32);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn drop(_: i32) {
                        unreachable!()
                    }
                    unsafe {
                        drop(_handle as i32);
                    }
                }
            }
        }
        /// Terminal output.
        ///
        /// In the future, this may include functions for querying the terminal
        /// size, being notified of terminal size changes, querying supported
        /// features, and so on.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod terminal_output {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            /// The output side of a terminal.
            #[derive(Debug)]
            #[repr(transparent)]
            pub struct TerminalOutput {
                handle: _rt::Resource<TerminalOutput>,
            }
            impl TerminalOutput {
                #[doc(hidden)]
                pub unsafe fn from_handle(handle: u32) -> Self {
                    Self {
                        handle: unsafe { _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 TerminalOutput {
                #[inline]
                unsafe fn drop(_handle: u32) {
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:cli/terminal-output@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "[resource-drop]terminal-output"]
                        fn drop(_: i32);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn drop(_: i32) {
                        unreachable!()
                    }
                    unsafe {
                        drop(_handle as i32);
                    }
                }
            }
        }
        /// An interface providing an optional `terminal-input` for stdin as a
        /// link-time authority.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod terminal_stdin {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            pub type TerminalInput = super::super::super::wasi::cli::terminal_input::TerminalInput;
            #[allow(unused_unsafe, clippy::all)]
            /// If stdin is connected to a terminal, return a `terminal-input` handle
            /// allowing further interaction with it.
            #[allow(async_fn_in_trait)]
            pub fn get_terminal_stdin() -> Option<TerminalInput> {
                unsafe {
                    #[repr(align(4))]
                    struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
                    let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:cli/terminal-stdin@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-terminal-stdin"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                    let result4 = match l2 {
                        0 => None,
                        1 => {
                            let e = {
                                let l3 = *ptr0.add(4).cast::<i32>();
                                super::super::super::wasi::cli::terminal_input::TerminalInput::from_handle(
                                    l3 as u32,
                                )
                            };
                            Some(e)
                        }
                        _ => _rt::invalid_enum_discriminant(),
                    };
                    result4
                }
            }
        }
        /// An interface providing an optional `terminal-output` for stdout as a
        /// link-time authority.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod terminal_stdout {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            pub type TerminalOutput = super::super::super::wasi::cli::terminal_output::TerminalOutput;
            #[allow(unused_unsafe, clippy::all)]
            /// If stdout is connected to a terminal, return a `terminal-output` handle
            /// allowing further interaction with it.
            #[allow(async_fn_in_trait)]
            pub fn get_terminal_stdout() -> Option<TerminalOutput> {
                unsafe {
                    #[repr(align(4))]
                    struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
                    let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:cli/terminal-stdout@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-terminal-stdout"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                    let result4 = match l2 {
                        0 => None,
                        1 => {
                            let e = {
                                let l3 = *ptr0.add(4).cast::<i32>();
                                super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle(
                                    l3 as u32,
                                )
                            };
                            Some(e)
                        }
                        _ => _rt::invalid_enum_discriminant(),
                    };
                    result4
                }
            }
        }
        /// An interface providing an optional `terminal-output` for stderr as a
        /// link-time authority.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod terminal_stderr {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            pub type TerminalOutput = super::super::super::wasi::cli::terminal_output::TerminalOutput;
            #[allow(unused_unsafe, clippy::all)]
            /// If stderr is connected to a terminal, return a `terminal-output` handle
            /// allowing further interaction with it.
            #[allow(async_fn_in_trait)]
            pub fn get_terminal_stderr() -> Option<TerminalOutput> {
                unsafe {
                    #[repr(align(4))]
                    struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
                    let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:cli/terminal-stderr@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-terminal-stderr"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                    let result4 = match l2 {
                        0 => None,
                        1 => {
                            let e = {
                                let l3 = *ptr0.add(4).cast::<i32>();
                                super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle(
                                    l3 as u32,
                                )
                            };
                            Some(e)
                        }
                        _ => _rt::invalid_enum_discriminant(),
                    };
                    result4
                }
            }
        }
    }
    pub mod clocks {
        /// This interface common types used throughout wasi:clocks.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod types {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            /// A duration of time, in nanoseconds.
            pub type Duration = u64;
        }
        /// WASI Monotonic Clock is a clock API intended to let users measure elapsed
        /// time.
        ///
        /// It is intended to be portable at least between Unix-family platforms and
        /// Windows.
        ///
        /// A monotonic clock is a clock which has an unspecified initial value, and
        /// successive reads of the clock will produce non-decreasing values.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod monotonic_clock {
            #[used]
            #[doc(hidden)]
            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::clocks::types::Duration;
            /// A mark on a monotonic clock is a number of nanoseconds since an
            /// unspecified initial value, and can only be compared to instances from
            /// the same monotonic-clock.
            pub type Mark = u64;
            #[allow(unused_unsafe, clippy::all)]
            /// Read the current value of the clock.
            ///
            /// The clock is monotonic, therefore calling this function repeatedly will
            /// produce a sequence of non-decreasing values.
            ///
            /// For completeness, this function traps if it's not possible to represent
            /// the value of the clock in a `mark`. Consequently, implementations
            /// should ensure that the starting time is low enough to avoid the
            /// possibility of overflow in practice.
            #[allow(async_fn_in_trait)]
            pub fn now() -> Mark {
                unsafe {
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "now"]
                        fn wit_import0() -> i64;
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import0() -> i64 {
                        unreachable!()
                    }
                    let ret = wit_import0();
                    ret as u64
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Query the resolution of the clock. Returns the duration of time
            /// corresponding to a clock tick.
            #[allow(async_fn_in_trait)]
            pub fn get_resolution() -> Duration {
                unsafe {
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-resolution"]
                        fn wit_import0() -> i64;
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import0() -> i64 {
                        unreachable!()
                    }
                    let ret = wit_import0();
                    ret as u64
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Wait until the specified mark has occurred.
            #[allow(async_fn_in_trait)]
            pub async fn wait_until(when: Mark) -> () {
                unsafe {
                    #[derive(Copy, Clone)]
                    struct ParamsLower(i64);
                    unsafe impl Send for ParamsLower {}
                    use wit_bindgen::rt::async_support::Subtask as _Subtask;
                    struct _MySubtask<'a> {
                        _unused: core::marker::PhantomData<&'a ()>,
                    }
                    #[allow(unused_parens)]
                    unsafe impl<'a> _Subtask for _MySubtask<'a> {
                        type Params = (Mark,);
                        type Results = ();
                        type ParamsLower = ParamsLower;
                        fn abi_layout(&mut self) -> ::core::alloc::Layout {
                            unsafe {
                                ::core::alloc::Layout::from_size_align_unchecked(0, 1)
                            }
                        }
                        fn results_offset(&mut self) -> usize {
                            0
                        }
                        unsafe fn call_import(
                            &mut self,
                            _params: Self::ParamsLower,
                            _results: *mut u8,
                        ) -> u32 {
                            #[cfg(target_arch = "wasm32")]
                            #[link(
                                wasm_import_module = "wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15"
                            )]
                            unsafe extern "C" {
                                #[link_name = "[async-lower]wait-until"]
                                fn call(_: i64) -> i32;
                            }
                            #[cfg(not(target_arch = "wasm32"))]
                            unsafe extern "C" fn call(_: i64) -> i32 {
                                unreachable!()
                            }
                            unsafe { call(_params.0) as u32 }
                        }
                        unsafe fn params_dealloc_lists(
                            &mut self,
                            _params: Self::ParamsLower,
                        ) {
                            unsafe {}
                        }
                        unsafe fn params_dealloc_lists_and_own(
                            &mut self,
                            _params: Self::ParamsLower,
                        ) {
                            unsafe {}
                        }
                        unsafe fn params_lower(
                            &mut self,
                            (_lower0,): Self::Params,
                            _ptr: *mut u8,
                        ) -> Self::ParamsLower {
                            unsafe { ParamsLower(_rt::as_i64(_lower0)) }
                        }
                        unsafe fn results_lift(
                            &mut self,
                            _ptr: *mut u8,
                        ) -> Self::Results {}
                    }
                    _MySubtask {
                        _unused: core::marker::PhantomData,
                    }
                        .call((when,))
                        .await
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Wait for the specified duration to elapse.
            #[allow(async_fn_in_trait)]
            pub async fn wait_for(how_long: Duration) -> () {
                unsafe {
                    #[derive(Copy, Clone)]
                    struct ParamsLower(i64);
                    unsafe impl Send for ParamsLower {}
                    use wit_bindgen::rt::async_support::Subtask as _Subtask;
                    struct _MySubtask<'a> {
                        _unused: core::marker::PhantomData<&'a ()>,
                    }
                    #[allow(unused_parens)]
                    unsafe impl<'a> _Subtask for _MySubtask<'a> {
                        type Params = (Duration,);
                        type Results = ();
                        type ParamsLower = ParamsLower;
                        fn abi_layout(&mut self) -> ::core::alloc::Layout {
                            unsafe {
                                ::core::alloc::Layout::from_size_align_unchecked(0, 1)
                            }
                        }
                        fn results_offset(&mut self) -> usize {
                            0
                        }
                        unsafe fn call_import(
                            &mut self,
                            _params: Self::ParamsLower,
                            _results: *mut u8,
                        ) -> u32 {
                            #[cfg(target_arch = "wasm32")]
                            #[link(
                                wasm_import_module = "wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15"
                            )]
                            unsafe extern "C" {
                                #[link_name = "[async-lower]wait-for"]
                                fn call(_: i64) -> i32;
                            }
                            #[cfg(not(target_arch = "wasm32"))]
                            unsafe extern "C" fn call(_: i64) -> i32 {
                                unreachable!()
                            }
                            unsafe { call(_params.0) as u32 }
                        }
                        unsafe fn params_dealloc_lists(
                            &mut self,
                            _params: Self::ParamsLower,
                        ) {
                            unsafe {}
                        }
                        unsafe fn params_dealloc_lists_and_own(
                            &mut self,
                            _params: Self::ParamsLower,
                        ) {
                            unsafe {}
                        }
                        unsafe fn params_lower(
                            &mut self,
                            (_lower0,): Self::Params,
                            _ptr: *mut u8,
                        ) -> Self::ParamsLower {
                            unsafe { ParamsLower(_rt::as_i64(_lower0)) }
                        }
                        unsafe fn results_lift(
                            &mut self,
                            _ptr: *mut u8,
                        ) -> Self::Results {}
                    }
                    _MySubtask {
                        _unused: core::marker::PhantomData,
                    }
                        .call((how_long,))
                        .await
                }
            }
        }
        /// WASI System Clock is a clock API intended to let users query the current
        /// time. The clock is not necessarily monotonic as it may be reset.
        ///
        /// It is intended to be portable at least between Unix-family platforms and
        /// Windows.
        ///
        /// External references may be reset, so this clock is not necessarily
        /// monotonic, making it unsuitable for measuring elapsed time.
        ///
        /// It is intended for reporting the current date and time for humans.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod system_clock {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            pub type Duration = super::super::super::wasi::clocks::types::Duration;
            /// An "instant", or "exact time", is a point in time without regard to any
            /// time zone: just the time since a particular external reference point,
            /// often called an "epoch".
            ///
            /// Here, the epoch is 1970-01-01T00:00:00Z, also known as
            /// [POSIX's Seconds Since the Epoch], also known as [Unix Time].
            ///
            /// Note that even if the seconds field is negative, incrementing
            /// nanoseconds always represents moving forwards in time.
            /// For example, `{ -1 seconds, 999999999 nanoseconds }` represents the
            /// instant one nanosecond before the epoch.
            /// For more on various different ways to represent time, see
            /// https://tc39.es/proposal-temporal/docs/timezone.html
            ///
            /// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
            /// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
            #[repr(C)]
            #[derive(Clone, Copy)]
            pub struct Instant {
                pub seconds: i64,
                pub nanoseconds: u32,
            }
            impl ::core::fmt::Debug for Instant {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    f.debug_struct("Instant")
                        .field("seconds", &self.seconds)
                        .field("nanoseconds", &self.nanoseconds)
                        .finish()
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Read the current value of the clock.
            ///
            /// This clock is not monotonic, therefore calling this function repeatedly
            /// will not necessarily produce a sequence of non-decreasing values.
            ///
            /// The nanoseconds field of the output is always less than 1000000000.
            #[allow(async_fn_in_trait)]
            pub fn now() -> Instant {
                unsafe {
                    #[repr(align(8))]
                    struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
                    let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]);
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:clocks/system-clock@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "now"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = *ptr0.add(0).cast::<i64>();
                    let l3 = *ptr0.add(8).cast::<i32>();
                    let result4 = Instant {
                        seconds: l2,
                        nanoseconds: l3 as u32,
                    };
                    result4
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Query the resolution of the clock. Returns the smallest duration of time
            /// that the implementation permits distinguishing.
            #[allow(async_fn_in_trait)]
            pub fn get_resolution() -> Duration {
                unsafe {
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:clocks/system-clock@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-resolution"]
                        fn wit_import0() -> i64;
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import0() -> i64 {
                        unreachable!()
                    }
                    let ret = wit_import0();
                    ret as u64
                }
            }
        }
    }
    pub mod filesystem {
        /// WASI filesystem is a filesystem API primarily intended to let users run WASI
        /// programs that access their files on their existing filesystems, without
        /// significant overhead.
        ///
        /// Paths are passed as interface-type `string`s, meaning they must consist of
        /// a sequence of Unicode Scalar Values (USVs). Some filesystems may contain
        /// paths which are not accessible by this API.
        ///
        /// The directory separator in WASI is always the forward-slash (`/`).
        ///
        /// All paths in WASI are relative paths, and are interpreted relative to a
        /// `descriptor` referring to a base directory. If a `path` argument to any WASI
        /// function starts with `/`, or if any step of resolving a `path`, including
        /// `..` and symbolic link steps, reaches a directory outside of the base
        /// directory, or reaches a symlink to an absolute or rooted path in the
        /// underlying filesystem, the function fails with `error-code::not-permitted`.
        ///
        /// For more information about WASI path resolution and sandboxing, see
        /// [WASI filesystem path resolution].
        ///
        /// Though this package presents a portable interface modelled on POSIX, it
        /// prioritizes compatibility over portability: allowing users to access their
        /// files on their machine is more important than exposing a single semantics
        /// across all platforms.  Notably, depending on the underlying operating system
        /// and file system:
        ///   * Paths may be case-folded or not.
        ///   * Deleting (unlinking) a file may fail if there are other file descriptors
        ///     open.
        ///   * Durability and atomicity of changes to underlying files when there are
        ///     concurrent writers.
        ///
        /// Users that need well-defined, portable semantics should use a key-value
        /// store or a database instead.
        ///
        /// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod types {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            pub type Instant = super::super::super::wasi::clocks::system_clock::Instant;
            /// 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.
            #[derive(Clone)]
            pub enum DescriptorType {
                /// 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,
                /// The type of the descriptor or file is different from any of the
                /// other types specified.
                Other(Option<_rt::String>),
            }
            impl ::core::fmt::Debug for DescriptorType {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        DescriptorType::BlockDevice => {
                            f.debug_tuple("DescriptorType::BlockDevice").finish()
                        }
                        DescriptorType::CharacterDevice => {
                            f.debug_tuple("DescriptorType::CharacterDevice").finish()
                        }
                        DescriptorType::Directory => {
                            f.debug_tuple("DescriptorType::Directory").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::Other(e) => {
                            f.debug_tuple("DescriptorType::Other").field(e).finish()
                        }
                    }
                }
            }
            wit_bindgen::rt::bitflags::bitflags! {
                #[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 integrity"] #[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! {
                #[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! {
                #[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.
            #[derive(Clone)]
            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<Instant>,
                /// 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<Instant>,
                /// 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<Instant>,
            }
            impl ::core::fmt::Debug for DescriptorStat {
                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)
                        .field("size", &self.size)
                        .field("data-access-timestamp", &self.data_access_timestamp)
                        .field(
                            "data-modification-timestamp",
                            &self.data_modification_timestamp,
                        )
                        .field("status-change-timestamp", &self.status_change_timestamp)
                        .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(Instant),
            }
            impl ::core::fmt::Debug for NewTimestamp {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        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()
                        }
                    }
                }
            }
            /// 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 {
                    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.
            #[derive(Clone)]
            pub enum ErrorCode {
                /// Permission denied, similar to `EACCES` in POSIX.
                Access,
                /// 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,
                /// A catch-all for errors not captured by the existing variants.
                /// Implementations can use this to extend the error type without
                /// breaking existing code.
                Other(Option<_rt::String>),
            }
            impl ::core::fmt::Debug for ErrorCode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        ErrorCode::Access => f.debug_tuple("ErrorCode::Access").finish(),
                        ErrorCode::Already => {
                            f.debug_tuple("ErrorCode::Already").finish()
                        }
                        ErrorCode::BadDescriptor => {
                            f.debug_tuple("ErrorCode::BadDescriptor").finish()
                        }
                        ErrorCode::Busy => f.debug_tuple("ErrorCode::Busy").finish(),
                        ErrorCode::Deadlock => {
                            f.debug_tuple("ErrorCode::Deadlock").finish()
                        }
                        ErrorCode::Quota => f.debug_tuple("ErrorCode::Quota").finish(),
                        ErrorCode::Exist => f.debug_tuple("ErrorCode::Exist").finish(),
                        ErrorCode::FileTooLarge => {
                            f.debug_tuple("ErrorCode::FileTooLarge").finish()
                        }
                        ErrorCode::IllegalByteSequence => {
                            f.debug_tuple("ErrorCode::IllegalByteSequence").finish()
                        }
                        ErrorCode::InProgress => {
                            f.debug_tuple("ErrorCode::InProgress").finish()
                        }
                        ErrorCode::Interrupted => {
                            f.debug_tuple("ErrorCode::Interrupted").finish()
                        }
                        ErrorCode::Invalid => {
                            f.debug_tuple("ErrorCode::Invalid").finish()
                        }
                        ErrorCode::Io => f.debug_tuple("ErrorCode::Io").finish(),
                        ErrorCode::IsDirectory => {
                            f.debug_tuple("ErrorCode::IsDirectory").finish()
                        }
                        ErrorCode::Loop => f.debug_tuple("ErrorCode::Loop").finish(),
                        ErrorCode::TooManyLinks => {
                            f.debug_tuple("ErrorCode::TooManyLinks").finish()
                        }
                        ErrorCode::MessageSize => {
                            f.debug_tuple("ErrorCode::MessageSize").finish()
                        }
                        ErrorCode::NameTooLong => {
                            f.debug_tuple("ErrorCode::NameTooLong").finish()
                        }
                        ErrorCode::NoDevice => {
                            f.debug_tuple("ErrorCode::NoDevice").finish()
                        }
                        ErrorCode::NoEntry => {
                            f.debug_tuple("ErrorCode::NoEntry").finish()
                        }
                        ErrorCode::NoLock => f.debug_tuple("ErrorCode::NoLock").finish(),
                        ErrorCode::InsufficientMemory => {
                            f.debug_tuple("ErrorCode::InsufficientMemory").finish()
                        }
                        ErrorCode::InsufficientSpace => {
                            f.debug_tuple("ErrorCode::InsufficientSpace").finish()
                        }
                        ErrorCode::NotDirectory => {
                            f.debug_tuple("ErrorCode::NotDirectory").finish()
                        }
                        ErrorCode::NotEmpty => {
                            f.debug_tuple("ErrorCode::NotEmpty").finish()
                        }
                        ErrorCode::NotRecoverable => {
                            f.debug_tuple("ErrorCode::NotRecoverable").finish()
                        }
                        ErrorCode::Unsupported => {
                            f.debug_tuple("ErrorCode::Unsupported").finish()
                        }
                        ErrorCode::NoTty => f.debug_tuple("ErrorCode::NoTty").finish(),
                        ErrorCode::NoSuchDevice => {
                            f.debug_tuple("ErrorCode::NoSuchDevice").finish()
                        }
                        ErrorCode::Overflow => {
                            f.debug_tuple("ErrorCode::Overflow").finish()
                        }
                        ErrorCode::NotPermitted => {
                            f.debug_tuple("ErrorCode::NotPermitted").finish()
                        }
                        ErrorCode::Pipe => f.debug_tuple("ErrorCode::Pipe").finish(),
                        ErrorCode::ReadOnly => {
                            f.debug_tuple("ErrorCode::ReadOnly").finish()
                        }
                        ErrorCode::InvalidSeek => {
                            f.debug_tuple("ErrorCode::InvalidSeek").finish()
                        }
                        ErrorCode::TextFileBusy => {
                            f.debug_tuple("ErrorCode::TextFileBusy").finish()
                        }
                        ErrorCode::CrossDevice => {
                            f.debug_tuple("ErrorCode::CrossDevice").finish()
                        }
                        ErrorCode::Other(e) => {
                            f.debug_tuple("ErrorCode::Other").field(e).finish()
                        }
                    }
                }
            }
            impl ::core::fmt::Display for ErrorCode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    write!(f, "{:?}", self)
                }
            }
            #[cfg(feature = "std")]
            impl ::core::error::Error for ErrorCode {}
            /// File or memory access pattern advisory information.
            #[repr(u8)]
            #[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 {
                    match self {
                        Advice::Normal => f.debug_tuple("Advice::Normal").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(),
                        Advice::NoReuse => f.debug_tuple("Advice::NoReuse").finish(),
                    }
                }
            }
            impl Advice {
                #[doc(hidden)]
                pub unsafe fn _lift(val: u8) -> Advice {
                    if !cfg!(debug_assertions) {
                        return unsafe { ::core::mem::transmute(val) };
                    }
                    match val {
                        0 => Advice::Normal,
                        1 => Advice::Sequential,
                        2 => Advice::Random,
                        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 {
                    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<Descriptor>,
            }
            impl Descriptor {
                #[doc(hidden)]
                pub unsafe fn from_handle(handle: u32) -> Self {
                    Self {
                        handle: unsafe { _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(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "[resource-drop]descriptor"]
                        fn drop(_: i32);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn drop(_: i32) {
                        unreachable!()
                    }
                    unsafe {
                        drop(_handle as i32);
                    }
                }
            }
            impl Descriptor {
                #[allow(unused_unsafe, clippy::all)]
                /// Return a stream for reading from a file.
                ///
                /// Multiple read, write, and append streams may be active on the same open
                /// file and they do not interfere with each other.
                ///
                /// This function returns a `stream` which provides the data received from the
                /// file, and a `future` providing additional error information in case an
                /// error is encountered.
                ///
                /// If no error is encountered, `stream.read` on the `stream` will return
                /// `read-status::closed` with no `error-context` and the future resolves to
                /// the value `ok`. If an error is encountered, `stream.read` on the
                /// `stream` returns `read-status::closed` with an `error-context` and the future
                /// resolves to `err` with an `error-code`.
                ///
                /// Note: This is similar to `pread` in POSIX.
                #[allow(async_fn_in_trait)]
                pub fn read_via_stream(
                    &self,
                    offset: Filesize,
                ) -> (
                    wit_bindgen::rt::async_support::StreamReader<u8>,
                    wit_bindgen::rt::async_support::FutureReader<Result<(), ErrorCode>>,
                ) {
                    unsafe {
                        #[repr(align(4))]
                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 8],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]descriptor.read-via-stream"]
                            fn wit_import1(_: i32, _: i64, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i64(offset), ptr0);
                        let l2 = *ptr0.add(0).cast::<i32>();
                        let l3 = *ptr0.add(4).cast::<i32>();
                        let result4 = (
                            wit_bindgen::rt::async_support::StreamReader::new(
                                l2 as u32,
                                &<u8 as super::super::super::wit_stream::StreamPayload>::VTABLE,
                            ),
                            wit_bindgen::rt::async_support::FutureReader::new(
                                l3 as u32,
                                &<Result<
                                    (),
                                    ErrorCode,
                                > as super::super::super::wit_future::FuturePayload>::VTABLE,
                            ),
                        );
                        result4
                    }
                }
            }
            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.
                ///
                /// 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.
                ///
                /// This function returns once either full contents of the stream are
                /// written or an error is encountered.
                ///
                /// Note: This is similar to `pwrite` in POSIX.
                #[allow(async_fn_in_trait)]
                pub fn write_via_stream(
                    &self,
                    data: wit_bindgen::rt::async_support::StreamReader<u8>,
                    offset: Filesize,
                ) -> wit_bindgen::rt::async_support::FutureReader<
                    Result<(), ErrorCode>,
                > {
                    unsafe {
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]descriptor.write-via-stream"]
                            fn wit_import0(_: i32, _: i32, _: i64) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import0(_: i32, _: i32, _: i64) -> i32 {
                            unreachable!()
                        }
                        let ret = wit_import0(
                            (self).handle() as i32,
                            (&data).take_handle() as i32,
                            _rt::as_i64(offset),
                        );
                        wit_bindgen::rt::async_support::FutureReader::new(
                            ret as u32,
                            &<Result<
                                (),
                                ErrorCode,
                            > as super::super::super::wit_future::FuturePayload>::VTABLE,
                        )
                    }
                }
            }
            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.
                ///
                /// This function returns once either full contents of the stream are
                /// written or an error is encountered.
                ///
                /// Note: This is similar to `write` with `O_APPEND` in POSIX.
                #[allow(async_fn_in_trait)]
                pub fn append_via_stream(
                    &self,
                    data: wit_bindgen::rt::async_support::StreamReader<u8>,
                ) -> wit_bindgen::rt::async_support::FutureReader<
                    Result<(), ErrorCode>,
                > {
                    unsafe {
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]descriptor.append-via-stream"]
                            fn wit_import0(_: i32, _: i32) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import0(_: i32, _: i32) -> i32 {
                            unreachable!()
                        }
                        let ret = wit_import0(
                            (self).handle() as i32,
                            (&data).take_handle() as i32,
                        );
                        wit_bindgen::rt::async_support::FutureReader::new(
                            ret as u32,
                            &<Result<
                                (),
                                ErrorCode,
                            > as super::super::super::wit_future::FuturePayload>::VTABLE,
                        )
                    }
                }
            }
            impl Descriptor {
                #[allow(unused_unsafe, clippy::all)]
                /// Provide file advisory information on a descriptor.
                ///
                /// This is similar to `posix_fadvise` in POSIX.
                #[allow(async_fn_in_trait)]
                pub async fn advise(
                    &self,
                    offset: Filesize,
                    length: Filesize,
                    advice: Advice,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32, i64, i64, i32);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, Filesize, Filesize, Advice);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.advise"]
                                    fn call(_: i32, _: i64, _: i64, _: i32, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(
                                    _: i32,
                                    _: i64,
                                    _: i64,
                                    _: i32,
                                    _: *mut u8,
                                ) -> i32 {
                                    unreachable!()
                                }
                                unsafe {
                                    call(_params.0, _params.1, _params.2, _params.3, _results)
                                        as u32
                                }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2, _lower3): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe {
                                    ParamsLower(
                                        (_lower0).handle() as i32,
                                        _rt::as_i64(_lower1),
                                        _rt::as_i64(_lower2),
                                        _lower3.clone() as i32,
                                    )
                                }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, offset, length, advice))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn sync_data(&self) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor,);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.sync-data"]
                                    fn call(_: i32, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: i32, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0,): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe { ParamsLower((_lower0).handle() as i32) }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self,))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn get_flags(&self) -> Result<DescriptorFlags, ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor,);
                            type Results = Result<DescriptorFlags, ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.get-flags"]
                                    fn call(_: i32, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: i32, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0,): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe { ParamsLower((_lower0).handle() as i32) }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                DescriptorFlags::empty()
                                                    | DescriptorFlags::from_bits_retain(((l1 as u8) << 0) as _)
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l2 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v7 = match l2 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e7 = {
                                                            let l3 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l3 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l4 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l5 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len6 = l5;
                                                                        let bytes6 = _rt::Vec::from_raw_parts(
                                                                            l4.cast(),
                                                                            len6,
                                                                            len6,
                                                                        );
                                                                        _rt::string_lift(bytes6)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e7)
                                                    }
                                                };
                                                v7
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self,))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn get_type(&self) -> Result<DescriptorType, ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor,);
                            type Results = Result<DescriptorType, ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.get-type"]
                                    fn call(_: i32, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: i32, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0,): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe { ParamsLower((_lower0).handle() as i32) }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => DescriptorType::BlockDevice,
                                                    1 => DescriptorType::CharacterDevice,
                                                    2 => DescriptorType::Directory,
                                                    3 => DescriptorType::Fifo,
                                                    4 => DescriptorType::SymbolicLink,
                                                    5 => DescriptorType::RegularFile,
                                                    6 => DescriptorType::Socket,
                                                    n => {
                                                        debug_assert_eq!(n, 7, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        DescriptorType::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l7 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v12 = match l7 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e12 = {
                                                            let l8 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l8 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l9 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l10 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len11 = l10;
                                                                        let bytes11 = _rt::Vec::from_raw_parts(
                                                                            l9.cast(),
                                                                            len11,
                                                                            len11,
                                                                        );
                                                                        _rt::string_lift(bytes11)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e12)
                                                    }
                                                };
                                                v12
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self,))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn set_size(&self, size: Filesize) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32, i64);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, Filesize);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.set-size"]
                                    fn call(_: i32, _: i64, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(
                                    _: i32,
                                    _: i64,
                                    _: *mut u8,
                                ) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _params.1, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe {
                                    ParamsLower((_lower0).handle() as i32, _rt::as_i64(_lower1))
                                }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, size))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn set_times(
                    &self,
                    data_access_timestamp: NewTimestamp,
                    data_modification_timestamp: NewTimestamp,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(*mut u8);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, NewTimestamp, NewTimestamp);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (64 + 4 * ::core::mem::size_of::<*const u8>()),
                                        8,
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                56
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.set-times"]
                                    fn call(_: *mut u8, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: *mut u8, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                let _param_ptr = unsafe { _ptr.add(0) };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower0).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe { _ptr.add(8) };
                                unsafe {
                                    match _lower1 {
                                        NewTimestamp::NoChange => {
                                            *_param_ptr.add(0).cast::<u8>() = (0i32) as u8;
                                        }
                                        NewTimestamp::Now => {
                                            *_param_ptr.add(0).cast::<u8>() = (1i32) as u8;
                                        }
                                        NewTimestamp::Timestamp(e) => {
                                            *_param_ptr.add(0).cast::<u8>() = (2i32) as u8;
                                            let super::super::super::wasi::clocks::system_clock::Instant {
                                                seconds: seconds0,
                                                nanoseconds: nanoseconds0,
                                            } = e;
                                            *_param_ptr.add(8).cast::<i64>() = _rt::as_i64(seconds0);
                                            *_param_ptr.add(16).cast::<i32>() = _rt::as_i32(
                                                nanoseconds0,
                                            );
                                        }
                                    }
                                }
                                let _param_ptr = unsafe { _ptr.add(32) };
                                unsafe {
                                    match _lower2 {
                                        NewTimestamp::NoChange => {
                                            *_param_ptr.add(0).cast::<u8>() = (0i32) as u8;
                                        }
                                        NewTimestamp::Now => {
                                            *_param_ptr.add(0).cast::<u8>() = (1i32) as u8;
                                        }
                                        NewTimestamp::Timestamp(e) => {
                                            *_param_ptr.add(0).cast::<u8>() = (2i32) as u8;
                                            let super::super::super::wasi::clocks::system_clock::Instant {
                                                seconds: seconds0,
                                                nanoseconds: nanoseconds0,
                                            } = e;
                                            *_param_ptr.add(8).cast::<i64>() = _rt::as_i64(seconds0);
                                            *_param_ptr.add(16).cast::<i32>() = _rt::as_i32(
                                                nanoseconds0,
                                            );
                                        }
                                    }
                                }
                                ParamsLower(_ptr)
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((
                                self,
                                data_access_timestamp,
                                data_modification_timestamp,
                            ))
                            .await
                    }
                }
            }
            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.
                ///
                /// This function returns a future, which will resolve to an error code if
                /// reading full contents of the directory fails.
                #[allow(async_fn_in_trait)]
                pub fn read_directory(
                    &self,
                ) -> (
                    wit_bindgen::rt::async_support::StreamReader<DirectoryEntry>,
                    wit_bindgen::rt::async_support::FutureReader<Result<(), ErrorCode>>,
                ) {
                    unsafe {
                        #[repr(align(4))]
                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 8],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]descriptor.read-directory"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = *ptr0.add(0).cast::<i32>();
                        let l3 = *ptr0.add(4).cast::<i32>();
                        let result4 = (
                            wit_bindgen::rt::async_support::StreamReader::new(
                                l2 as u32,
                                &<DirectoryEntry as super::super::super::wit_stream::StreamPayload>::VTABLE,
                            ),
                            wit_bindgen::rt::async_support::FutureReader::new(
                                l3 as u32,
                                &<Result<
                                    (),
                                    ErrorCode,
                                > as super::super::super::wit_future::FuturePayload>::VTABLE,
                            ),
                        );
                        result4
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn sync(&self) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor,);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.sync"]
                                    fn call(_: i32, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: i32, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0,): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe { ParamsLower((_lower0).handle() as i32) }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self,))
                            .await
                    }
                }
            }
            impl Descriptor {
                #[allow(unused_unsafe, clippy::all)]
                /// Create a directory.
                ///
                /// Note: This is similar to `mkdirat` in POSIX.
                #[allow(async_fn_in_trait)]
                pub async fn create_directory_at(
                    &self,
                    path: _rt::String,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32, *mut u8, usize);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, _rt::String);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.create-directory-at"]
                                    fn call(_: i32, _: *mut u8, _: usize, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(
                                    _: i32,
                                    _: *mut u8,
                                    _: usize,
                                    _: *mut u8,
                                ) -> i32 {
                                    unreachable!()
                                }
                                unsafe {
                                    call(_params.0, _params.1, _params.2, _results) as u32
                                }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.1, _params.2, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.1, _params.2, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe {
                                    let vec0 = (_lower1.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    ParamsLower(
                                        (_lower0).handle() as i32,
                                        ptr0.cast_mut(),
                                        len0,
                                    )
                                }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, path))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn stat(&self) -> Result<DescriptorStat, ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor,);
                            type Results = Result<DescriptorStat, ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (96 + 4 * ::core::mem::size_of::<*const u8>()),
                                        8,
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.stat"]
                                    fn call(_: i32, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: i32, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0,): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe { ParamsLower((_lower0).handle() as i32) }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = {
                                                let l1 = i32::from(*_ptr.add(8).cast::<u8>());
                                                let v6 = match l1 {
                                                    0 => DescriptorType::BlockDevice,
                                                    1 => DescriptorType::CharacterDevice,
                                                    2 => DescriptorType::Directory,
                                                    3 => DescriptorType::Fifo,
                                                    4 => DescriptorType::SymbolicLink,
                                                    5 => DescriptorType::RegularFile,
                                                    6 => DescriptorType::Socket,
                                                    n => {
                                                        debug_assert_eq!(n, 7, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        DescriptorType::Other(e6)
                                                    }
                                                };
                                                let l7 = *_ptr
                                                    .add(8 + 4 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i64>();
                                                let l8 = *_ptr
                                                    .add(16 + 4 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i64>();
                                                let l9 = i32::from(
                                                    *_ptr
                                                        .add(24 + 4 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l12 = i32::from(
                                                    *_ptr
                                                        .add(48 + 4 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l15 = i32::from(
                                                    *_ptr
                                                        .add(72 + 4 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                DescriptorStat {
                                                    type_: v6,
                                                    link_count: l7 as u64,
                                                    size: l8 as u64,
                                                    data_access_timestamp: match l9 {
                                                        0 => None,
                                                        1 => {
                                                            let e = {
                                                                let l10 = *_ptr
                                                                    .add(32 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i64>();
                                                                let l11 = *_ptr
                                                                    .add(40 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i32>();
                                                                super::super::super::wasi::clocks::system_clock::Instant {
                                                                    seconds: l10,
                                                                    nanoseconds: l11 as u32,
                                                                }
                                                            };
                                                            Some(e)
                                                        }
                                                        _ => _rt::invalid_enum_discriminant(),
                                                    },
                                                    data_modification_timestamp: match l12 {
                                                        0 => None,
                                                        1 => {
                                                            let e = {
                                                                let l13 = *_ptr
                                                                    .add(56 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i64>();
                                                                let l14 = *_ptr
                                                                    .add(64 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i32>();
                                                                super::super::super::wasi::clocks::system_clock::Instant {
                                                                    seconds: l13,
                                                                    nanoseconds: l14 as u32,
                                                                }
                                                            };
                                                            Some(e)
                                                        }
                                                        _ => _rt::invalid_enum_discriminant(),
                                                    },
                                                    status_change_timestamp: match l15 {
                                                        0 => None,
                                                        1 => {
                                                            let e = {
                                                                let l16 = *_ptr
                                                                    .add(80 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i64>();
                                                                let l17 = *_ptr
                                                                    .add(88 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i32>();
                                                                super::super::super::wasi::clocks::system_clock::Instant {
                                                                    seconds: l16,
                                                                    nanoseconds: l17 as u32,
                                                                }
                                                            };
                                                            Some(e)
                                                        }
                                                        _ => _rt::invalid_enum_discriminant(),
                                                    },
                                                }
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l18 = i32::from(*_ptr.add(8).cast::<u8>());
                                                let v23 = match l18 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e23 = {
                                                            let l19 = i32::from(
                                                                *_ptr
                                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l19 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l20 = *_ptr
                                                                            .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l21 = *_ptr
                                                                            .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len22 = l21;
                                                                        let bytes22 = _rt::Vec::from_raw_parts(
                                                                            l20.cast(),
                                                                            len22,
                                                                            len22,
                                                                        );
                                                                        _rt::string_lift(bytes22)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e23)
                                                    }
                                                };
                                                v23
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self,))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn stat_at(
                    &self,
                    path_flags: PathFlags,
                    path: _rt::String,
                ) -> Result<DescriptorStat, ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32, i32, *mut u8, usize);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, PathFlags, _rt::String);
                            type Results = Result<DescriptorStat, ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (96 + 4 * ::core::mem::size_of::<*const u8>()),
                                        8,
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.stat-at"]
                                    fn call(
                                        _: i32,
                                        _: i32,
                                        _: *mut u8,
                                        _: usize,
                                        _: *mut u8,
                                    ) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(
                                    _: i32,
                                    _: i32,
                                    _: *mut u8,
                                    _: usize,
                                    _: *mut u8,
                                ) -> i32 {
                                    unreachable!()
                                }
                                unsafe {
                                    call(_params.0, _params.1, _params.2, _params.3, _results)
                                        as u32
                                }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.2, _params.3, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.2, _params.3, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe {
                                    let flags0 = _lower1;
                                    let vec1 = (_lower2.into_bytes()).into_boxed_slice();
                                    let ptr1 = vec1.as_ptr().cast::<u8>();
                                    let len1 = vec1.len();
                                    ::core::mem::forget(vec1);
                                    ParamsLower(
                                        (_lower0).handle() as i32,
                                        (flags0.bits() >> 0) as i32,
                                        ptr1.cast_mut(),
                                        len1,
                                    )
                                }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = {
                                                let l1 = i32::from(*_ptr.add(8).cast::<u8>());
                                                let v6 = match l1 {
                                                    0 => DescriptorType::BlockDevice,
                                                    1 => DescriptorType::CharacterDevice,
                                                    2 => DescriptorType::Directory,
                                                    3 => DescriptorType::Fifo,
                                                    4 => DescriptorType::SymbolicLink,
                                                    5 => DescriptorType::RegularFile,
                                                    6 => DescriptorType::Socket,
                                                    n => {
                                                        debug_assert_eq!(n, 7, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        DescriptorType::Other(e6)
                                                    }
                                                };
                                                let l7 = *_ptr
                                                    .add(8 + 4 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i64>();
                                                let l8 = *_ptr
                                                    .add(16 + 4 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i64>();
                                                let l9 = i32::from(
                                                    *_ptr
                                                        .add(24 + 4 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l12 = i32::from(
                                                    *_ptr
                                                        .add(48 + 4 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l15 = i32::from(
                                                    *_ptr
                                                        .add(72 + 4 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                DescriptorStat {
                                                    type_: v6,
                                                    link_count: l7 as u64,
                                                    size: l8 as u64,
                                                    data_access_timestamp: match l9 {
                                                        0 => None,
                                                        1 => {
                                                            let e = {
                                                                let l10 = *_ptr
                                                                    .add(32 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i64>();
                                                                let l11 = *_ptr
                                                                    .add(40 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i32>();
                                                                super::super::super::wasi::clocks::system_clock::Instant {
                                                                    seconds: l10,
                                                                    nanoseconds: l11 as u32,
                                                                }
                                                            };
                                                            Some(e)
                                                        }
                                                        _ => _rt::invalid_enum_discriminant(),
                                                    },
                                                    data_modification_timestamp: match l12 {
                                                        0 => None,
                                                        1 => {
                                                            let e = {
                                                                let l13 = *_ptr
                                                                    .add(56 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i64>();
                                                                let l14 = *_ptr
                                                                    .add(64 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i32>();
                                                                super::super::super::wasi::clocks::system_clock::Instant {
                                                                    seconds: l13,
                                                                    nanoseconds: l14 as u32,
                                                                }
                                                            };
                                                            Some(e)
                                                        }
                                                        _ => _rt::invalid_enum_discriminant(),
                                                    },
                                                    status_change_timestamp: match l15 {
                                                        0 => None,
                                                        1 => {
                                                            let e = {
                                                                let l16 = *_ptr
                                                                    .add(80 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i64>();
                                                                let l17 = *_ptr
                                                                    .add(88 + 4 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<i32>();
                                                                super::super::super::wasi::clocks::system_clock::Instant {
                                                                    seconds: l16,
                                                                    nanoseconds: l17 as u32,
                                                                }
                                                            };
                                                            Some(e)
                                                        }
                                                        _ => _rt::invalid_enum_discriminant(),
                                                    },
                                                }
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l18 = i32::from(*_ptr.add(8).cast::<u8>());
                                                let v23 = match l18 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e23 = {
                                                            let l19 = i32::from(
                                                                *_ptr
                                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l19 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l20 = *_ptr
                                                                            .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l21 = *_ptr
                                                                            .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len22 = l21;
                                                                        let bytes22 = _rt::Vec::from_raw_parts(
                                                                            l20.cast(),
                                                                            len22,
                                                                            len22,
                                                                        );
                                                                        _rt::string_lift(bytes22)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e23)
                                                    }
                                                };
                                                v23
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, path_flags, path))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn set_times_at(
                    &self,
                    path_flags: PathFlags,
                    path: _rt::String,
                    data_access_timestamp: NewTimestamp,
                    data_modification_timestamp: NewTimestamp,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(*mut u8);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (
                                &'a Descriptor,
                                PathFlags,
                                _rt::String,
                                NewTimestamp,
                                NewTimestamp,
                            );
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (64 + 6 * ::core::mem::size_of::<*const u8>()),
                                        8,
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                (56 + 2 * ::core::mem::size_of::<*const u8>())
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.set-times-at"]
                                    fn call(_: *mut u8, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: *mut u8, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params.0.add(8).cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params.0.add(8).cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2, _lower3, _lower4): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                let _param_ptr = unsafe { _ptr.add(0) };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower0).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe { _ptr.add(4) };
                                unsafe {
                                    let flags0 = _lower1;
                                    *_param_ptr.add(0).cast::<u8>() = ((flags0.bits() >> 0)
                                        as i32) as u8;
                                }
                                let _param_ptr = unsafe { _ptr.add(8) };
                                unsafe {
                                    let vec0 = (_lower2.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    *_param_ptr
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<usize>() = len0;
                                    *_param_ptr.add(0).cast::<*mut u8>() = ptr0.cast_mut();
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((8 + 2 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    match _lower3 {
                                        NewTimestamp::NoChange => {
                                            *_param_ptr.add(0).cast::<u8>() = (0i32) as u8;
                                        }
                                        NewTimestamp::Now => {
                                            *_param_ptr.add(0).cast::<u8>() = (1i32) as u8;
                                        }
                                        NewTimestamp::Timestamp(e) => {
                                            *_param_ptr.add(0).cast::<u8>() = (2i32) as u8;
                                            let super::super::super::wasi::clocks::system_clock::Instant {
                                                seconds: seconds0,
                                                nanoseconds: nanoseconds0,
                                            } = e;
                                            *_param_ptr.add(8).cast::<i64>() = _rt::as_i64(seconds0);
                                            *_param_ptr.add(16).cast::<i32>() = _rt::as_i32(
                                                nanoseconds0,
                                            );
                                        }
                                    }
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((32 + 2 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    match _lower4 {
                                        NewTimestamp::NoChange => {
                                            *_param_ptr.add(0).cast::<u8>() = (0i32) as u8;
                                        }
                                        NewTimestamp::Now => {
                                            *_param_ptr.add(0).cast::<u8>() = (1i32) as u8;
                                        }
                                        NewTimestamp::Timestamp(e) => {
                                            *_param_ptr.add(0).cast::<u8>() = (2i32) as u8;
                                            let super::super::super::wasi::clocks::system_clock::Instant {
                                                seconds: seconds0,
                                                nanoseconds: nanoseconds0,
                                            } = e;
                                            *_param_ptr.add(8).cast::<i64>() = _rt::as_i64(seconds0);
                                            *_param_ptr.add(16).cast::<i32>() = _rt::as_i32(
                                                nanoseconds0,
                                            );
                                        }
                                    }
                                }
                                ParamsLower(_ptr)
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((
                                self,
                                path_flags,
                                path,
                                data_access_timestamp,
                                data_modification_timestamp,
                            ))
                            .await
                    }
                }
            }
            impl Descriptor {
                #[allow(unused_unsafe, clippy::all)]
                /// Create a hard link.
                ///
                /// Fails with `error-code::no-entry` if the old path does not exist,
                /// with `error-code::exist` if the new path already exists, and
                /// `error-code::not-permitted` if the old path is not a file.
                ///
                /// Note: This is similar to `linkat` in POSIX.
                #[allow(async_fn_in_trait)]
                pub async fn link_at(
                    &self,
                    old_path_flags: PathFlags,
                    old_path: _rt::String,
                    new_descriptor: &Descriptor,
                    new_path: _rt::String,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(*mut u8);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (
                                &'a Descriptor,
                                PathFlags,
                                _rt::String,
                                &'a Descriptor,
                                _rt::String,
                            );
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (8 + 10 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                (8 + 5 * ::core::mem::size_of::<*const u8>())
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.link-at"]
                                    fn call(_: *mut u8, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: *mut u8, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params.0.add(8).cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                    let l2 = *_params
                                        .0
                                        .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l3 = *_params
                                        .0
                                        .add(8 + 4 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l2, l3, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params.0.add(8).cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                    let l2 = *_params
                                        .0
                                        .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l3 = *_params
                                        .0
                                        .add(8 + 4 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l2, l3, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2, _lower3, _lower4): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                let _param_ptr = unsafe { _ptr.add(0) };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower0).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe { _ptr.add(4) };
                                unsafe {
                                    let flags0 = _lower1;
                                    *_param_ptr.add(0).cast::<u8>() = ((flags0.bits() >> 0)
                                        as i32) as u8;
                                }
                                let _param_ptr = unsafe { _ptr.add(8) };
                                unsafe {
                                    let vec0 = (_lower2.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    *_param_ptr
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<usize>() = len0;
                                    *_param_ptr.add(0).cast::<*mut u8>() = ptr0.cast_mut();
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((8 + 2 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower3).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((8 + 3 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    let vec0 = (_lower4.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    *_param_ptr
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<usize>() = len0;
                                    *_param_ptr.add(0).cast::<*mut u8>() = ptr0.cast_mut();
                                }
                                ParamsLower(_ptr)
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((
                                self,
                                old_path_flags,
                                old_path,
                                new_descriptor,
                                new_path,
                            ))
                            .await
                    }
                }
            }
            impl Descriptor {
                #[allow(unused_unsafe, clippy::all)]
                /// Open a file or directory.
                ///
                /// 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.
                #[allow(async_fn_in_trait)]
                pub async fn open_at(
                    &self,
                    path_flags: PathFlags,
                    path: _rt::String,
                    open_flags: OpenFlags,
                    flags: DescriptorFlags,
                ) -> Result<Descriptor, ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(*mut u8);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (
                                &'a Descriptor,
                                PathFlags,
                                _rt::String,
                                OpenFlags,
                                DescriptorFlags,
                            );
                            type Results = Result<Descriptor, ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (8 + 8 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                (8 + 3 * ::core::mem::size_of::<*const u8>())
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.open-at"]
                                    fn call(_: *mut u8, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: *mut u8, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params.0.add(8).cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params.0.add(8).cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2, _lower3, _lower4): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                let _param_ptr = unsafe { _ptr.add(0) };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower0).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe { _ptr.add(4) };
                                unsafe {
                                    let flags0 = _lower1;
                                    *_param_ptr.add(0).cast::<u8>() = ((flags0.bits() >> 0)
                                        as i32) as u8;
                                }
                                let _param_ptr = unsafe { _ptr.add(8) };
                                unsafe {
                                    let vec0 = (_lower2.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    *_param_ptr
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<usize>() = len0;
                                    *_param_ptr.add(0).cast::<*mut u8>() = ptr0.cast_mut();
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((8 + 2 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    let flags0 = _lower3;
                                    *_param_ptr.add(0).cast::<u8>() = ((flags0.bits() >> 0)
                                        as i32) as u8;
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((9 + 2 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    let flags0 = _lower4;
                                    *_param_ptr.add(0).cast::<u8>() = ((flags0.bits() >> 0)
                                        as i32) as u8;
                                }
                                ParamsLower(_ptr)
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = {
                                                let l1 = *_ptr
                                                    .add(::core::mem::size_of::<*const u8>())
                                                    .cast::<i32>();
                                                Descriptor::from_handle(l1 as u32)
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l2 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v7 = match l2 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e7 = {
                                                            let l3 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l3 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l4 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l5 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len6 = l5;
                                                                        let bytes6 = _rt::Vec::from_raw_parts(
                                                                            l4.cast(),
                                                                            len6,
                                                                            len6,
                                                                        );
                                                                        _rt::string_lift(bytes6)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e7)
                                                    }
                                                };
                                                v7
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, path_flags, path, open_flags, flags))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn readlink_at(
                    &self,
                    path: _rt::String,
                ) -> Result<_rt::String, ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32, *mut u8, usize);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, _rt::String);
                            type Results = Result<_rt::String, ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.readlink-at"]
                                    fn call(_: i32, _: *mut u8, _: usize, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(
                                    _: i32,
                                    _: *mut u8,
                                    _: usize,
                                    _: *mut u8,
                                ) -> i32 {
                                    unreachable!()
                                }
                                unsafe {
                                    call(_params.0, _params.1, _params.2, _results) as u32
                                }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.1, _params.2, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.1, _params.2, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe {
                                    let vec0 = (_lower1.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    ParamsLower(
                                        (_lower0).handle() as i32,
                                        ptr0.cast_mut(),
                                        len0,
                                    )
                                }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = {
                                                let l1 = *_ptr
                                                    .add(::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l2 = *_ptr
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>();
                                                let len3 = l2;
                                                let bytes3 = _rt::Vec::from_raw_parts(
                                                    l1.cast(),
                                                    len3,
                                                    len3,
                                                );
                                                _rt::string_lift(bytes3)
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l4 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v9 = match l4 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e9 = {
                                                            let l5 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l5 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l6 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l7 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len8 = l7;
                                                                        let bytes8 = _rt::Vec::from_raw_parts(
                                                                            l6.cast(),
                                                                            len8,
                                                                            len8,
                                                                        );
                                                                        _rt::string_lift(bytes8)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e9)
                                                    }
                                                };
                                                v9
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, path))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn remove_directory_at(
                    &self,
                    path: _rt::String,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32, *mut u8, usize);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, _rt::String);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.remove-directory-at"]
                                    fn call(_: i32, _: *mut u8, _: usize, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(
                                    _: i32,
                                    _: *mut u8,
                                    _: usize,
                                    _: *mut u8,
                                ) -> i32 {
                                    unreachable!()
                                }
                                unsafe {
                                    call(_params.0, _params.1, _params.2, _results) as u32
                                }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.1, _params.2, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.1, _params.2, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe {
                                    let vec0 = (_lower1.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    ParamsLower(
                                        (_lower0).handle() as i32,
                                        ptr0.cast_mut(),
                                        len0,
                                    )
                                }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, path))
                            .await
                    }
                }
            }
            impl Descriptor {
                #[allow(unused_unsafe, clippy::all)]
                /// Rename a filesystem object.
                ///
                /// Note: This is similar to `renameat` in POSIX.
                #[allow(async_fn_in_trait)]
                pub async fn rename_at(
                    &self,
                    old_path: _rt::String,
                    new_descriptor: &Descriptor,
                    new_path: _rt::String,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(*mut u8);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (
                                &'a Descriptor,
                                _rt::String,
                                &'a Descriptor,
                                _rt::String,
                            );
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (11 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                (6 * ::core::mem::size_of::<*const u8>())
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.rename-at"]
                                    fn call(_: *mut u8, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: *mut u8, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params
                                        .0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                    let l2 = *_params
                                        .0
                                        .add(4 * ::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l3 = *_params
                                        .0
                                        .add(5 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l2, l3, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params
                                        .0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                    let l2 = *_params
                                        .0
                                        .add(4 * ::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l3 = *_params
                                        .0
                                        .add(5 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l2, l3, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2, _lower3): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                let _param_ptr = unsafe { _ptr.add(0) };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower0).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add(::core::mem::size_of::<*const u8>())
                                };
                                unsafe {
                                    let vec0 = (_lower1.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    *_param_ptr
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<usize>() = len0;
                                    *_param_ptr.add(0).cast::<*mut u8>() = ptr0.cast_mut();
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((3 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower2).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((4 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    let vec0 = (_lower3.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    *_param_ptr
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<usize>() = len0;
                                    *_param_ptr.add(0).cast::<*mut u8>() = ptr0.cast_mut();
                                }
                                ParamsLower(_ptr)
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, old_path, new_descriptor, new_path))
                            .await
                    }
                }
            }
            impl Descriptor {
                #[allow(unused_unsafe, clippy::all)]
                /// 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.
                #[allow(async_fn_in_trait)]
                pub async fn symlink_at(
                    &self,
                    old_path: _rt::String,
                    new_path: _rt::String,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(*mut u8);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, _rt::String, _rt::String);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (10 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                (5 * ::core::mem::size_of::<*const u8>())
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.symlink-at"]
                                    fn call(_: *mut u8, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: *mut u8, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params
                                        .0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                    let l2 = *_params
                                        .0
                                        .add(3 * ::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l3 = *_params
                                        .0
                                        .add(4 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l2, l3, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params
                                        .0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l0, l1, 1);
                                    let l2 = *_params
                                        .0
                                        .add(3 * ::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l3 = *_params
                                        .0
                                        .add(4 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    _rt::cabi_dealloc(l2, l3, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                let _param_ptr = unsafe { _ptr.add(0) };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower0).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add(::core::mem::size_of::<*const u8>())
                                };
                                unsafe {
                                    let vec0 = (_lower1.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    *_param_ptr
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<usize>() = len0;
                                    *_param_ptr.add(0).cast::<*mut u8>() = ptr0.cast_mut();
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((3 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    let vec0 = (_lower2.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    *_param_ptr
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<usize>() = len0;
                                    *_param_ptr.add(0).cast::<*mut u8>() = ptr0.cast_mut();
                                }
                                ParamsLower(_ptr)
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, old_path, new_path))
                            .await
                    }
                }
            }
            impl Descriptor {
                #[allow(unused_unsafe, clippy::all)]
                /// Unlink a filesystem object that is not a directory.
                ///
                /// This is similar to `unlinkat(fd, path, 0)` in POSIX.
                ///
                /// Error returns are as specified by POSIX.
                ///
                /// If the filesystem object is a directory, `error-code::access` or
                /// `error-code::is-directory` may be returned instead of the
                /// POSIX-specified `error-code::not-permitted`.
                #[allow(async_fn_in_trait)]
                pub async fn unlink_file_at(
                    &self,
                    path: _rt::String,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32, *mut u8, usize);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, _rt::String);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (5 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.unlink-file-at"]
                                    fn call(_: i32, _: *mut u8, _: usize, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(
                                    _: i32,
                                    _: *mut u8,
                                    _: usize,
                                    _: *mut u8,
                                ) -> i32 {
                                    unreachable!()
                                }
                                unsafe {
                                    call(_params.0, _params.1, _params.2, _results) as u32
                                }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.1, _params.2, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.1, _params.2, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe {
                                    let vec0 = (_lower1.into_bytes()).into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    ParamsLower(
                                        (_lower0).handle() as i32,
                                        ptr0.cast_mut(),
                                        len0,
                                    )
                                }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, path))
                            .await
                    }
                }
            }
            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.
                #[allow(async_fn_in_trait)]
                pub async fn is_same_object(&self, other: &Descriptor) -> bool {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32, i32);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, &'a Descriptor);
                            type Results = bool;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(1, 1)
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.is-same-object"]
                                    fn call(_: i32, _: i32, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(
                                    _: i32,
                                    _: i32,
                                    _: *mut u8,
                                ) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _params.1, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe {
                                    ParamsLower(
                                        (_lower0).handle() as i32,
                                        (_lower1).handle() as i32,
                                    )
                                }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    _rt::bool_lift(l0 as u8)
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, other))
                            .await
                    }
                }
            }
            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 encouraged 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.
                #[allow(async_fn_in_trait)]
                pub async fn metadata_hash(
                    &self,
                ) -> Result<MetadataHashValue, ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor,);
                            type Results = Result<MetadataHashValue, ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (8 + 4 * ::core::mem::size_of::<*const u8>()),
                                        8,
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.metadata-hash"]
                                    fn call(_: i32, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: i32, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0,): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe { ParamsLower((_lower0).handle() as i32) }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = {
                                                let l1 = *_ptr.add(8).cast::<i64>();
                                                let l2 = *_ptr.add(16).cast::<i64>();
                                                MetadataHashValue {
                                                    lower: l1 as u64,
                                                    upper: l2 as u64,
                                                }
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l3 = i32::from(*_ptr.add(8).cast::<u8>());
                                                let v8 = match l3 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e8 = {
                                                            let l4 = i32::from(
                                                                *_ptr
                                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l4 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l5 = *_ptr
                                                                            .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l6 = *_ptr
                                                                            .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len7 = l6;
                                                                        let bytes7 = _rt::Vec::from_raw_parts(
                                                                            l5.cast(),
                                                                            len7,
                                                                            len7,
                                                                        );
                                                                        _rt::string_lift(bytes7)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e8)
                                                    }
                                                };
                                                v8
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self,))
                            .await
                    }
                }
            }
            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`.
                #[allow(async_fn_in_trait)]
                pub async fn metadata_hash_at(
                    &self,
                    path_flags: PathFlags,
                    path: _rt::String,
                ) -> Result<MetadataHashValue, ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32, i32, *mut u8, usize);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a Descriptor, PathFlags, _rt::String);
                            type Results = Result<MetadataHashValue, ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (8 + 4 * ::core::mem::size_of::<*const u8>()),
                                        8,
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]descriptor.metadata-hash-at"]
                                    fn call(
                                        _: i32,
                                        _: i32,
                                        _: *mut u8,
                                        _: usize,
                                        _: *mut u8,
                                    ) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(
                                    _: i32,
                                    _: i32,
                                    _: *mut u8,
                                    _: usize,
                                    _: *mut u8,
                                ) -> i32 {
                                    unreachable!()
                                }
                                unsafe {
                                    call(_params.0, _params.1, _params.2, _params.3, _results)
                                        as u32
                                }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.2, _params.3, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    _rt::cabi_dealloc(_params.2, _params.3, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe {
                                    let flags0 = _lower1;
                                    let vec1 = (_lower2.into_bytes()).into_boxed_slice();
                                    let ptr1 = vec1.as_ptr().cast::<u8>();
                                    let len1 = vec1.len();
                                    ::core::mem::forget(vec1);
                                    ParamsLower(
                                        (_lower0).handle() as i32,
                                        (flags0.bits() >> 0) as i32,
                                        ptr1.cast_mut(),
                                        len1,
                                    )
                                }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = {
                                                let l1 = *_ptr.add(8).cast::<i64>();
                                                let l2 = *_ptr.add(16).cast::<i64>();
                                                MetadataHashValue {
                                                    lower: l1 as u64,
                                                    upper: l2 as u64,
                                                }
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l3 = i32::from(*_ptr.add(8).cast::<u8>());
                                                let v8 = match l3 {
                                                    0 => ErrorCode::Access,
                                                    1 => ErrorCode::Already,
                                                    2 => ErrorCode::BadDescriptor,
                                                    3 => ErrorCode::Busy,
                                                    4 => ErrorCode::Deadlock,
                                                    5 => ErrorCode::Quota,
                                                    6 => ErrorCode::Exist,
                                                    7 => ErrorCode::FileTooLarge,
                                                    8 => ErrorCode::IllegalByteSequence,
                                                    9 => ErrorCode::InProgress,
                                                    10 => ErrorCode::Interrupted,
                                                    11 => ErrorCode::Invalid,
                                                    12 => ErrorCode::Io,
                                                    13 => ErrorCode::IsDirectory,
                                                    14 => ErrorCode::Loop,
                                                    15 => ErrorCode::TooManyLinks,
                                                    16 => ErrorCode::MessageSize,
                                                    17 => ErrorCode::NameTooLong,
                                                    18 => ErrorCode::NoDevice,
                                                    19 => ErrorCode::NoEntry,
                                                    20 => ErrorCode::NoLock,
                                                    21 => ErrorCode::InsufficientMemory,
                                                    22 => ErrorCode::InsufficientSpace,
                                                    23 => ErrorCode::NotDirectory,
                                                    24 => ErrorCode::NotEmpty,
                                                    25 => ErrorCode::NotRecoverable,
                                                    26 => ErrorCode::Unsupported,
                                                    27 => ErrorCode::NoTty,
                                                    28 => ErrorCode::NoSuchDevice,
                                                    29 => ErrorCode::Overflow,
                                                    30 => ErrorCode::NotPermitted,
                                                    31 => ErrorCode::Pipe,
                                                    32 => ErrorCode::ReadOnly,
                                                    33 => ErrorCode::InvalidSeek,
                                                    34 => ErrorCode::TextFileBusy,
                                                    35 => ErrorCode::CrossDevice,
                                                    n => {
                                                        debug_assert_eq!(n, 36, "invalid enum discriminant");
                                                        let e8 = {
                                                            let l4 = i32::from(
                                                                *_ptr
                                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l4 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l5 = *_ptr
                                                                            .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l6 = *_ptr
                                                                            .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len7 = l6;
                                                                        let bytes7 = _rt::Vec::from_raw_parts(
                                                                            l5.cast(),
                                                                            len7,
                                                                            len7,
                                                                        );
                                                                        _rt::string_lift(bytes7)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e8)
                                                    }
                                                };
                                                v8
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, path_flags, path))
                            .await
                    }
                }
            }
        }
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod preopens {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            pub type Descriptor = super::super::super::wasi::filesystem::types::Descriptor;
            #[allow(unused_unsafe, clippy::all)]
            /// Return the set of preopened directories, and their paths.
            #[allow(async_fn_in_trait)]
            pub fn get_directories() -> _rt::Vec<(Descriptor, _rt::String)> {
                unsafe {
                    #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                    #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                    struct RetArea(
                        [::core::mem::MaybeUninit<
                            u8,
                        >; 2 * ::core::mem::size_of::<*const u8>()],
                    );
                    let mut ret_area = RetArea(
                        [::core::mem::MaybeUninit::uninit(); 2
                            * ::core::mem::size_of::<*const u8>()],
                    );
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:filesystem/preopens@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-directories"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = *ptr0.add(0).cast::<*mut u8>();
                    let l3 = *ptr0
                        .add(::core::mem::size_of::<*const u8>())
                        .cast::<usize>();
                    let base8 = l2;
                    let len8 = l3;
                    let mut result8 = _rt::Vec::with_capacity(len8);
                    for i in 0..len8 {
                        let base = base8
                            .add(i * (3 * ::core::mem::size_of::<*const u8>()));
                        let e8 = {
                            let l4 = *base.add(0).cast::<i32>();
                            let l5 = *base
                                .add(::core::mem::size_of::<*const u8>())
                                .cast::<*mut u8>();
                            let l6 = *base
                                .add(2 * ::core::mem::size_of::<*const u8>())
                                .cast::<usize>();
                            let len7 = l6;
                            let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7);
                            (
                                super::super::super::wasi::filesystem::types::Descriptor::from_handle(
                                    l4 as u32,
                                ),
                                _rt::string_lift(bytes7),
                            )
                        };
                        result8.push(e8);
                    }
                    _rt::cabi_dealloc(
                        base8,
                        len8 * (3 * ::core::mem::size_of::<*const u8>()),
                        ::core::mem::size_of::<*const u8>(),
                    );
                    let result9 = result8;
                    result9
                }
            }
        }
    }
    pub mod random {
        /// WASI Random is a random data API.
        ///
        /// It is intended to be portable at least between Unix-family platforms and
        /// Windows.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod random {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            #[allow(unused_unsafe, clippy::all)]
            /// Return up to `max-len` cryptographically-secure random or pseudo-random
            /// bytes.
            ///
            /// This function must produce data at least as cryptographically secure and
            /// fast as an adequately seeded cryptographically-secure pseudo-random
            /// number generator (CSPRNG). It must not block, from the perspective of
            /// the calling program, under any circumstances, including on the first
            /// request and on requests for numbers of bytes. The returned data must
            /// always be unpredictable.
            ///
            /// Implementations MAY return fewer bytes than requested (a short read).
            /// Callers that require exactly `max-len` bytes MUST call this function in
            /// a loop until the desired number of bytes has been accumulated.
            /// Implementations MUST return at least 1 byte when `max-len` is greater
            /// than zero. When `max-len` is zero, implementations MUST return an empty
            /// list without trapping.
            ///
            /// This function must always return fresh data. Deterministic environments
            /// must omit this function, rather than implementing it with deterministic
            /// data.
            #[allow(async_fn_in_trait)]
            pub fn get_random_bytes(max_len: u64) -> _rt::Vec<u8> {
                unsafe {
                    #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                    #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                    struct RetArea(
                        [::core::mem::MaybeUninit<
                            u8,
                        >; 2 * ::core::mem::size_of::<*const u8>()],
                    );
                    let mut ret_area = RetArea(
                        [::core::mem::MaybeUninit::uninit(); 2
                            * ::core::mem::size_of::<*const u8>()],
                    );
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:random/random@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-random-bytes"]
                        fn wit_import1(_: i64, _: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: i64, _: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(_rt::as_i64(&max_len), ptr0);
                    let l2 = *ptr0.add(0).cast::<*mut u8>();
                    let l3 = *ptr0
                        .add(::core::mem::size_of::<*const u8>())
                        .cast::<usize>();
                    let len4 = l3;
                    let result5 = <_ as From<
                        _rt::Vec<_>,
                    >>::from(_rt::Vec::from_raw_parts(l2.cast(), len4, len4));
                    result5
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Return a cryptographically-secure random or pseudo-random `u64` value.
            ///
            /// This function returns the same type of data as `get-random-bytes`,
            /// represented as a `u64`.
            #[allow(async_fn_in_trait)]
            pub fn get_random_u64() -> u64 {
                unsafe {
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:random/random@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-random-u64"]
                        fn wit_import0() -> i64;
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import0() -> i64 {
                        unreachable!()
                    }
                    let ret = wit_import0();
                    ret as u64
                }
            }
        }
        /// The insecure interface for insecure pseudo-random numbers.
        ///
        /// It is intended to be portable at least between Unix-family platforms and
        /// Windows.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod insecure {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            #[allow(unused_unsafe, clippy::all)]
            /// Return up to `max-len` insecure pseudo-random bytes.
            ///
            /// This function is not cryptographically secure. Do not use it for
            /// anything related to security.
            ///
            /// There are no requirements on the values of the returned bytes, however
            /// implementations are encouraged to return evenly distributed values with
            /// a long period.
            ///
            /// Implementations MAY return fewer bytes than requested (a short read).
            /// Callers that require exactly `max-len` bytes MUST call this function in
            /// a loop until the desired number of bytes has been accumulated.
            /// Implementations MUST return at least 1 byte when `max-len` is greater
            /// than zero. When `max-len` is zero, implementations MUST return an empty
            /// list without trapping.
            #[allow(async_fn_in_trait)]
            pub fn get_insecure_random_bytes(max_len: u64) -> _rt::Vec<u8> {
                unsafe {
                    #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                    #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                    struct RetArea(
                        [::core::mem::MaybeUninit<
                            u8,
                        >; 2 * ::core::mem::size_of::<*const u8>()],
                    );
                    let mut ret_area = RetArea(
                        [::core::mem::MaybeUninit::uninit(); 2
                            * ::core::mem::size_of::<*const u8>()],
                    );
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:random/insecure@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-insecure-random-bytes"]
                        fn wit_import1(_: i64, _: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: i64, _: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(_rt::as_i64(&max_len), ptr0);
                    let l2 = *ptr0.add(0).cast::<*mut u8>();
                    let l3 = *ptr0
                        .add(::core::mem::size_of::<*const u8>())
                        .cast::<usize>();
                    let len4 = l3;
                    let result5 = <_ as From<
                        _rt::Vec<_>,
                    >>::from(_rt::Vec::from_raw_parts(l2.cast(), len4, len4));
                    result5
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Return an insecure pseudo-random `u64` value.
            ///
            /// This function returns the same type of pseudo-random data as
            /// `get-insecure-random-bytes`, represented as a `u64`.
            #[allow(async_fn_in_trait)]
            pub fn get_insecure_random_u64() -> u64 {
                unsafe {
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:random/insecure@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-insecure-random-u64"]
                        fn wit_import0() -> i64;
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import0() -> i64 {
                        unreachable!()
                    }
                    let ret = wit_import0();
                    ret as u64
                }
            }
        }
        /// The insecure-seed interface for seeding hash-map DoS resistance.
        ///
        /// It is intended to be portable at least between Unix-family platforms and
        /// Windows.
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod insecure_seed {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            #[allow(unused_unsafe, clippy::all)]
            /// Return a 128-bit value that may contain a pseudo-random value.
            ///
            /// The returned value is not required to be computed from a CSPRNG, and may
            /// even be entirely deterministic. Host implementations are encouraged to
            /// provide pseudo-random values to any program exposed to
            /// attacker-controlled content, to enable DoS protection built into many
            /// languages' hash-map implementations.
            ///
            /// This function is intended to only be called once, by a source language
            /// to initialize Denial Of Service (DoS) protection in its hash-map
            /// implementation.
            ///
            /// # Expected future evolution
            ///
            /// This will likely be changed to a value import, to prevent it from being
            /// called multiple times and potentially used for purposes other than DoS
            /// protection.
            #[allow(async_fn_in_trait)]
            pub fn get_insecure_seed() -> (u64, u64) {
                unsafe {
                    #[repr(align(8))]
                    struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
                    let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]);
                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:random/insecure-seed@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "get-insecure-seed"]
                        fn wit_import1(_: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import1(_: *mut u8) {
                        unreachable!()
                    }
                    wit_import1(ptr0);
                    let l2 = *ptr0.add(0).cast::<i64>();
                    let l3 = *ptr0.add(8).cast::<i64>();
                    let result4 = (l2 as u64, l3 as u64);
                    result4
                }
            }
        }
    }
    pub mod sockets {
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod types {
            #[used]
            #[doc(hidden)]
            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::clocks::types::Duration;
            /// 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:
            /// - `other`
            /// - `access-denied`
            /// - `not-supported`
            /// - `out-of-memory`
            ///
            /// See each individual API for what the POSIX equivalents are. They sometimes differ per API.
            #[derive(Clone)]
            pub enum ErrorCode {
                /// Access denied.
                ///
                /// POSIX equivalent: EACCES, EPERM
                AccessDenied,
                /// The operation is not supported.
                ///
                /// POSIX equivalent: EOPNOTSUPP, ENOPROTOOPT, EPFNOSUPPORT, EPROTONOSUPPORT, ESOCKTNOSUPPORT
                NotSupported,
                /// One of the arguments is invalid.
                ///
                /// POSIX equivalent: EINVAL, EDESTADDRREQ, EAFNOSUPPORT
                InvalidArgument,
                /// Not enough memory to complete the operation.
                ///
                /// POSIX equivalent: ENOMEM, ENOBUFS
                OutOfMemory,
                /// The operation timed out before it could finish completely.
                ///
                /// POSIX equivalent: ETIMEDOUT
                Timeout,
                /// The operation is not valid in the socket's current state.
                InvalidState,
                /// The local address is not available.
                ///
                /// POSIX equivalent: EADDRNOTAVAIL
                AddressNotBindable,
                /// A bind operation failed because the provided address is already in
                /// use or because there are no ephemeral ports available.
                ///
                /// POSIX equivalent: EADDRINUSE
                AddressInUse,
                /// The remote address is not reachable.
                ///
                /// POSIX equivalent: EHOSTUNREACH, EHOSTDOWN, ENETDOWN, ENETUNREACH, ENONET
                RemoteUnreachable,
                /// The connection was forcefully rejected.
                ///
                /// POSIX equivalent: ECONNREFUSED
                ConnectionRefused,
                /// A write failed because the connection was broken.
                ///
                /// POSIX equivalent: EPIPE
                ConnectionBroken,
                /// The connection was reset.
                ///
                /// POSIX equivalent: ECONNRESET
                ConnectionReset,
                /// The connection was aborted.
                ///
                /// POSIX equivalent: ECONNABORTED
                ConnectionAborted,
                /// The size of a datagram sent to a UDP socket exceeded the maximum
                /// supported size.
                ///
                /// POSIX equivalent: EMSGSIZE
                DatagramTooLarge,
                /// A catch-all for errors not captured by the existing variants.
                /// Implementations can use this to extend the error type without
                /// breaking existing code.
                Other(Option<_rt::String>),
            }
            impl ::core::fmt::Debug for ErrorCode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        ErrorCode::AccessDenied => {
                            f.debug_tuple("ErrorCode::AccessDenied").finish()
                        }
                        ErrorCode::NotSupported => {
                            f.debug_tuple("ErrorCode::NotSupported").finish()
                        }
                        ErrorCode::InvalidArgument => {
                            f.debug_tuple("ErrorCode::InvalidArgument").finish()
                        }
                        ErrorCode::OutOfMemory => {
                            f.debug_tuple("ErrorCode::OutOfMemory").finish()
                        }
                        ErrorCode::Timeout => {
                            f.debug_tuple("ErrorCode::Timeout").finish()
                        }
                        ErrorCode::InvalidState => {
                            f.debug_tuple("ErrorCode::InvalidState").finish()
                        }
                        ErrorCode::AddressNotBindable => {
                            f.debug_tuple("ErrorCode::AddressNotBindable").finish()
                        }
                        ErrorCode::AddressInUse => {
                            f.debug_tuple("ErrorCode::AddressInUse").finish()
                        }
                        ErrorCode::RemoteUnreachable => {
                            f.debug_tuple("ErrorCode::RemoteUnreachable").finish()
                        }
                        ErrorCode::ConnectionRefused => {
                            f.debug_tuple("ErrorCode::ConnectionRefused").finish()
                        }
                        ErrorCode::ConnectionBroken => {
                            f.debug_tuple("ErrorCode::ConnectionBroken").finish()
                        }
                        ErrorCode::ConnectionReset => {
                            f.debug_tuple("ErrorCode::ConnectionReset").finish()
                        }
                        ErrorCode::ConnectionAborted => {
                            f.debug_tuple("ErrorCode::ConnectionAborted").finish()
                        }
                        ErrorCode::DatagramTooLarge => {
                            f.debug_tuple("ErrorCode::DatagramTooLarge").finish()
                        }
                        ErrorCode::Other(e) => {
                            f.debug_tuple("ErrorCode::Other").field(e).finish()
                        }
                    }
                }
            }
            impl ::core::fmt::Display for ErrorCode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    write!(f, "{:?}", self)
                }
            }
            #[cfg(feature = "std")]
            impl ::core::error::Error for ErrorCode {}
            #[repr(u8)]
            #[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 {
                    match self {
                        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 unsafe { ::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)]
            pub enum IpAddress {
                Ipv4(Ipv4Address),
                Ipv6(Ipv6Address),
            }
            impl ::core::fmt::Debug for IpAddress {
                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()
                        }
                    }
                }
            }
            #[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 {
                    f.debug_struct("Ipv4SocketAddress")
                        .field("port", &self.port)
                        .field("address", &self.address)
                        .finish()
                }
            }
            #[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 {
                    f.debug_struct("Ipv6SocketAddress")
                        .field("port", &self.port)
                        .field("flow-info", &self.flow_info)
                        .field("address", &self.address)
                        .field("scope-id", &self.scope_id)
                        .finish()
                }
            }
            #[derive(Clone, Copy)]
            pub enum IpSocketAddress {
                Ipv4(Ipv4SocketAddress),
                Ipv6(Ipv6SocketAddress),
            }
            impl ::core::fmt::Debug for IpSocketAddress {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        IpSocketAddress::Ipv4(e) => {
                            f.debug_tuple("IpSocketAddress::Ipv4").field(e).finish()
                        }
                        IpSocketAddress::Ipv6(e) => {
                            f.debug_tuple("IpSocketAddress::Ipv6").field(e).finish()
                        }
                    }
                }
            }
            /// A TCP socket resource.
            ///
            /// The socket can be in one of the following states:
            /// - `unbound`
            /// - `bound` (See note below)
            /// - `listening`
            /// - `connecting`
            /// - `connected`
            /// - `closed`
            /// See <https://github.com/WebAssembly/WASI/blob/main/proposals/sockets/TcpSocketOperationalSemantics-0.3.0-draft.md>
            /// for 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`, `listening`, `connecting` or `connected`)
            ///
            /// WASI uses shared ownership semantics: the `tcp-socket` handle and all
            /// derived `stream` and `future` values reference a single underlying OS
            /// socket:
            /// - Send/receive streams remain functional after the original `tcp-socket`
            ///   handle is dropped.
            /// - The stream returned by `listen` behaves similarly.
            /// - Client sockets returned by `tcp-socket::listen` are independent and do
            ///   not keep the listening socket alive.
            ///
            /// The OS socket is closed only after the last handle is dropped. This
            /// model has observable effects; for example, it affects when the local
            /// port binding is released.
            ///
            /// In addition to the general error codes documented on the
            /// `types::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<TcpSocket>,
            }
            impl TcpSocket {
                #[doc(hidden)]
                pub unsafe fn from_handle(handle: u32) -> Self {
                    Self {
                        handle: unsafe { _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 TcpSocket {
                #[inline]
                unsafe fn drop(_handle: u32) {
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "[resource-drop]tcp-socket"]
                        fn drop(_: i32);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn drop(_: i32) {
                        unreachable!()
                    }
                    unsafe {
                        drop(_handle as i32);
                    }
                }
            }
            /// A UDP socket handle.
            #[derive(Debug)]
            #[repr(transparent)]
            pub struct UdpSocket {
                handle: _rt::Resource<UdpSocket>,
            }
            impl UdpSocket {
                #[doc(hidden)]
                pub unsafe fn from_handle(handle: u32) -> Self {
                    Self {
                        handle: unsafe { _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 UdpSocket {
                #[inline]
                unsafe fn drop(_handle: u32) {
                    #[cfg(target_arch = "wasm32")]
                    #[link(
                        wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                    )]
                    unsafe extern "C" {
                        #[link_name = "[resource-drop]udp-socket"]
                        fn drop(_: i32);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn drop(_: i32) {
                        unreachable!()
                    }
                    unsafe {
                        drop(_handle as i32);
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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.
                ///
                /// Unlike POSIX, WASI sockets have no notion of a socket-level
                /// `O_NONBLOCK` flag. Instead they fully rely on the Component Model's
                /// async support.
                ///
                /// # Typical errors
                /// - `not-supported`: The `address-family` is not supported. (EAFNOSUPPORT)
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
                /// - <https://man7.org/linux/man-pages/man2/socket.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
                #[allow(async_fn_in_trait)]
                pub fn create(
                    address_family: IpAddressFamily,
                ) -> Result<TcpSocket, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[static]tcp-socket.create"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1(address_family.clone() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<i32>();
                                    TcpSocket::from_handle(l3 as u32)
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Bind the socket to 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 can be bound to. (EADDRNOTAVAIL)
                ///
                /// # Implementors note
                /// The 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.
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
                /// - <https://man7.org/linux/man-pages/man2/bind.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
                #[allow(async_fn_in_trait)]
                pub fn bind(
                    &self,
                    local_address: IpSocketAddress,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let (
                            result4_0,
                            result4_1,
                            result4_2,
                            result4_3,
                            result4_4,
                            result4_5,
                            result4_6,
                            result4_7,
                            result4_8,
                            result4_9,
                            result4_10,
                            result4_11,
                        ) = match local_address {
                            IpSocketAddress::Ipv4(e) => {
                                let Ipv4SocketAddress { port: port0, address: address0 } = e;
                                let (t1_0, t1_1, t1_2, t1_3) = address0;
                                (
                                    0i32,
                                    _rt::as_i32(port0),
                                    _rt::as_i32(t1_0),
                                    _rt::as_i32(t1_1),
                                    _rt::as_i32(t1_2),
                                    _rt::as_i32(t1_3),
                                    0i32,
                                    0i32,
                                    0i32,
                                    0i32,
                                    0i32,
                                    0i32,
                                )
                            }
                            IpSocketAddress::Ipv6(e) => {
                                let Ipv6SocketAddress {
                                    port: port2,
                                    flow_info: flow_info2,
                                    address: address2,
                                    scope_id: scope_id2,
                                } = e;
                                let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2;
                                (
                                    1i32,
                                    _rt::as_i32(port2),
                                    _rt::as_i32(flow_info2),
                                    _rt::as_i32(t3_0),
                                    _rt::as_i32(t3_1),
                                    _rt::as_i32(t3_2),
                                    _rt::as_i32(t3_3),
                                    _rt::as_i32(t3_4),
                                    _rt::as_i32(t3_5),
                                    _rt::as_i32(t3_6),
                                    _rt::as_i32(t3_7),
                                    _rt::as_i32(scope_id2),
                                )
                            }
                        };
                        let ptr5 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.bind"]
                            fn wit_import6(
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: *mut u8,
                            );
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import6(
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: *mut u8,
                        ) {
                            unreachable!()
                        }
                        wit_import6(
                            (self).handle() as i32,
                            result4_0,
                            result4_1,
                            result4_2,
                            result4_3,
                            result4_4,
                            result4_5,
                            result4_6,
                            result4_7,
                            result4_8,
                            result4_9,
                            result4_10,
                            result4_11,
                            ptr5,
                        );
                        let l7 = i32::from(*ptr5.add(0).cast::<u8>());
                        let result14 = match l7 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l8 = i32::from(
                                        *ptr5.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v13 = match l8 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e13 = {
                                                let l9 = i32::from(
                                                    *ptr5
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l9 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l10 = *ptr5
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l11 = *ptr5
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len12 = l11;
                                                            let bytes12 = _rt::Vec::from_raw_parts(
                                                                l10.cast(),
                                                                len12,
                                                                len12,
                                                            );
                                                            _rt::string_lift(bytes12)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e13)
                                        }
                                    };
                                    v13
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result14
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Connect to a remote endpoint.
                ///
                /// On success, the socket is transitioned into the `connected` state
                /// and 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`. If the socket was not already explicitly
                /// bound, this function will implicitly bind the socket to a random
                /// free port.
                ///
                /// 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-state`:             The socket is already in the `connecting` state. (EALREADY)
                /// - `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)
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
                /// - <https://man7.org/linux/man-pages/man2/connect.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
                /// - <https://man.freebsd.org/cgi/man.cgi?connect>
                #[allow(async_fn_in_trait)]
                pub async fn connect(
                    &self,
                    remote_address: IpSocketAddress,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(*mut u8);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a TcpSocket, IpSocketAddress);
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (32 + 6 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                (32 + 1 * ::core::mem::size_of::<*const u8>())
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]tcp-socket.connect"]
                                    fn call(_: *mut u8, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: *mut u8, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                let _param_ptr = unsafe { _ptr.add(0) };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower0).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe { _ptr.add(4) };
                                unsafe {
                                    match _lower1 {
                                        IpSocketAddress::Ipv4(e) => {
                                            *_param_ptr.add(0).cast::<u8>() = (0i32) as u8;
                                            let Ipv4SocketAddress { port: port0, address: address0 } = e;
                                            *_param_ptr.add(4).cast::<u16>() = (_rt::as_i32(port0))
                                                as u16;
                                            let (t1_0, t1_1, t1_2, t1_3) = address0;
                                            *_param_ptr.add(6).cast::<u8>() = (_rt::as_i32(t1_0)) as u8;
                                            *_param_ptr.add(7).cast::<u8>() = (_rt::as_i32(t1_1)) as u8;
                                            *_param_ptr.add(8).cast::<u8>() = (_rt::as_i32(t1_2)) as u8;
                                            *_param_ptr.add(9).cast::<u8>() = (_rt::as_i32(t1_3)) as u8;
                                        }
                                        IpSocketAddress::Ipv6(e) => {
                                            *_param_ptr.add(0).cast::<u8>() = (1i32) as u8;
                                            let Ipv6SocketAddress {
                                                port: port2,
                                                flow_info: flow_info2,
                                                address: address2,
                                                scope_id: scope_id2,
                                            } = e;
                                            *_param_ptr.add(4).cast::<u16>() = (_rt::as_i32(port2))
                                                as u16;
                                            *_param_ptr.add(8).cast::<i32>() = _rt::as_i32(flow_info2);
                                            let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2;
                                            *_param_ptr.add(12).cast::<u16>() = (_rt::as_i32(t3_0))
                                                as u16;
                                            *_param_ptr.add(14).cast::<u16>() = (_rt::as_i32(t3_1))
                                                as u16;
                                            *_param_ptr.add(16).cast::<u16>() = (_rt::as_i32(t3_2))
                                                as u16;
                                            *_param_ptr.add(18).cast::<u16>() = (_rt::as_i32(t3_3))
                                                as u16;
                                            *_param_ptr.add(20).cast::<u16>() = (_rt::as_i32(t3_4))
                                                as u16;
                                            *_param_ptr.add(22).cast::<u16>() = (_rt::as_i32(t3_5))
                                                as u16;
                                            *_param_ptr.add(24).cast::<u16>() = (_rt::as_i32(t3_6))
                                                as u16;
                                            *_param_ptr.add(26).cast::<u16>() = (_rt::as_i32(t3_7))
                                                as u16;
                                            *_param_ptr.add(28).cast::<i32>() = _rt::as_i32(scope_id2);
                                        }
                                    }
                                }
                                ParamsLower(_ptr)
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::AccessDenied,
                                                    1 => ErrorCode::NotSupported,
                                                    2 => ErrorCode::InvalidArgument,
                                                    3 => ErrorCode::OutOfMemory,
                                                    4 => ErrorCode::Timeout,
                                                    5 => ErrorCode::InvalidState,
                                                    6 => ErrorCode::AddressNotBindable,
                                                    7 => ErrorCode::AddressInUse,
                                                    8 => ErrorCode::RemoteUnreachable,
                                                    9 => ErrorCode::ConnectionRefused,
                                                    10 => ErrorCode::ConnectionBroken,
                                                    11 => ErrorCode::ConnectionReset,
                                                    12 => ErrorCode::ConnectionAborted,
                                                    13 => ErrorCode::DatagramTooLarge,
                                                    n => {
                                                        debug_assert_eq!(n, 14, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, remote_address))
                            .await
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Start listening and return a stream of new inbound connections.
                ///
                /// Transitions the socket into the `listening` state. This can be called
                /// at most once per socket.
                ///
                /// If the socket is not already explicitly bound, this function will
                /// implicitly bind the socket to a random free port.
                ///
                /// Normally, the returned sockets are bound, in the `connected` state
                /// and immediately ready for I/O. Though, depending on exact timing and
                /// circumstances, a newly accepted connection may already be `closed`
                /// by the time the server attempts to perform its first I/O on it. This
                /// is true regardless of whether the WASI implementation uses
                /// "synthesized" sockets or not (see Implementors Notes below).
                ///
                /// 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`
                ///
                /// # Typical errors
                /// - `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)
                ///
                /// # Implementors note
                /// This method returns a single perpetual stream that should only close
                /// on fatal errors (if any). Yet, the POSIX' `accept` function may also
                /// return transient errors (e.g. ECONNABORTED). The exact details differ
                /// per operation system. For example, the Linux manual mentions:
                ///
                /// > Linux accept() passes already-pending network errors on the new
                /// > socket as an error code from accept(). This behavior differs from
                /// > other BSD socket implementations. For reliable operation the
                /// > application should detect the network errors defined for the
                /// > protocol after accept() and treat them like EAGAIN by retrying.
                /// > In the case of TCP/IP, these are ENETDOWN, EPROTO, ENOPROTOOPT,
                /// > EHOSTDOWN, ENONET, EHOSTUNREACH, EOPNOTSUPP, and ENETUNREACH.
                /// Source: https://man7.org/linux/man-pages/man2/accept.2.html
                ///
                /// WASI implementations have two options to handle this:
                /// - Optionally log it and then skip over non-fatal errors returned by
                ///   `accept`. Guest code never gets to see these failures. Or:
                /// - Synthesize a `tcp-socket` resource that exposes the error when
                ///   attempting to send or receive on it. Guest code then sees these
                ///   failures as regular I/O errors.
                ///
                /// In either case, the stream returned by this `listen` method remains
                /// operational.
                ///
                /// WASI requires `listen` to perform an implicit bind if the socket
                /// has not already been bound. Not all platforms (notably Windows)
                /// exhibit this behavior out of the box. On platforms that require it,
                /// the WASI implementation can emulate this behavior by performing
                /// the bind itself if the guest hasn't already done so.
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html>
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html>
                /// - <https://man7.org/linux/man-pages/man2/listen.2.html>
                /// - <https://man7.org/linux/man-pages/man2/accept.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2>
                #[allow(async_fn_in_trait)]
                pub fn listen(
                    &self,
                ) -> Result<
                    wit_bindgen::rt::async_support::StreamReader<TcpSocket>,
                    ErrorCode,
                > {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.listen"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<i32>();
                                    wit_bindgen::rt::async_support::StreamReader::new(
                                        l3 as u32,
                                        &<TcpSocket as super::super::super::wit_stream::StreamPayload>::VTABLE,
                                    )
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Transmit data to peer.
                ///
                /// The caller should close the stream when it has no more data to send
                /// to the peer. Under normal circumstances this will cause a FIN packet
                /// to be sent out. Closing the stream is equivalent to calling
                /// `shutdown(SHUT_WR)` in POSIX.
                ///
                /// This function may be called at most once and returns once the full
                /// contents of the stream are transmitted or an error is encountered.
                ///
                /// # Typical errors
                /// - `invalid-state`:             The socket is not in the `connected` state. (ENOTCONN)
                /// - `invalid-state`:             `send` has already been called on this socket.
                /// - `connection-broken`:         The connection is not writable anymore. (EPIPE, ECONNABORTED on Windows)
                /// - `connection-reset`:          The connection was reset. (ECONNRESET)
                /// - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
                ///
                ///  # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html>
                /// - <https://man7.org/linux/man-pages/man2/send.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
                #[allow(async_fn_in_trait)]
                pub fn send(
                    &self,
                    data: wit_bindgen::rt::async_support::StreamReader<u8>,
                ) -> wit_bindgen::rt::async_support::FutureReader<
                    Result<(), ErrorCode>,
                > {
                    unsafe {
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.send"]
                            fn wit_import0(_: i32, _: i32) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import0(_: i32, _: i32) -> i32 {
                            unreachable!()
                        }
                        let ret = wit_import0(
                            (self).handle() as i32,
                            (&data).take_handle() as i32,
                        );
                        wit_bindgen::rt::async_support::FutureReader::new(
                            ret as u32,
                            &<Result<
                                (),
                                ErrorCode,
                            > as super::super::super::wit_future::FuturePayload>::VTABLE,
                        )
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Read data from peer.
                ///
                /// Returns a `stream` of data sent by the peer. The implementation
                /// drops the stream once no more data is available. At that point, the
                /// returned `future` resolves to:
                /// - `ok` after a graceful shutdown from the peer (i.e. a FIN packet), or
                /// - `err` if the socket was closed abnormally.
                ///
                /// `receive` may be called only once per socket. Subsequent calls return
                /// a closed stream and a future resolved to `err(invalid-state)`.
                ///
                /// If the caller is not expecting to receive any more data from the peer,
                /// they should drop the stream. Any data still in the receive queue
                /// will be discarded. This is equivalent to calling `shutdown(SHUT_RD)`
                /// in POSIX.
                ///
                /// # Typical errors
                /// - `invalid-state`:             The socket is not in the `connected` state. (ENOTCONN)
                /// - `invalid-state`:             `receive` has already been called on this socket.
                /// - `connection-reset`:          The connection was reset. (ECONNRESET)
                /// - `remote-unreachable`:        The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html>
                /// - <https://man7.org/linux/man-pages/man2/recv.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
                #[allow(async_fn_in_trait)]
                pub fn receive(
                    &self,
                ) -> (
                    wit_bindgen::rt::async_support::StreamReader<u8>,
                    wit_bindgen::rt::async_support::FutureReader<Result<(), ErrorCode>>,
                ) {
                    unsafe {
                        #[repr(align(4))]
                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 8],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.receive"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = *ptr0.add(0).cast::<i32>();
                        let l3 = *ptr0.add(4).cast::<i32>();
                        let result4 = (
                            wit_bindgen::rt::async_support::StreamReader::new(
                                l2 as u32,
                                &<u8 as super::super::super::wit_stream::StreamPayload>::VTABLE,
                            ),
                            wit_bindgen::rt::async_support::FutureReader::new(
                                l3 as u32,
                                &<Result<
                                    (),
                                    ErrorCode,
                                > as super::super::super::wit_future::FuturePayload>::VTABLE,
                            ),
                        );
                        result4
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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 `get-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
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
                /// - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
                /// - <https://man.freebsd.org/cgi/man.cgi?getsockname>
                #[allow(async_fn_in_trait)]
                pub fn get_local_address(&self) -> Result<IpSocketAddress, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 32 + 1 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 32
                                + 1 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-local-address"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result27 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v20 = match l3 {
                                        0 => {
                                            let e20 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(4 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(6 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l6 = i32::from(
                                                    *ptr0
                                                        .add(7 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l7 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l8 = i32::from(
                                                    *ptr0
                                                        .add(9 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                Ipv4SocketAddress {
                                                    port: l4 as u16,
                                                    address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8),
                                                }
                                            };
                                            IpSocketAddress::Ipv4(e20)
                                        }
                                        n => {
                                            debug_assert_eq!(n, 1, "invalid enum discriminant");
                                            let e20 = {
                                                let l9 = i32::from(
                                                    *ptr0
                                                        .add(4 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l10 = *ptr0
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i32>();
                                                let l11 = i32::from(
                                                    *ptr0
                                                        .add(12 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l12 = i32::from(
                                                    *ptr0
                                                        .add(14 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l13 = i32::from(
                                                    *ptr0
                                                        .add(16 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l14 = i32::from(
                                                    *ptr0
                                                        .add(18 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l15 = i32::from(
                                                    *ptr0
                                                        .add(20 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l16 = i32::from(
                                                    *ptr0
                                                        .add(22 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l17 = i32::from(
                                                    *ptr0
                                                        .add(24 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l18 = i32::from(
                                                    *ptr0
                                                        .add(26 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l19 = *ptr0
                                                    .add(28 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i32>();
                                                Ipv6SocketAddress {
                                                    port: l9 as u16,
                                                    flow_info: l10 as u32,
                                                    address: (
                                                        l11 as u16,
                                                        l12 as u16,
                                                        l13 as u16,
                                                        l14 as u16,
                                                        l15 as u16,
                                                        l16 as u16,
                                                        l17 as u16,
                                                        l18 as u16,
                                                    ),
                                                    scope_id: l19 as u32,
                                                }
                                            };
                                            IpSocketAddress::Ipv6(e20)
                                        }
                                    };
                                    v20
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l21 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v26 = match l21 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e26 = {
                                                let l22 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l22 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l23 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l24 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len25 = l24;
                                                            let bytes25 = _rt::Vec::from_raw_parts(
                                                                l23.cast(),
                                                                len25,
                                                                len25,
                                                            );
                                                            _rt::string_lift(bytes25)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e26)
                                        }
                                    };
                                    v26
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result27
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Get the remote address.
                ///
                /// # Typical errors
                /// - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN)
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
                /// - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
                #[allow(async_fn_in_trait)]
                pub fn get_remote_address(&self) -> Result<IpSocketAddress, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 32 + 1 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 32
                                + 1 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-remote-address"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result27 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v20 = match l3 {
                                        0 => {
                                            let e20 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(4 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(6 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l6 = i32::from(
                                                    *ptr0
                                                        .add(7 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l7 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l8 = i32::from(
                                                    *ptr0
                                                        .add(9 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                Ipv4SocketAddress {
                                                    port: l4 as u16,
                                                    address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8),
                                                }
                                            };
                                            IpSocketAddress::Ipv4(e20)
                                        }
                                        n => {
                                            debug_assert_eq!(n, 1, "invalid enum discriminant");
                                            let e20 = {
                                                let l9 = i32::from(
                                                    *ptr0
                                                        .add(4 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l10 = *ptr0
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i32>();
                                                let l11 = i32::from(
                                                    *ptr0
                                                        .add(12 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l12 = i32::from(
                                                    *ptr0
                                                        .add(14 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l13 = i32::from(
                                                    *ptr0
                                                        .add(16 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l14 = i32::from(
                                                    *ptr0
                                                        .add(18 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l15 = i32::from(
                                                    *ptr0
                                                        .add(20 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l16 = i32::from(
                                                    *ptr0
                                                        .add(22 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l17 = i32::from(
                                                    *ptr0
                                                        .add(24 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l18 = i32::from(
                                                    *ptr0
                                                        .add(26 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l19 = *ptr0
                                                    .add(28 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i32>();
                                                Ipv6SocketAddress {
                                                    port: l9 as u16,
                                                    flow_info: l10 as u32,
                                                    address: (
                                                        l11 as u16,
                                                        l12 as u16,
                                                        l13 as u16,
                                                        l14 as u16,
                                                        l15 as u16,
                                                        l16 as u16,
                                                        l17 as u16,
                                                        l18 as u16,
                                                    ),
                                                    scope_id: l19 as u32,
                                                }
                                            };
                                            IpSocketAddress::Ipv6(e20)
                                        }
                                    };
                                    v20
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l21 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v26 = match l21 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e26 = {
                                                let l22 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l22 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l23 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l24 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len25 = l24;
                                                            let bytes25 = _rt::Vec::from_raw_parts(
                                                                l23.cast(),
                                                                len25,
                                                                len25,
                                                            );
                                                            _rt::string_lift(bytes25)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e26)
                                        }
                                    };
                                    v26
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result27
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Whether the socket is in the `listening` state.
                ///
                /// Equivalent to the SO_ACCEPTCONN socket option.
                #[allow(async_fn_in_trait)]
                pub fn get_is_listening(&self) -> bool {
                    unsafe {
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-is-listening"]
                            fn wit_import0(_: i32) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
                            unreachable!()
                        }
                        let ret = wit_import0((self).handle() as i32);
                        _rt::bool_lift(ret as u8)
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Whether this is a IPv4 or IPv6 socket.
                ///
                /// This is the value passed to the constructor.
                ///
                /// Equivalent to the SO_DOMAIN socket option.
                #[allow(async_fn_in_trait)]
                pub fn get_address_family(&self) -> IpAddressFamily {
                    unsafe {
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-address-family"]
                            fn wit_import0(_: i32) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
                            unreachable!()
                        }
                        let ret = wit_import0((self).handle() as i32);
                        IpAddressFamily::_lift(ret as u8)
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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 `connecting` or `connected` state.
                #[allow(async_fn_in_trait)]
                pub fn set_listen_backlog_size(
                    &self,
                    value: u64,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.set-listen-backlog-size"]
                            fn wit_import1(_: i32, _: i64, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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.
                #[allow(async_fn_in_trait)]
                pub fn get_keep_alive_enabled(&self) -> Result<bool, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-keep-alive-enabled"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    _rt::bool_lift(l3 as u8)
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_keep_alive_enabled(
                    &self,
                    value: bool,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.set-keep-alive-enabled"]
                            fn wit_import1(_: i32, _: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1(
                            (self).handle() as i32,
                            match &value {
                                true => 1,
                                false => 0,
                            },
                            ptr0,
                        );
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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.
                /// All other values are accepted without error, but may be
                /// clamped or rounded. As a result, the value read back from
                /// this setting may differ from the value that was set.
                ///
                /// Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS)
                ///
                /// # Typical errors
                /// - `invalid-argument`:     (set) The provided value was 0.
                #[allow(async_fn_in_trait)]
                pub fn get_keep_alive_idle_time(&self) -> Result<Duration, ErrorCode> {
                    unsafe {
                        #[repr(align(8))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 8 + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 8
                                + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-keep-alive-idle-time"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0.add(8).cast::<i64>();
                                    l3 as u64
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(*ptr0.add(8).cast::<u8>());
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_keep_alive_idle_time(
                    &self,
                    value: Duration,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.set-keep-alive-idle-time"]
                            fn wit_import1(_: i32, _: i64, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// The time between keepalive packets.
                ///
                /// If the provided value is 0, an `invalid-argument` error is returned.
                /// All other values are accepted without error, but may be
                /// clamped or rounded. As a result, the value read back from
                /// this setting may differ from the value that was set.
                ///
                /// Equivalent to the TCP_KEEPINTVL socket option.
                ///
                /// # Typical errors
                /// - `invalid-argument`:     (set) The provided value was 0.
                #[allow(async_fn_in_trait)]
                pub fn get_keep_alive_interval(&self) -> Result<Duration, ErrorCode> {
                    unsafe {
                        #[repr(align(8))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 8 + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 8
                                + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-keep-alive-interval"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0.add(8).cast::<i64>();
                                    l3 as u64
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(*ptr0.add(8).cast::<u8>());
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_keep_alive_interval(
                    &self,
                    value: Duration,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.set-keep-alive-interval"]
                            fn wit_import1(_: i32, _: i64, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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.
                /// All other values are accepted without error, but may be
                /// clamped or rounded. As a result, the value read back from
                /// this setting may differ from the value that was set.
                ///
                /// Equivalent to the TCP_KEEPCNT socket option.
                ///
                /// # Typical errors
                /// - `invalid-argument`:     (set) The provided value was 0.
                #[allow(async_fn_in_trait)]
                pub fn get_keep_alive_count(&self) -> Result<u32, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-keep-alive-count"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<i32>();
                                    l3 as u32
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_keep_alive_count(&self, value: u32) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.set-keep-alive-count"]
                            fn wit_import1(_: i32, _: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i32(&value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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.
                #[allow(async_fn_in_trait)]
                pub fn get_hop_limit(&self) -> Result<u8, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-hop-limit"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    l3 as u8
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_hop_limit(&self, value: u8) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.set-hop-limit"]
                            fn wit_import1(_: i32, _: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i32(&value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Kernel buffer space reserved for sending/receiving on this socket.
                /// Implementations usually treat this as a cap the buffer can grow to,
                /// rather than allocating the full amount immediately.
                ///
                /// If the provided value is 0, an `invalid-argument` error is returned.
                /// All other values are accepted without error, but may be
                /// clamped or rounded. As a result, the value read back from
                /// this setting may differ from the value that was set.
                ///
                /// This is only a performance hint. The implementation may ignore it or
                /// tweak it based on real traffic patterns.
                /// Linux and macOS appear to behave differently depending on whether a
                /// buffer size was explicitly set. When set, they tend to honor it; when
                /// not set, they dynamically adjust the buffer size as the connection
                /// progresses. This is especially noticeable when comparing the values
                /// from before and after connection establishment.
                ///
                /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
                ///
                /// # Typical errors
                /// - `invalid-argument`:     (set) The provided value was 0.
                #[allow(async_fn_in_trait)]
                pub fn get_receive_buffer_size(&self) -> Result<u64, ErrorCode> {
                    unsafe {
                        #[repr(align(8))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 8 + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 8
                                + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-receive-buffer-size"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0.add(8).cast::<i64>();
                                    l3 as u64
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(*ptr0.add(8).cast::<u8>());
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_receive_buffer_size(
                    &self,
                    value: u64,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.set-receive-buffer-size"]
                            fn wit_import1(_: i32, _: i64, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn get_send_buffer_size(&self) -> Result<u64, ErrorCode> {
                    unsafe {
                        #[repr(align(8))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 8 + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 8
                                + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.get-send-buffer-size"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0.add(8).cast::<i64>();
                                    l3 as u64
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(*ptr0.add(8).cast::<u8>());
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl TcpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]tcp-socket.set-send-buffer-size"]
                            fn wit_import1(_: i32, _: i64, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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.
                ///
                /// Unlike POSIX, WASI sockets have no notion of a socket-level
                /// `O_NONBLOCK` flag. Instead they fully rely on the Component Model's
                /// async support.
                ///
                /// # References:
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
                /// - <https://man7.org/linux/man-pages/man2/socket.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
                #[allow(async_fn_in_trait)]
                pub fn create(
                    address_family: IpAddressFamily,
                ) -> Result<UdpSocket, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[static]udp-socket.create"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1(address_family.clone() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<i32>();
                                    UdpSocket::from_handle(l3 as u32)
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Bind the socket to 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 can be bound to. (EADDRNOTAVAIL)
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html>
                /// - <https://man7.org/linux/man-pages/man2/bind.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2&format=html>
                #[allow(async_fn_in_trait)]
                pub fn bind(
                    &self,
                    local_address: IpSocketAddress,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let (
                            result4_0,
                            result4_1,
                            result4_2,
                            result4_3,
                            result4_4,
                            result4_5,
                            result4_6,
                            result4_7,
                            result4_8,
                            result4_9,
                            result4_10,
                            result4_11,
                        ) = match local_address {
                            IpSocketAddress::Ipv4(e) => {
                                let Ipv4SocketAddress { port: port0, address: address0 } = e;
                                let (t1_0, t1_1, t1_2, t1_3) = address0;
                                (
                                    0i32,
                                    _rt::as_i32(port0),
                                    _rt::as_i32(t1_0),
                                    _rt::as_i32(t1_1),
                                    _rt::as_i32(t1_2),
                                    _rt::as_i32(t1_3),
                                    0i32,
                                    0i32,
                                    0i32,
                                    0i32,
                                    0i32,
                                    0i32,
                                )
                            }
                            IpSocketAddress::Ipv6(e) => {
                                let Ipv6SocketAddress {
                                    port: port2,
                                    flow_info: flow_info2,
                                    address: address2,
                                    scope_id: scope_id2,
                                } = e;
                                let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2;
                                (
                                    1i32,
                                    _rt::as_i32(port2),
                                    _rt::as_i32(flow_info2),
                                    _rt::as_i32(t3_0),
                                    _rt::as_i32(t3_1),
                                    _rt::as_i32(t3_2),
                                    _rt::as_i32(t3_3),
                                    _rt::as_i32(t3_4),
                                    _rt::as_i32(t3_5),
                                    _rt::as_i32(t3_6),
                                    _rt::as_i32(t3_7),
                                    _rt::as_i32(scope_id2),
                                )
                            }
                        };
                        let ptr5 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.bind"]
                            fn wit_import6(
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: *mut u8,
                            );
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import6(
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: *mut u8,
                        ) {
                            unreachable!()
                        }
                        wit_import6(
                            (self).handle() as i32,
                            result4_0,
                            result4_1,
                            result4_2,
                            result4_3,
                            result4_4,
                            result4_5,
                            result4_6,
                            result4_7,
                            result4_8,
                            result4_9,
                            result4_10,
                            result4_11,
                            ptr5,
                        );
                        let l7 = i32::from(*ptr5.add(0).cast::<u8>());
                        let result14 = match l7 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l8 = i32::from(
                                        *ptr5.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v13 = match l8 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e13 = {
                                                let l9 = i32::from(
                                                    *ptr5
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l9 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l10 = *ptr5
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l11 = *ptr5
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len12 = l11;
                                                            let bytes12 = _rt::Vec::from_raw_parts(
                                                                l10.cast(),
                                                                len12,
                                                                len12,
                                                            );
                                                            _rt::string_lift(bytes12)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e13)
                                        }
                                    };
                                    v13
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result14
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Associate this socket with a specific peer address.
                ///
                /// 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`. If the socket was not already explicitly
                /// bound, this function will implicitly bind the socket to a random
                /// free port.
                ///
                /// When a UDP socket is "connected", the `send` and `receive` methods
                /// are limited to communicating with that peer only:
                /// - `send` can only be used to send to this destination.
                /// - `receive` will only return datagrams sent from the provided `remote-address`.
                ///
                /// The name "connect" was kept to align with the existing POSIX
                /// terminology. Other than that, this function only changes the local
                /// socket configuration and does not generate any network traffic.
                /// The peer is not aware of this "connection".
                ///
                /// This method may be called multiple times on the same socket to change
                /// its association, but only the most recent one will be effective.
                ///
                /// # 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)
                /// - `address-in-use`:            Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD)
                ///
                /// # Implementors note
                /// If the socket is already connected, some platforms (e.g. Linux)
                /// require a disconnect before connecting to a different peer address.
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
                /// - <https://man7.org/linux/man-pages/man2/connect.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
                /// - <https://man.freebsd.org/cgi/man.cgi?connect>
                #[allow(async_fn_in_trait)]
                pub fn connect(
                    &self,
                    remote_address: IpSocketAddress,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let (
                            result4_0,
                            result4_1,
                            result4_2,
                            result4_3,
                            result4_4,
                            result4_5,
                            result4_6,
                            result4_7,
                            result4_8,
                            result4_9,
                            result4_10,
                            result4_11,
                        ) = match remote_address {
                            IpSocketAddress::Ipv4(e) => {
                                let Ipv4SocketAddress { port: port0, address: address0 } = e;
                                let (t1_0, t1_1, t1_2, t1_3) = address0;
                                (
                                    0i32,
                                    _rt::as_i32(port0),
                                    _rt::as_i32(t1_0),
                                    _rt::as_i32(t1_1),
                                    _rt::as_i32(t1_2),
                                    _rt::as_i32(t1_3),
                                    0i32,
                                    0i32,
                                    0i32,
                                    0i32,
                                    0i32,
                                    0i32,
                                )
                            }
                            IpSocketAddress::Ipv6(e) => {
                                let Ipv6SocketAddress {
                                    port: port2,
                                    flow_info: flow_info2,
                                    address: address2,
                                    scope_id: scope_id2,
                                } = e;
                                let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2;
                                (
                                    1i32,
                                    _rt::as_i32(port2),
                                    _rt::as_i32(flow_info2),
                                    _rt::as_i32(t3_0),
                                    _rt::as_i32(t3_1),
                                    _rt::as_i32(t3_2),
                                    _rt::as_i32(t3_3),
                                    _rt::as_i32(t3_4),
                                    _rt::as_i32(t3_5),
                                    _rt::as_i32(t3_6),
                                    _rt::as_i32(t3_7),
                                    _rt::as_i32(scope_id2),
                                )
                            }
                        };
                        let ptr5 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.connect"]
                            fn wit_import6(
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: i32,
                                _: *mut u8,
                            );
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import6(
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: i32,
                            _: *mut u8,
                        ) {
                            unreachable!()
                        }
                        wit_import6(
                            (self).handle() as i32,
                            result4_0,
                            result4_1,
                            result4_2,
                            result4_3,
                            result4_4,
                            result4_5,
                            result4_6,
                            result4_7,
                            result4_8,
                            result4_9,
                            result4_10,
                            result4_11,
                            ptr5,
                        );
                        let l7 = i32::from(*ptr5.add(0).cast::<u8>());
                        let result14 = match l7 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l8 = i32::from(
                                        *ptr5.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v13 = match l8 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e13 = {
                                                let l9 = i32::from(
                                                    *ptr5
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l9 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l10 = *ptr5
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l11 = *ptr5
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len12 = l11;
                                                            let bytes12 = _rt::Vec::from_raw_parts(
                                                                l10.cast(),
                                                                len12,
                                                                len12,
                                                            );
                                                            _rt::string_lift(bytes12)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e13)
                                        }
                                    };
                                    v13
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result14
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Dissociate this socket from its peer address.
                ///
                /// After calling this method, `send` & `receive` are free to communicate
                /// with any remote address again.
                ///
                /// The POSIX equivalent of this is calling `connect` with an `AF_UNSPEC` address.
                ///
                /// # Typical errors
                /// - `invalid-state`:           The socket is not connected.
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html>
                /// - <https://man7.org/linux/man-pages/man2/connect.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect>
                /// - <https://man.freebsd.org/cgi/man.cgi?connect>
                #[allow(async_fn_in_trait)]
                pub fn disconnect(&self) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.disconnect"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Send a message on the socket to a particular peer.
                ///
                /// If the socket is connected, the peer address may be left empty. In
                /// that case this is equivalent to `send` in POSIX. Otherwise it is
                /// equivalent to `sendto`.
                ///
                /// Additionally, if the socket is connected, a `remote-address` argument
                /// _may_ be provided but then it must be identical to the address
                /// passed to `connect`.
                ///
                /// If the socket has not been explicitly bound, it will be
                /// implicitly bound to a random free port.
                ///
                /// Implementations may trap if the `data` length exceeds 64 KiB.
                ///
                /// # 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 `connect`. (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)
                /// - `address-in-use`:          Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE)
                ///
                /// # Implementors note
                /// WASI requires `send` to perform an implicit bind if the socket
                /// has not been bound. Not all platforms (notably Windows) exhibit
                /// this behavior natively. On such platforms, the WASI implementation
                /// should emulate it by performing the bind if the guest has not
                /// already done so.
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html>
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html>
                /// - <https://man7.org/linux/man-pages/man2/send.2.html>
                /// - <https://man7.org/linux/man-pages/man2/sendmmsg.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
                #[allow(async_fn_in_trait)]
                pub async fn send(
                    &self,
                    data: _rt::Vec<u8>,
                    remote_address: Option<IpSocketAddress>,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(*mut u8);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (
                                &'a UdpSocket,
                                _rt::Vec<u8>,
                                Option<IpSocketAddress>,
                            );
                            type Results = Result<(), ErrorCode>;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (32 + 9 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                (32 + 4 * ::core::mem::size_of::<*const u8>())
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]udp-socket.send"]
                                    fn call(_: *mut u8, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: *mut u8, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params
                                        .0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    let base2 = l0;
                                    let len2 = l1;
                                    _rt::cabi_dealloc(base2, len2 * 1, 1);
                                }
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {
                                    let l0 = *_params
                                        .0
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l1 = *_params
                                        .0
                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    let base2 = l0;
                                    let len2 = l1;
                                    _rt::cabi_dealloc(base2, len2 * 1, 1);
                                }
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0, _lower1, _lower2): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                let _param_ptr = unsafe { _ptr.add(0) };
                                unsafe {
                                    *_param_ptr.add(0).cast::<i32>() = (_lower0).handle()
                                        as i32;
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add(::core::mem::size_of::<*const u8>())
                                };
                                unsafe {
                                    let vec0 = <_ as Into<_rt::Vec<_>>>::into(_lower1)
                                        .into_boxed_slice();
                                    let ptr0 = vec0.as_ptr().cast::<u8>();
                                    let len0 = vec0.len();
                                    ::core::mem::forget(vec0);
                                    *_param_ptr
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<usize>() = len0;
                                    *_param_ptr.add(0).cast::<*mut u8>() = ptr0.cast_mut();
                                }
                                let _param_ptr = unsafe {
                                    _ptr.add((3 * ::core::mem::size_of::<*const u8>()))
                                };
                                unsafe {
                                    match _lower2 {
                                        Some(e) => {
                                            *_param_ptr.add(0).cast::<u8>() = (1i32) as u8;
                                            match e {
                                                IpSocketAddress::Ipv4(e) => {
                                                    *_param_ptr.add(4).cast::<u8>() = (0i32) as u8;
                                                    let Ipv4SocketAddress { port: port0, address: address0 } = e;
                                                    *_param_ptr.add(8).cast::<u16>() = (_rt::as_i32(port0))
                                                        as u16;
                                                    let (t1_0, t1_1, t1_2, t1_3) = address0;
                                                    *_param_ptr.add(10).cast::<u8>() = (_rt::as_i32(t1_0))
                                                        as u8;
                                                    *_param_ptr.add(11).cast::<u8>() = (_rt::as_i32(t1_1))
                                                        as u8;
                                                    *_param_ptr.add(12).cast::<u8>() = (_rt::as_i32(t1_2))
                                                        as u8;
                                                    *_param_ptr.add(13).cast::<u8>() = (_rt::as_i32(t1_3))
                                                        as u8;
                                                }
                                                IpSocketAddress::Ipv6(e) => {
                                                    *_param_ptr.add(4).cast::<u8>() = (1i32) as u8;
                                                    let Ipv6SocketAddress {
                                                        port: port2,
                                                        flow_info: flow_info2,
                                                        address: address2,
                                                        scope_id: scope_id2,
                                                    } = e;
                                                    *_param_ptr.add(8).cast::<u16>() = (_rt::as_i32(port2))
                                                        as u16;
                                                    *_param_ptr.add(12).cast::<i32>() = _rt::as_i32(flow_info2);
                                                    let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2;
                                                    *_param_ptr.add(16).cast::<u16>() = (_rt::as_i32(t3_0))
                                                        as u16;
                                                    *_param_ptr.add(18).cast::<u16>() = (_rt::as_i32(t3_1))
                                                        as u16;
                                                    *_param_ptr.add(20).cast::<u16>() = (_rt::as_i32(t3_2))
                                                        as u16;
                                                    *_param_ptr.add(22).cast::<u16>() = (_rt::as_i32(t3_3))
                                                        as u16;
                                                    *_param_ptr.add(24).cast::<u16>() = (_rt::as_i32(t3_4))
                                                        as u16;
                                                    *_param_ptr.add(26).cast::<u16>() = (_rt::as_i32(t3_5))
                                                        as u16;
                                                    *_param_ptr.add(28).cast::<u16>() = (_rt::as_i32(t3_6))
                                                        as u16;
                                                    *_param_ptr.add(30).cast::<u16>() = (_rt::as_i32(t3_7))
                                                        as u16;
                                                    *_param_ptr.add(32).cast::<i32>() = _rt::as_i32(scope_id2);
                                                }
                                            }
                                        }
                                        None => {
                                            *_param_ptr.add(0).cast::<u8>() = (0i32) as u8;
                                        }
                                    };
                                }
                                ParamsLower(_ptr)
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = ();
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l1 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v6 = match l1 {
                                                    0 => ErrorCode::AccessDenied,
                                                    1 => ErrorCode::NotSupported,
                                                    2 => ErrorCode::InvalidArgument,
                                                    3 => ErrorCode::OutOfMemory,
                                                    4 => ErrorCode::Timeout,
                                                    5 => ErrorCode::InvalidState,
                                                    6 => ErrorCode::AddressNotBindable,
                                                    7 => ErrorCode::AddressInUse,
                                                    8 => ErrorCode::RemoteUnreachable,
                                                    9 => ErrorCode::ConnectionRefused,
                                                    10 => ErrorCode::ConnectionBroken,
                                                    11 => ErrorCode::ConnectionReset,
                                                    12 => ErrorCode::ConnectionAborted,
                                                    13 => ErrorCode::DatagramTooLarge,
                                                    n => {
                                                        debug_assert_eq!(n, 14, "invalid enum discriminant");
                                                        let e6 = {
                                                            let l2 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l2 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l3 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l4 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len5 = l4;
                                                                        let bytes5 = _rt::Vec::from_raw_parts(
                                                                            l3.cast(),
                                                                            len5,
                                                                            len5,
                                                                        );
                                                                        _rt::string_lift(bytes5)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e6)
                                                    }
                                                };
                                                v6
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self, data, remote_address))
                            .await
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Receive a message on the socket.
                ///
                /// On success, the return value contains a tuple of the received data
                /// and the address of the sender. Theoretical maximum length of the
                /// data is 64 KiB. Though in practice, it will typically be less than
                /// 1500 bytes.
                ///
                /// If the socket is connected, the sender address is guaranteed to
                /// match the remote address passed to `connect`.
                ///
                /// # Typical errors
                /// - `invalid-state`:        The socket has not been bound yet.
                /// - `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
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html>
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html>
                /// - <https://man7.org/linux/man-pages/man2/recv.2.html>
                /// - <https://man7.org/linux/man-pages/man2/recvmmsg.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_wsarecvmsg>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2>
                #[allow(async_fn_in_trait)]
                pub async fn receive(
                    &self,
                ) -> Result<(_rt::Vec<u8>, IpSocketAddress), ErrorCode> {
                    unsafe {
                        #[derive(Copy, Clone)]
                        struct ParamsLower(i32);
                        unsafe impl Send for ParamsLower {}
                        use wit_bindgen::rt::async_support::Subtask as _Subtask;
                        struct _MySubtask<'a> {
                            _unused: core::marker::PhantomData<&'a ()>,
                        }
                        #[allow(unused_parens)]
                        unsafe impl<'a> _Subtask for _MySubtask<'a> {
                            type Params = (&'a UdpSocket,);
                            type Results = Result<
                                (_rt::Vec<u8>, IpSocketAddress),
                                ErrorCode,
                            >;
                            type ParamsLower = ParamsLower;
                            fn abi_layout(&mut self) -> ::core::alloc::Layout {
                                unsafe {
                                    ::core::alloc::Layout::from_size_align_unchecked(
                                        (32 + 3 * ::core::mem::size_of::<*const u8>()),
                                        ::core::mem::size_of::<*const u8>(),
                                    )
                                }
                            }
                            fn results_offset(&mut self) -> usize {
                                0
                            }
                            unsafe fn call_import(
                                &mut self,
                                _params: Self::ParamsLower,
                                _results: *mut u8,
                            ) -> u32 {
                                #[cfg(target_arch = "wasm32")]
                                #[link(
                                    wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                                )]
                                unsafe extern "C" {
                                    #[link_name = "[async-lower][method]udp-socket.receive"]
                                    fn call(_: i32, _: *mut u8) -> i32;
                                }
                                #[cfg(not(target_arch = "wasm32"))]
                                unsafe extern "C" fn call(_: i32, _: *mut u8) -> i32 {
                                    unreachable!()
                                }
                                unsafe { call(_params.0, _results) as u32 }
                            }
                            unsafe fn params_dealloc_lists(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_dealloc_lists_and_own(
                                &mut self,
                                _params: Self::ParamsLower,
                            ) {
                                unsafe {}
                            }
                            unsafe fn params_lower(
                                &mut self,
                                (_lower0,): Self::Params,
                                _ptr: *mut u8,
                            ) -> Self::ParamsLower {
                                unsafe { ParamsLower((_lower0).handle() as i32) }
                            }
                            unsafe fn results_lift(
                                &mut self,
                                _ptr: *mut u8,
                            ) -> Self::Results {
                                unsafe {
                                    let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                    match l0 {
                                        0 => {
                                            let e = {
                                                let l1 = *_ptr
                                                    .add(::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l2 = *_ptr
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>();
                                                let len3 = l2;
                                                let l4 = i32::from(
                                                    *_ptr
                                                        .add(3 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let v21 = match l4 {
                                                    0 => {
                                                        let e21 = {
                                                            let l5 = i32::from(
                                                                *_ptr
                                                                    .add(4 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l6 = i32::from(
                                                                *_ptr
                                                                    .add(6 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            let l7 = i32::from(
                                                                *_ptr
                                                                    .add(7 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            let l8 = i32::from(
                                                                *_ptr
                                                                    .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            let l9 = i32::from(
                                                                *_ptr
                                                                    .add(9 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            Ipv4SocketAddress {
                                                                port: l5 as u16,
                                                                address: (l6 as u8, l7 as u8, l8 as u8, l9 as u8),
                                                            }
                                                        };
                                                        IpSocketAddress::Ipv4(e21)
                                                    }
                                                    n => {
                                                        debug_assert_eq!(n, 1, "invalid enum discriminant");
                                                        let e21 = {
                                                            let l10 = i32::from(
                                                                *_ptr
                                                                    .add(4 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l11 = *_ptr
                                                                .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<i32>();
                                                            let l12 = i32::from(
                                                                *_ptr
                                                                    .add(12 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l13 = i32::from(
                                                                *_ptr
                                                                    .add(14 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l14 = i32::from(
                                                                *_ptr
                                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l15 = i32::from(
                                                                *_ptr
                                                                    .add(18 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l16 = i32::from(
                                                                *_ptr
                                                                    .add(20 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l17 = i32::from(
                                                                *_ptr
                                                                    .add(22 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l18 = i32::from(
                                                                *_ptr
                                                                    .add(24 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l19 = i32::from(
                                                                *_ptr
                                                                    .add(26 + 3 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u16>(),
                                                            );
                                                            let l20 = *_ptr
                                                                .add(28 + 3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<i32>();
                                                            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,
                                                            }
                                                        };
                                                        IpSocketAddress::Ipv6(e21)
                                                    }
                                                };
                                                (
                                                    <_ as From<
                                                        _rt::Vec<_>,
                                                    >>::from(_rt::Vec::from_raw_parts(l1.cast(), len3, len3)),
                                                    v21,
                                                )
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l22 = i32::from(
                                                    *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                                );
                                                let v27 = match l22 {
                                                    0 => ErrorCode::AccessDenied,
                                                    1 => ErrorCode::NotSupported,
                                                    2 => ErrorCode::InvalidArgument,
                                                    3 => ErrorCode::OutOfMemory,
                                                    4 => ErrorCode::Timeout,
                                                    5 => ErrorCode::InvalidState,
                                                    6 => ErrorCode::AddressNotBindable,
                                                    7 => ErrorCode::AddressInUse,
                                                    8 => ErrorCode::RemoteUnreachable,
                                                    9 => ErrorCode::ConnectionRefused,
                                                    10 => ErrorCode::ConnectionBroken,
                                                    11 => ErrorCode::ConnectionReset,
                                                    12 => ErrorCode::ConnectionAborted,
                                                    13 => ErrorCode::DatagramTooLarge,
                                                    n => {
                                                        debug_assert_eq!(n, 14, "invalid enum discriminant");
                                                        let e27 = {
                                                            let l23 = i32::from(
                                                                *_ptr
                                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                                    .cast::<u8>(),
                                                            );
                                                            match l23 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l24 = *_ptr
                                                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<*mut u8>();
                                                                        let l25 = *_ptr
                                                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                                                            .cast::<usize>();
                                                                        let len26 = l25;
                                                                        let bytes26 = _rt::Vec::from_raw_parts(
                                                                            l24.cast(),
                                                                            len26,
                                                                            len26,
                                                                        );
                                                                        _rt::string_lift(bytes26)
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            }
                                                        };
                                                        ErrorCode::Other(e27)
                                                    }
                                                };
                                                v27
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                }
                            }
                        }
                        _MySubtask {
                            _unused: core::marker::PhantomData,
                        }
                            .call((self,))
                            .await
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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 `get-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
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>
                /// - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
                /// - <https://man.freebsd.org/cgi/man.cgi?getsockname>
                #[allow(async_fn_in_trait)]
                pub fn get_local_address(&self) -> Result<IpSocketAddress, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 32 + 1 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 32
                                + 1 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.get-local-address"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result27 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v20 = match l3 {
                                        0 => {
                                            let e20 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(4 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(6 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l6 = i32::from(
                                                    *ptr0
                                                        .add(7 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l7 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l8 = i32::from(
                                                    *ptr0
                                                        .add(9 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                Ipv4SocketAddress {
                                                    port: l4 as u16,
                                                    address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8),
                                                }
                                            };
                                            IpSocketAddress::Ipv4(e20)
                                        }
                                        n => {
                                            debug_assert_eq!(n, 1, "invalid enum discriminant");
                                            let e20 = {
                                                let l9 = i32::from(
                                                    *ptr0
                                                        .add(4 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l10 = *ptr0
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i32>();
                                                let l11 = i32::from(
                                                    *ptr0
                                                        .add(12 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l12 = i32::from(
                                                    *ptr0
                                                        .add(14 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l13 = i32::from(
                                                    *ptr0
                                                        .add(16 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l14 = i32::from(
                                                    *ptr0
                                                        .add(18 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l15 = i32::from(
                                                    *ptr0
                                                        .add(20 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l16 = i32::from(
                                                    *ptr0
                                                        .add(22 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l17 = i32::from(
                                                    *ptr0
                                                        .add(24 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l18 = i32::from(
                                                    *ptr0
                                                        .add(26 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l19 = *ptr0
                                                    .add(28 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i32>();
                                                Ipv6SocketAddress {
                                                    port: l9 as u16,
                                                    flow_info: l10 as u32,
                                                    address: (
                                                        l11 as u16,
                                                        l12 as u16,
                                                        l13 as u16,
                                                        l14 as u16,
                                                        l15 as u16,
                                                        l16 as u16,
                                                        l17 as u16,
                                                        l18 as u16,
                                                    ),
                                                    scope_id: l19 as u32,
                                                }
                                            };
                                            IpSocketAddress::Ipv6(e20)
                                        }
                                    };
                                    v20
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l21 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v26 = match l21 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e26 = {
                                                let l22 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l22 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l23 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l24 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len25 = l24;
                                                            let bytes25 = _rt::Vec::from_raw_parts(
                                                                l23.cast(),
                                                                len25,
                                                                len25,
                                                            );
                                                            _rt::string_lift(bytes25)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e26)
                                        }
                                    };
                                    v26
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result27
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Get the address the socket is currently "connected" to.
                ///
                /// # Typical errors
                /// - `invalid-state`: The socket is not "connected" to a specific remote address. (ENOTCONN)
                ///
                /// # References
                /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html>
                /// - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
                /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
                /// - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
                #[allow(async_fn_in_trait)]
                pub fn get_remote_address(&self) -> Result<IpSocketAddress, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 32 + 1 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 32
                                + 1 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.get-remote-address"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result27 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v20 = match l3 {
                                        0 => {
                                            let e20 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(4 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(6 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l6 = i32::from(
                                                    *ptr0
                                                        .add(7 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l7 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let l8 = i32::from(
                                                    *ptr0
                                                        .add(9 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                Ipv4SocketAddress {
                                                    port: l4 as u16,
                                                    address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8),
                                                }
                                            };
                                            IpSocketAddress::Ipv4(e20)
                                        }
                                        n => {
                                            debug_assert_eq!(n, 1, "invalid enum discriminant");
                                            let e20 = {
                                                let l9 = i32::from(
                                                    *ptr0
                                                        .add(4 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l10 = *ptr0
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i32>();
                                                let l11 = i32::from(
                                                    *ptr0
                                                        .add(12 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l12 = i32::from(
                                                    *ptr0
                                                        .add(14 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l13 = i32::from(
                                                    *ptr0
                                                        .add(16 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l14 = i32::from(
                                                    *ptr0
                                                        .add(18 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l15 = i32::from(
                                                    *ptr0
                                                        .add(20 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l16 = i32::from(
                                                    *ptr0
                                                        .add(22 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l17 = i32::from(
                                                    *ptr0
                                                        .add(24 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l18 = i32::from(
                                                    *ptr0
                                                        .add(26 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u16>(),
                                                );
                                                let l19 = *ptr0
                                                    .add(28 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i32>();
                                                Ipv6SocketAddress {
                                                    port: l9 as u16,
                                                    flow_info: l10 as u32,
                                                    address: (
                                                        l11 as u16,
                                                        l12 as u16,
                                                        l13 as u16,
                                                        l14 as u16,
                                                        l15 as u16,
                                                        l16 as u16,
                                                        l17 as u16,
                                                        l18 as u16,
                                                    ),
                                                    scope_id: l19 as u32,
                                                }
                                            };
                                            IpSocketAddress::Ipv6(e20)
                                        }
                                    };
                                    v20
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l21 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v26 = match l21 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e26 = {
                                                let l22 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l22 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l23 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l24 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len25 = l24;
                                                            let bytes25 = _rt::Vec::from_raw_parts(
                                                                l23.cast(),
                                                                len25,
                                                                len25,
                                                            );
                                                            _rt::string_lift(bytes25)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e26)
                                        }
                                    };
                                    v26
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result27
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Whether this is a IPv4 or IPv6 socket.
                ///
                /// This is the value passed to the constructor.
                ///
                /// Equivalent to the SO_DOMAIN socket option.
                #[allow(async_fn_in_trait)]
                pub fn get_address_family(&self) -> IpAddressFamily {
                    unsafe {
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.get-address-family"]
                            fn wit_import0(_: i32) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
                            unreachable!()
                        }
                        let ret = wit_import0((self).handle() as i32);
                        IpAddressFamily::_lift(ret as u8)
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// 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.
                #[allow(async_fn_in_trait)]
                pub fn get_unicast_hop_limit(&self) -> Result<u8, ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.get-unicast-hop-limit"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    l3 as u8
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_unicast_hop_limit(&self, value: u8) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.set-unicast-hop-limit"]
                            fn wit_import1(_: i32, _: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i32(&value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                /// Kernel buffer space reserved for sending/receiving on this socket.
                /// Implementations usually treat this as a cap the buffer can grow to,
                /// rather than allocating the full amount immediately.
                ///
                /// If the provided value is 0, an `invalid-argument` error is returned.
                /// All other values are accepted without error, but may be
                /// clamped or rounded. As a result, the value read back from
                /// this setting may differ from the value that was set.
                ///
                /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options.
                ///
                /// # Typical errors
                /// - `invalid-argument`:     (set) The provided value was 0.
                #[allow(async_fn_in_trait)]
                pub fn get_receive_buffer_size(&self) -> Result<u64, ErrorCode> {
                    unsafe {
                        #[repr(align(8))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 8 + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 8
                                + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.get-receive-buffer-size"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0.add(8).cast::<i64>();
                                    l3 as u64
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(*ptr0.add(8).cast::<u8>());
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_receive_buffer_size(
                    &self,
                    value: u64,
                ) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.set-receive-buffer-size"]
                            fn wit_import1(_: i32, _: i64, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn get_send_buffer_size(&self) -> Result<u64, ErrorCode> {
                    unsafe {
                        #[repr(align(8))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 8 + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 8
                                + 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.get-send-buffer-size"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result10 = match l2 {
                            0 => {
                                let e = {
                                    let l3 = *ptr0.add(8).cast::<i64>();
                                    l3 as u64
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l4 = i32::from(*ptr0.add(8).cast::<u8>());
                                    let v9 = match l4 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e9 = {
                                                let l5 = i32::from(
                                                    *ptr0
                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l5 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l6 = *ptr0
                                                                .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l7 = *ptr0
                                                                .add(8 + 3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len8 = l7;
                                                            let bytes8 = _rt::Vec::from_raw_parts(
                                                                l6.cast(),
                                                                len8,
                                                                len8,
                                                            );
                                                            _rt::string_lift(bytes8)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e9)
                                        }
                                    };
                                    v9
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result10
                    }
                }
            }
            impl UdpSocket {
                #[allow(unused_unsafe, clippy::all)]
                #[allow(async_fn_in_trait)]
                pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> {
                    unsafe {
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 5 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 5
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(
                            wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15"
                        )]
                        unsafe extern "C" {
                            #[link_name = "[method]udp-socket.set-send-buffer-size"]
                            fn wit_import1(_: i32, _: i64, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) {
                            unreachable!()
                        }
                        wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0);
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result9 = match l2 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v8 = match l3 {
                                        0 => ErrorCode::AccessDenied,
                                        1 => ErrorCode::NotSupported,
                                        2 => ErrorCode::InvalidArgument,
                                        3 => ErrorCode::OutOfMemory,
                                        4 => ErrorCode::Timeout,
                                        5 => ErrorCode::InvalidState,
                                        6 => ErrorCode::AddressNotBindable,
                                        7 => ErrorCode::AddressInUse,
                                        8 => ErrorCode::RemoteUnreachable,
                                        9 => ErrorCode::ConnectionRefused,
                                        10 => ErrorCode::ConnectionBroken,
                                        11 => ErrorCode::ConnectionReset,
                                        12 => ErrorCode::ConnectionAborted,
                                        13 => ErrorCode::DatagramTooLarge,
                                        n => {
                                            debug_assert_eq!(n, 14, "invalid enum discriminant");
                                            let e8 = {
                                                let l4 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                match l4 {
                                                    0 => None,
                                                    1 => {
                                                        let e = {
                                                            let l5 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l6 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len7 = l6;
                                                            let bytes7 = _rt::Vec::from_raw_parts(
                                                                l5.cast(),
                                                                len7,
                                                                len7,
                                                            );
                                                            _rt::string_lift(bytes7)
                                                        };
                                                        Some(e)
                                                    }
                                                    _ => _rt::invalid_enum_discriminant(),
                                                }
                                            };
                                            ErrorCode::Other(e8)
                                        }
                                    };
                                    v8
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result9
                    }
                }
            }
        }
        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
        pub mod ip_name_lookup {
            #[used]
            #[doc(hidden)]
            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
            use super::super::super::_rt;
            pub type IpAddress = super::super::super::wasi::sockets::types::IpAddress;
            /// Lookup error codes.
            #[derive(Clone)]
            pub enum ErrorCode {
                /// Access denied.
                ///
                /// POSIX equivalent: EACCES, EPERM
                AccessDenied,
                /// `name` is a syntactically invalid domain name or IP address.
                ///
                /// POSIX equivalent: EINVAL
                InvalidArgument,
                /// Name does not exist or has no suitable associated IP addresses.
                ///
                /// POSIX equivalent: EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY
                NameUnresolvable,
                /// A temporary failure in name resolution occurred.
                ///
                /// POSIX equivalent: EAI_AGAIN
                TemporaryResolverFailure,
                /// A permanent failure in name resolution occurred.
                ///
                /// POSIX equivalent: EAI_FAIL
                PermanentResolverFailure,
                /// A catch-all for errors not captured by the existing variants.
                /// Implementations can use this to extend the error type without
                /// breaking existing code.
                Other(Option<_rt::String>),
            }
            impl ::core::fmt::Debug for ErrorCode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        ErrorCode::AccessDenied => {
                            f.debug_tuple("ErrorCode::AccessDenied").finish()
                        }
                        ErrorCode::InvalidArgument => {
                            f.debug_tuple("ErrorCode::InvalidArgument").finish()
                        }
                        ErrorCode::NameUnresolvable => {
                            f.debug_tuple("ErrorCode::NameUnresolvable").finish()
                        }
                        ErrorCode::TemporaryResolverFailure => {
                            f.debug_tuple("ErrorCode::TemporaryResolverFailure").finish()
                        }
                        ErrorCode::PermanentResolverFailure => {
                            f.debug_tuple("ErrorCode::PermanentResolverFailure").finish()
                        }
                        ErrorCode::Other(e) => {
                            f.debug_tuple("ErrorCode::Other").field(e).finish()
                        }
                    }
                }
            }
            impl ::core::fmt::Display for ErrorCode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    write!(f, "{:?}", self)
                }
            }
            #[cfg(feature = "std")]
            impl ::core::error::Error for ErrorCode {}
            #[allow(unused_unsafe, clippy::all)]
            /// 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.
            ///
            /// The results are returned in connection order preference.
            ///
            /// This function never succeeds with 0 results. It either fails or succeeds
            /// with at least one address. Additionally, this function never returns
            /// IPv4-mapped IPv6 addresses.
            ///
            /// # References:
            /// - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>
            /// - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
            /// - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
            /// - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
            #[allow(async_fn_in_trait)]
            pub async fn resolve_addresses(
                name: _rt::String,
            ) -> Result<_rt::Vec<IpAddress>, ErrorCode> {
                unsafe {
                    #[derive(Copy, Clone)]
                    struct ParamsLower(*mut u8, usize);
                    unsafe impl Send for ParamsLower {}
                    use wit_bindgen::rt::async_support::Subtask as _Subtask;
                    struct _MySubtask<'a> {
                        _unused: core::marker::PhantomData<&'a ()>,
                    }
                    #[allow(unused_parens)]
                    unsafe impl<'a> _Subtask for _MySubtask<'a> {
                        type Params = (_rt::String,);
                        type Results = Result<_rt::Vec<IpAddress>, ErrorCode>;
                        type ParamsLower = ParamsLower;
                        fn abi_layout(&mut self) -> ::core::alloc::Layout {
                            unsafe {
                                ::core::alloc::Layout::from_size_align_unchecked(
                                    (5 * ::core::mem::size_of::<*const u8>()),
                                    ::core::mem::size_of::<*const u8>(),
                                )
                            }
                        }
                        fn results_offset(&mut self) -> usize {
                            0
                        }
                        unsafe fn call_import(
                            &mut self,
                            _params: Self::ParamsLower,
                            _results: *mut u8,
                        ) -> u32 {
                            #[cfg(target_arch = "wasm32")]
                            #[link(
                                wasm_import_module = "wasi:sockets/ip-name-lookup@0.3.0-rc-2026-03-15"
                            )]
                            unsafe extern "C" {
                                #[link_name = "[async-lower]resolve-addresses"]
                                fn call(_: *mut u8, _: usize, _: *mut u8) -> i32;
                            }
                            #[cfg(not(target_arch = "wasm32"))]
                            unsafe extern "C" fn call(
                                _: *mut u8,
                                _: usize,
                                _: *mut u8,
                            ) -> i32 {
                                unreachable!()
                            }
                            unsafe { call(_params.0, _params.1, _results) as u32 }
                        }
                        unsafe fn params_dealloc_lists(
                            &mut self,
                            _params: Self::ParamsLower,
                        ) {
                            unsafe {
                                _rt::cabi_dealloc(_params.0, _params.1, 1);
                            }
                        }
                        unsafe fn params_dealloc_lists_and_own(
                            &mut self,
                            _params: Self::ParamsLower,
                        ) {
                            unsafe {
                                _rt::cabi_dealloc(_params.0, _params.1, 1);
                            }
                        }
                        unsafe fn params_lower(
                            &mut self,
                            (_lower0,): Self::Params,
                            _ptr: *mut u8,
                        ) -> Self::ParamsLower {
                            unsafe {
                                let vec0 = (_lower0.into_bytes()).into_boxed_slice();
                                let ptr0 = vec0.as_ptr().cast::<u8>();
                                let len0 = vec0.len();
                                ::core::mem::forget(vec0);
                                ParamsLower(ptr0.cast_mut(), len0)
                            }
                        }
                        unsafe fn results_lift(
                            &mut self,
                            _ptr: *mut u8,
                        ) -> Self::Results {
                            unsafe {
                                let l0 = i32::from(*_ptr.add(0).cast::<u8>());
                                match l0 {
                                    0 => {
                                        let e = {
                                            let l1 = *_ptr
                                                .add(::core::mem::size_of::<*const u8>())
                                                .cast::<*mut u8>();
                                            let l2 = *_ptr
                                                .add(2 * ::core::mem::size_of::<*const u8>())
                                                .cast::<usize>();
                                            let base17 = l1;
                                            let len17 = l2;
                                            let mut result17 = _rt::Vec::with_capacity(len17);
                                            for i in 0..len17 {
                                                let base = base17.add(i * 18);
                                                let e17 = {
                                                    let l3 = i32::from(*base.add(0).cast::<u8>());
                                                    use super::super::super::wasi::sockets::types::IpAddress as V16;
                                                    let v16 = match l3 {
                                                        0 => {
                                                            let e16 = {
                                                                let l4 = i32::from(*base.add(2).cast::<u8>());
                                                                let l5 = i32::from(*base.add(3).cast::<u8>());
                                                                let l6 = i32::from(*base.add(4).cast::<u8>());
                                                                let l7 = i32::from(*base.add(5).cast::<u8>());
                                                                (l4 as u8, l5 as u8, l6 as u8, l7 as u8)
                                                            };
                                                            V16::Ipv4(e16)
                                                        }
                                                        n => {
                                                            debug_assert_eq!(n, 1, "invalid enum discriminant");
                                                            let e16 = {
                                                                let l8 = i32::from(*base.add(2).cast::<u16>());
                                                                let l9 = i32::from(*base.add(4).cast::<u16>());
                                                                let l10 = i32::from(*base.add(6).cast::<u16>());
                                                                let l11 = i32::from(*base.add(8).cast::<u16>());
                                                                let l12 = i32::from(*base.add(10).cast::<u16>());
                                                                let l13 = i32::from(*base.add(12).cast::<u16>());
                                                                let l14 = i32::from(*base.add(14).cast::<u16>());
                                                                let l15 = i32::from(*base.add(16).cast::<u16>());
                                                                (
                                                                    l8 as u16,
                                                                    l9 as u16,
                                                                    l10 as u16,
                                                                    l11 as u16,
                                                                    l12 as u16,
                                                                    l13 as u16,
                                                                    l14 as u16,
                                                                    l15 as u16,
                                                                )
                                                            };
                                                            V16::Ipv6(e16)
                                                        }
                                                    };
                                                    v16
                                                };
                                                result17.push(e17);
                                            }
                                            _rt::cabi_dealloc(base17, len17 * 18, 2);
                                            result17
                                        };
                                        Ok(e)
                                    }
                                    1 => {
                                        let e = {
                                            let l18 = i32::from(
                                                *_ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                            );
                                            let v23 = match l18 {
                                                0 => ErrorCode::AccessDenied,
                                                1 => ErrorCode::InvalidArgument,
                                                2 => ErrorCode::NameUnresolvable,
                                                3 => ErrorCode::TemporaryResolverFailure,
                                                4 => ErrorCode::PermanentResolverFailure,
                                                n => {
                                                    debug_assert_eq!(n, 5, "invalid enum discriminant");
                                                    let e23 = {
                                                        let l19 = i32::from(
                                                            *_ptr
                                                                .add(2 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<u8>(),
                                                        );
                                                        match l19 {
                                                            0 => None,
                                                            1 => {
                                                                let e = {
                                                                    let l20 = *_ptr
                                                                        .add(3 * ::core::mem::size_of::<*const u8>())
                                                                        .cast::<*mut u8>();
                                                                    let l21 = *_ptr
                                                                        .add(4 * ::core::mem::size_of::<*const u8>())
                                                                        .cast::<usize>();
                                                                    let len22 = l21;
                                                                    let bytes22 = _rt::Vec::from_raw_parts(
                                                                        l20.cast(),
                                                                        len22,
                                                                        len22,
                                                                    );
                                                                    _rt::string_lift(bytes22)
                                                                };
                                                                Some(e)
                                                            }
                                                            _ => _rt::invalid_enum_discriminant(),
                                                        }
                                                    };
                                                    ErrorCode::Other(e23)
                                                }
                                            };
                                            v23
                                        };
                                        Err(e)
                                    }
                                    _ => _rt::invalid_enum_discriminant(),
                                }
                            }
                        }
                    }
                    _MySubtask {
                        _unused: core::marker::PhantomData,
                    }
                        .call((name,))
                        .await
                }
            }
        }
    }
}
#[rustfmt::skip]
mod _rt {
    #![allow(dead_code, unused_imports, clippy::all)]
    pub use alloc_crate::vec::Vec;
    pub use alloc_crate::string::String;
    pub unsafe fn string_lift(bytes: Vec<u8>) -> String {
        if cfg!(debug_assertions) {
            String::from_utf8(bytes).unwrap()
        } else {
            unsafe { String::from_utf8_unchecked(bytes) }
        }
    }
    pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) {
        if size == 0 {
            return;
        }
        unsafe {
            let layout = alloc::Layout::from_size_align_unchecked(size, align);
            alloc::dealloc(ptr, layout);
        }
    }
    pub unsafe fn invalid_enum_discriminant<T>() -> T {
        if cfg!(debug_assertions) {
            panic!("invalid enum discriminant")
        } else {
            unsafe { core::hint::unreachable_unchecked() }
        }
    }
    pub fn as_i32<T: AsI32>(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 {
            self as i32
        }
    }
    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.
    ///
    /// This is a low-level wrapper which handles the lifetime of the resource
    /// (namely this has a destructor). The `T` provided defines the component model
    /// intrinsics that this wrapper uses.
    ///
    /// One of the chief purposes of this type is to provide `Deref` implementations
    /// to access the underlying data when it is owned.
    ///
    /// This type is primarily used in generated code for exported and imported
    /// resources.
    #[repr(transparent)]
    pub struct Resource<T: WasmResource> {
        handle: AtomicU32,
        _marker: marker::PhantomData<T>,
    }
    /// A trait which all wasm resources implement, namely providing the ability to
    /// drop a resource.
    ///
    /// This generally is implemented by generated code, not user-facing code.
    #[allow(clippy::missing_safety_doc)]
    pub unsafe trait WasmResource {
        /// Invokes the `[resource-drop]...` intrinsic.
        unsafe fn drop(handle: u32);
    }
    impl<T: WasmResource> Resource<T> {
        #[doc(hidden)]
        pub unsafe fn from_handle(handle: u32) -> Self {
            debug_assert!(handle != 0 && handle != u32::MAX);
            Self {
                handle: AtomicU32::new(handle),
                _marker: marker::PhantomData,
            }
        }
        /// Takes ownership of the handle owned by `resource`.
        ///
        /// Note that this ideally would be `into_handle` taking `Resource<T>` by
        /// ownership. The code generator does not enable that in all situations,
        /// unfortunately, so this is provided instead.
        ///
        /// Also note that `take_handle` is in theory only ever called on values
        /// owned by a generated function. For example a generated function might
        /// take `Resource<T>` as an argument but then call `take_handle` on a
        /// reference to that argument. In that sense the dynamic nature of
        /// `take_handle` should only be exposed internally to generated code, not
        /// to user code.
        #[doc(hidden)]
        pub fn take_handle(resource: &Resource<T>) -> u32 {
            resource.handle.swap(u32::MAX, Relaxed)
        }
        #[doc(hidden)]
        pub fn handle(resource: &Resource<T>) -> u32 {
            resource.handle.load(Relaxed)
        }
    }
    impl<T: WasmResource> fmt::Debug for Resource<T> {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            f.debug_struct("Resource").field("handle", &self.handle).finish()
        }
    }
    impl<T: WasmResource> Drop for Resource<T> {
        fn drop(&mut self) {
            unsafe {
                match self.handle.load(Relaxed) {
                    u32::MAX => {}
                    other => T::drop(other),
                }
            }
        }
    }
    pub fn as_i64<T: AsI64>(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 {
            self as i64
        }
    }
    pub unsafe fn bool_lift(val: u8) -> bool {
        if cfg!(debug_assertions) {
            match val {
                0 => false,
                1 => true,
                _ => panic!("invalid bool discriminant"),
            }
        } else {
            val != 0
        }
    }
    extern crate alloc as alloc_crate;
    pub use alloc_crate::alloc;
}
pub mod wit_future {
    #![allow(dead_code, unused_variables, clippy::all)]
    #[doc(hidden)]
    pub trait FuturePayload: Unpin + Sized + 'static {
        const VTABLE: &'static wit_bindgen::rt::async_support::FutureVtable<Self>;
    }
    #[doc(hidden)]
    #[allow(unused_unsafe)]
    pub mod vtable0 {
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_write(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_read(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_writable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_readable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn new() -> u64 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_read(_: u32, _: *mut u8) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_write(_: u32, _: *const u8) -> u32 {
            unreachable!()
        }
        #[cfg(target_arch = "wasm32")]
        #[link(wasm_import_module = "wasi:cli/stdin@0.3.0-rc-2026-03-15")]
        unsafe extern "C" {
            #[link_name = "[future-new-1]read-via-stream"]
            fn new() -> u64;
            #[link_name = "[future-cancel-write-1]read-via-stream"]
            fn cancel_write(_: u32) -> u32;
            #[link_name = "[future-cancel-read-1]read-via-stream"]
            fn cancel_read(_: u32) -> u32;
            #[link_name = "[future-drop-writable-1]read-via-stream"]
            fn drop_writable(_: u32);
            #[link_name = "[future-drop-readable-1]read-via-stream"]
            fn drop_readable(_: u32);
            #[link_name = "[async-lower][future-read-1]read-via-stream"]
            fn start_read(_: u32, _: *mut u8) -> u32;
            #[link_name = "[async-lower][future-write-1]read-via-stream"]
            fn start_write(_: u32, _: *const u8) -> u32;
        }
        unsafe fn lift(
            ptr: *mut u8,
        ) -> Result<(), super::super::wasi::cli::stdin::ErrorCode> {
            unsafe {
                let l0 = i32::from(*ptr.add(0).cast::<u8>());
                match l0 {
                    0 => {
                        let e = ();
                        Ok(e)
                    }
                    1 => {
                        let e = {
                            let l1 = i32::from(*ptr.add(1).cast::<u8>());
                            super::super::wasi::cli::types::ErrorCode::_lift(l1 as u8)
                        };
                        Err(e)
                    }
                    _ => super::super::_rt::invalid_enum_discriminant(),
                }
            }
        }
        unsafe fn lower(
            value: Result<(), super::super::wasi::cli::stdin::ErrorCode>,
            ptr: *mut u8,
        ) {
            unsafe {
                match value {
                    Ok(_) => {
                        *ptr.add(0).cast::<u8>() = (0i32) as u8;
                    }
                    Err(e) => {
                        *ptr.add(0).cast::<u8>() = (1i32) as u8;
                        *ptr.add(1).cast::<u8>() = (e.clone() as i32) as u8;
                    }
                };
            }
        }
        unsafe fn dealloc_lists(ptr: *mut u8) {
            unsafe {}
        }
        pub static VTABLE: wit_bindgen::rt::async_support::FutureVtable<
            Result<(), super::super::wasi::cli::stdin::ErrorCode>,
        > = wit_bindgen::rt::async_support::FutureVtable::<
            Result<(), super::super::wasi::cli::stdin::ErrorCode>,
        > {
            cancel_write,
            cancel_read,
            drop_writable,
            drop_readable,
            dealloc_lists,
            layout: unsafe { ::core::alloc::Layout::from_size_align_unchecked(2, 1) },
            lift,
            lower,
            new,
            start_read,
            start_write,
        };
        impl super::FuturePayload
        for Result<(), super::super::wasi::cli::stdin::ErrorCode> {
            const VTABLE: &'static wit_bindgen::rt::async_support::FutureVtable<Self> = &VTABLE;
        }
    }
    #[doc(hidden)]
    #[allow(unused_unsafe)]
    pub mod vtable1 {
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_write(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_read(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_writable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_readable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn new() -> u64 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_read(_: u32, _: *mut u8) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_write(_: u32, _: *const u8) -> u32 {
            unreachable!()
        }
        #[cfg(target_arch = "wasm32")]
        #[link(wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15")]
        unsafe extern "C" {
            #[link_name = "[future-new-1][method]descriptor.read-via-stream"]
            fn new() -> u64;
            #[link_name = "[future-cancel-write-1][method]descriptor.read-via-stream"]
            fn cancel_write(_: u32) -> u32;
            #[link_name = "[future-cancel-read-1][method]descriptor.read-via-stream"]
            fn cancel_read(_: u32) -> u32;
            #[link_name = "[future-drop-writable-1][method]descriptor.read-via-stream"]
            fn drop_writable(_: u32);
            #[link_name = "[future-drop-readable-1][method]descriptor.read-via-stream"]
            fn drop_readable(_: u32);
            #[link_name = "[async-lower][future-read-1][method]descriptor.read-via-stream"]
            fn start_read(_: u32, _: *mut u8) -> u32;
            #[link_name = "[async-lower][future-write-1][method]descriptor.read-via-stream"]
            fn start_write(_: u32, _: *const u8) -> u32;
        }
        unsafe fn lift(
            ptr: *mut u8,
        ) -> Result<(), super::super::wasi::filesystem::types::ErrorCode> {
            unsafe {
                let l0 = i32::from(*ptr.add(0).cast::<u8>());
                match l0 {
                    0 => {
                        let e = ();
                        Ok(e)
                    }
                    1 => {
                        let e = {
                            let l1 = i32::from(
                                *ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                            );
                            use super::super::wasi::filesystem::types::ErrorCode as V6;
                            let v6 = match l1 {
                                0 => V6::Access,
                                1 => V6::Already,
                                2 => V6::BadDescriptor,
                                3 => V6::Busy,
                                4 => V6::Deadlock,
                                5 => V6::Quota,
                                6 => V6::Exist,
                                7 => V6::FileTooLarge,
                                8 => V6::IllegalByteSequence,
                                9 => V6::InProgress,
                                10 => V6::Interrupted,
                                11 => V6::Invalid,
                                12 => V6::Io,
                                13 => V6::IsDirectory,
                                14 => V6::Loop,
                                15 => V6::TooManyLinks,
                                16 => V6::MessageSize,
                                17 => V6::NameTooLong,
                                18 => V6::NoDevice,
                                19 => V6::NoEntry,
                                20 => V6::NoLock,
                                21 => V6::InsufficientMemory,
                                22 => V6::InsufficientSpace,
                                23 => V6::NotDirectory,
                                24 => V6::NotEmpty,
                                25 => V6::NotRecoverable,
                                26 => V6::Unsupported,
                                27 => V6::NoTty,
                                28 => V6::NoSuchDevice,
                                29 => V6::Overflow,
                                30 => V6::NotPermitted,
                                31 => V6::Pipe,
                                32 => V6::ReadOnly,
                                33 => V6::InvalidSeek,
                                34 => V6::TextFileBusy,
                                35 => V6::CrossDevice,
                                n => {
                                    debug_assert_eq!(n, 36, "invalid enum discriminant");
                                    let e6 = {
                                        let l2 = i32::from(
                                            *ptr
                                                .add(2 * ::core::mem::size_of::<*const u8>())
                                                .cast::<u8>(),
                                        );
                                        match l2 {
                                            0 => None,
                                            1 => {
                                                let e = {
                                                    let l3 = *ptr
                                                        .add(3 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<*mut u8>();
                                                    let l4 = *ptr
                                                        .add(4 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<usize>();
                                                    let len5 = l4;
                                                    let bytes5 = super::super::_rt::Vec::from_raw_parts(
                                                        l3.cast(),
                                                        len5,
                                                        len5,
                                                    );
                                                    super::super::_rt::string_lift(bytes5)
                                                };
                                                Some(e)
                                            }
                                            _ => super::super::_rt::invalid_enum_discriminant(),
                                        }
                                    };
                                    V6::Other(e6)
                                }
                            };
                            v6
                        };
                        Err(e)
                    }
                    _ => super::super::_rt::invalid_enum_discriminant(),
                }
            }
        }
        unsafe fn lower(
            value: Result<(), super::super::wasi::filesystem::types::ErrorCode>,
            ptr: *mut u8,
        ) {
            unsafe {
                match value {
                    Ok(_) => {
                        *ptr.add(0).cast::<u8>() = (0i32) as u8;
                    }
                    Err(e) => {
                        *ptr.add(0).cast::<u8>() = (1i32) as u8;
                        use super::super::wasi::filesystem::types::ErrorCode as V1;
                        match e {
                            V1::Access => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (0i32) as u8;
                            }
                            V1::Already => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (1i32) as u8;
                            }
                            V1::BadDescriptor => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (2i32) as u8;
                            }
                            V1::Busy => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (3i32) as u8;
                            }
                            V1::Deadlock => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (4i32) as u8;
                            }
                            V1::Quota => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (5i32) as u8;
                            }
                            V1::Exist => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (6i32) as u8;
                            }
                            V1::FileTooLarge => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (7i32) as u8;
                            }
                            V1::IllegalByteSequence => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (8i32) as u8;
                            }
                            V1::InProgress => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (9i32) as u8;
                            }
                            V1::Interrupted => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (10i32) as u8;
                            }
                            V1::Invalid => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (11i32) as u8;
                            }
                            V1::Io => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (12i32) as u8;
                            }
                            V1::IsDirectory => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (13i32) as u8;
                            }
                            V1::Loop => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (14i32) as u8;
                            }
                            V1::TooManyLinks => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (15i32) as u8;
                            }
                            V1::MessageSize => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (16i32) as u8;
                            }
                            V1::NameTooLong => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (17i32) as u8;
                            }
                            V1::NoDevice => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (18i32) as u8;
                            }
                            V1::NoEntry => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (19i32) as u8;
                            }
                            V1::NoLock => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (20i32) as u8;
                            }
                            V1::InsufficientMemory => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (21i32) as u8;
                            }
                            V1::InsufficientSpace => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (22i32) as u8;
                            }
                            V1::NotDirectory => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (23i32) as u8;
                            }
                            V1::NotEmpty => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (24i32) as u8;
                            }
                            V1::NotRecoverable => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (25i32) as u8;
                            }
                            V1::Unsupported => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (26i32) as u8;
                            }
                            V1::NoTty => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (27i32) as u8;
                            }
                            V1::NoSuchDevice => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (28i32) as u8;
                            }
                            V1::Overflow => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (29i32) as u8;
                            }
                            V1::NotPermitted => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (30i32) as u8;
                            }
                            V1::Pipe => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (31i32) as u8;
                            }
                            V1::ReadOnly => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (32i32) as u8;
                            }
                            V1::InvalidSeek => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (33i32) as u8;
                            }
                            V1::TextFileBusy => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (34i32) as u8;
                            }
                            V1::CrossDevice => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (35i32) as u8;
                            }
                            V1::Other(e) => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (36i32) as u8;
                                match e {
                                    Some(e) => {
                                        *ptr
                                            .add(2 * ::core::mem::size_of::<*const u8>())
                                            .cast::<u8>() = (1i32) as u8;
                                        let vec0 = (e.into_bytes()).into_boxed_slice();
                                        let ptr0 = vec0.as_ptr().cast::<u8>();
                                        let len0 = vec0.len();
                                        ::core::mem::forget(vec0);
                                        *ptr
                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                            .cast::<usize>() = len0;
                                        *ptr
                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                            .cast::<*mut u8>() = ptr0.cast_mut();
                                    }
                                    None => {
                                        *ptr
                                            .add(2 * ::core::mem::size_of::<*const u8>())
                                            .cast::<u8>() = (0i32) as u8;
                                    }
                                };
                            }
                        }
                    }
                };
            }
        }
        unsafe fn dealloc_lists(ptr: *mut u8) {
            unsafe {
                let l0 = i32::from(*ptr.add(0).cast::<u8>());
                match l0 {
                    0 => {}
                    _ => {
                        let l1 = i32::from(
                            *ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                        );
                        match l1 {
                            0 => {}
                            1 => {}
                            2 => {}
                            3 => {}
                            4 => {}
                            5 => {}
                            6 => {}
                            7 => {}
                            8 => {}
                            9 => {}
                            10 => {}
                            11 => {}
                            12 => {}
                            13 => {}
                            14 => {}
                            15 => {}
                            16 => {}
                            17 => {}
                            18 => {}
                            19 => {}
                            20 => {}
                            21 => {}
                            22 => {}
                            23 => {}
                            24 => {}
                            25 => {}
                            26 => {}
                            27 => {}
                            28 => {}
                            29 => {}
                            30 => {}
                            31 => {}
                            32 => {}
                            33 => {}
                            34 => {}
                            35 => {}
                            _ => {
                                let l2 = i32::from(
                                    *ptr
                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                        .cast::<u8>(),
                                );
                                match l2 {
                                    0 => {}
                                    _ => {
                                        let l3 = *ptr
                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                            .cast::<*mut u8>();
                                        let l4 = *ptr
                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                            .cast::<usize>();
                                        super::super::_rt::cabi_dealloc(l3, l4, 1);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        pub static VTABLE: wit_bindgen::rt::async_support::FutureVtable<
            Result<(), super::super::wasi::filesystem::types::ErrorCode>,
        > = wit_bindgen::rt::async_support::FutureVtable::<
            Result<(), super::super::wasi::filesystem::types::ErrorCode>,
        > {
            cancel_write,
            cancel_read,
            drop_writable,
            drop_readable,
            dealloc_lists,
            layout: unsafe { ::core::alloc::Layout::from_size_align_unchecked(20, 4) },
            lift,
            lower,
            new,
            start_read,
            start_write,
        };
        impl super::FuturePayload
        for Result<(), super::super::wasi::filesystem::types::ErrorCode> {
            const VTABLE: &'static wit_bindgen::rt::async_support::FutureVtable<Self> = &VTABLE;
        }
    }
    #[doc(hidden)]
    #[allow(unused_unsafe)]
    pub mod vtable2 {
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_write(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_read(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_writable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_readable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn new() -> u64 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_read(_: u32, _: *mut u8) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_write(_: u32, _: *const u8) -> u32 {
            unreachable!()
        }
        #[cfg(target_arch = "wasm32")]
        #[link(wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15")]
        unsafe extern "C" {
            #[link_name = "[future-new-1][method]tcp-socket.send"]
            fn new() -> u64;
            #[link_name = "[future-cancel-write-1][method]tcp-socket.send"]
            fn cancel_write(_: u32) -> u32;
            #[link_name = "[future-cancel-read-1][method]tcp-socket.send"]
            fn cancel_read(_: u32) -> u32;
            #[link_name = "[future-drop-writable-1][method]tcp-socket.send"]
            fn drop_writable(_: u32);
            #[link_name = "[future-drop-readable-1][method]tcp-socket.send"]
            fn drop_readable(_: u32);
            #[link_name = "[async-lower][future-read-1][method]tcp-socket.send"]
            fn start_read(_: u32, _: *mut u8) -> u32;
            #[link_name = "[async-lower][future-write-1][method]tcp-socket.send"]
            fn start_write(_: u32, _: *const u8) -> u32;
        }
        unsafe fn lift(
            ptr: *mut u8,
        ) -> Result<(), super::super::wasi::sockets::types::ErrorCode> {
            unsafe {
                let l0 = i32::from(*ptr.add(0).cast::<u8>());
                match l0 {
                    0 => {
                        let e = ();
                        Ok(e)
                    }
                    1 => {
                        let e = {
                            let l1 = i32::from(
                                *ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                            );
                            use super::super::wasi::sockets::types::ErrorCode as V6;
                            let v6 = match l1 {
                                0 => V6::AccessDenied,
                                1 => V6::NotSupported,
                                2 => V6::InvalidArgument,
                                3 => V6::OutOfMemory,
                                4 => V6::Timeout,
                                5 => V6::InvalidState,
                                6 => V6::AddressNotBindable,
                                7 => V6::AddressInUse,
                                8 => V6::RemoteUnreachable,
                                9 => V6::ConnectionRefused,
                                10 => V6::ConnectionBroken,
                                11 => V6::ConnectionReset,
                                12 => V6::ConnectionAborted,
                                13 => V6::DatagramTooLarge,
                                n => {
                                    debug_assert_eq!(n, 14, "invalid enum discriminant");
                                    let e6 = {
                                        let l2 = i32::from(
                                            *ptr
                                                .add(2 * ::core::mem::size_of::<*const u8>())
                                                .cast::<u8>(),
                                        );
                                        match l2 {
                                            0 => None,
                                            1 => {
                                                let e = {
                                                    let l3 = *ptr
                                                        .add(3 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<*mut u8>();
                                                    let l4 = *ptr
                                                        .add(4 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<usize>();
                                                    let len5 = l4;
                                                    let bytes5 = super::super::_rt::Vec::from_raw_parts(
                                                        l3.cast(),
                                                        len5,
                                                        len5,
                                                    );
                                                    super::super::_rt::string_lift(bytes5)
                                                };
                                                Some(e)
                                            }
                                            _ => super::super::_rt::invalid_enum_discriminant(),
                                        }
                                    };
                                    V6::Other(e6)
                                }
                            };
                            v6
                        };
                        Err(e)
                    }
                    _ => super::super::_rt::invalid_enum_discriminant(),
                }
            }
        }
        unsafe fn lower(
            value: Result<(), super::super::wasi::sockets::types::ErrorCode>,
            ptr: *mut u8,
        ) {
            unsafe {
                match value {
                    Ok(_) => {
                        *ptr.add(0).cast::<u8>() = (0i32) as u8;
                    }
                    Err(e) => {
                        *ptr.add(0).cast::<u8>() = (1i32) as u8;
                        use super::super::wasi::sockets::types::ErrorCode as V1;
                        match e {
                            V1::AccessDenied => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (0i32) as u8;
                            }
                            V1::NotSupported => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (1i32) as u8;
                            }
                            V1::InvalidArgument => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (2i32) as u8;
                            }
                            V1::OutOfMemory => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (3i32) as u8;
                            }
                            V1::Timeout => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (4i32) as u8;
                            }
                            V1::InvalidState => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (5i32) as u8;
                            }
                            V1::AddressNotBindable => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (6i32) as u8;
                            }
                            V1::AddressInUse => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (7i32) as u8;
                            }
                            V1::RemoteUnreachable => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (8i32) as u8;
                            }
                            V1::ConnectionRefused => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (9i32) as u8;
                            }
                            V1::ConnectionBroken => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (10i32) as u8;
                            }
                            V1::ConnectionReset => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (11i32) as u8;
                            }
                            V1::ConnectionAborted => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (12i32) as u8;
                            }
                            V1::DatagramTooLarge => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (13i32) as u8;
                            }
                            V1::Other(e) => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (14i32) as u8;
                                match e {
                                    Some(e) => {
                                        *ptr
                                            .add(2 * ::core::mem::size_of::<*const u8>())
                                            .cast::<u8>() = (1i32) as u8;
                                        let vec0 = (e.into_bytes()).into_boxed_slice();
                                        let ptr0 = vec0.as_ptr().cast::<u8>();
                                        let len0 = vec0.len();
                                        ::core::mem::forget(vec0);
                                        *ptr
                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                            .cast::<usize>() = len0;
                                        *ptr
                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                            .cast::<*mut u8>() = ptr0.cast_mut();
                                    }
                                    None => {
                                        *ptr
                                            .add(2 * ::core::mem::size_of::<*const u8>())
                                            .cast::<u8>() = (0i32) as u8;
                                    }
                                };
                            }
                        }
                    }
                };
            }
        }
        unsafe fn dealloc_lists(ptr: *mut u8) {
            unsafe {
                let l0 = i32::from(*ptr.add(0).cast::<u8>());
                match l0 {
                    0 => {}
                    _ => {
                        let l1 = i32::from(
                            *ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                        );
                        match l1 {
                            0 => {}
                            1 => {}
                            2 => {}
                            3 => {}
                            4 => {}
                            5 => {}
                            6 => {}
                            7 => {}
                            8 => {}
                            9 => {}
                            10 => {}
                            11 => {}
                            12 => {}
                            13 => {}
                            _ => {
                                let l2 = i32::from(
                                    *ptr
                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                        .cast::<u8>(),
                                );
                                match l2 {
                                    0 => {}
                                    _ => {
                                        let l3 = *ptr
                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                            .cast::<*mut u8>();
                                        let l4 = *ptr
                                            .add(4 * ::core::mem::size_of::<*const u8>())
                                            .cast::<usize>();
                                        super::super::_rt::cabi_dealloc(l3, l4, 1);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        pub static VTABLE: wit_bindgen::rt::async_support::FutureVtable<
            Result<(), super::super::wasi::sockets::types::ErrorCode>,
        > = wit_bindgen::rt::async_support::FutureVtable::<
            Result<(), super::super::wasi::sockets::types::ErrorCode>,
        > {
            cancel_write,
            cancel_read,
            drop_writable,
            drop_readable,
            dealloc_lists,
            layout: unsafe { ::core::alloc::Layout::from_size_align_unchecked(20, 4) },
            lift,
            lower,
            new,
            start_read,
            start_write,
        };
        impl super::FuturePayload
        for Result<(), super::super::wasi::sockets::types::ErrorCode> {
            const VTABLE: &'static wit_bindgen::rt::async_support::FutureVtable<Self> = &VTABLE;
        }
    }
    /// Creates a new Component Model `future` with the specified payload type.
    ///
    /// The `default` function provided computes the default value to be sent in
    /// this future if no other value was otherwise sent.
    pub fn new<T: FuturePayload>(
        default: fn() -> T,
    ) -> (
        wit_bindgen::rt::async_support::FutureWriter<T>,
        wit_bindgen::rt::async_support::FutureReader<T>,
    ) {
        unsafe { wit_bindgen::rt::async_support::future_new::<T>(default, T::VTABLE) }
    }
}
pub mod wit_stream {
    #![allow(dead_code, unused_variables, clippy::all)]
    pub trait StreamPayload: Unpin + Sized + 'static {
        const VTABLE: &'static wit_bindgen::rt::async_support::StreamVtable<Self>;
    }
    #[doc(hidden)]
    #[allow(unused_unsafe)]
    pub mod vtable0 {
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_write(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_read(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_writable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_readable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn new() -> u64 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_read(_: u32, _: *mut u8, _: usize) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_write(_: u32, _: *const u8, _: usize) -> u32 {
            unreachable!()
        }
        #[cfg(target_arch = "wasm32")]
        #[link(wasm_import_module = "wasi:cli/stdin@0.3.0-rc-2026-03-15")]
        unsafe extern "C" {
            #[link_name = "[stream-new-0]read-via-stream"]
            fn new() -> u64;
            #[link_name = "[stream-cancel-write-0]read-via-stream"]
            fn cancel_write(_: u32) -> u32;
            #[link_name = "[stream-cancel-read-0]read-via-stream"]
            fn cancel_read(_: u32) -> u32;
            #[link_name = "[stream-drop-writable-0]read-via-stream"]
            fn drop_writable(_: u32);
            #[link_name = "[stream-drop-readable-0]read-via-stream"]
            fn drop_readable(_: u32);
            #[link_name = "[async-lower][stream-read-0]read-via-stream"]
            fn start_read(_: u32, _: *mut u8, _: usize) -> u32;
            #[link_name = "[async-lower][stream-write-0]read-via-stream"]
            fn start_write(_: u32, _: *const u8, _: usize) -> u32;
        }
        pub static VTABLE: wit_bindgen::rt::async_support::StreamVtable<u8> = wit_bindgen::rt::async_support::StreamVtable::<
            u8,
        > {
            cancel_write,
            cancel_read,
            drop_writable,
            drop_readable,
            dealloc_lists: None,
            layout: unsafe { ::core::alloc::Layout::from_size_align_unchecked(1, 1) },
            lift: None,
            lower: None,
            new,
            start_read,
            start_write,
        };
        impl super::StreamPayload for u8 {
            const VTABLE: &'static wit_bindgen::rt::async_support::StreamVtable<Self> = &VTABLE;
        }
    }
    #[doc(hidden)]
    #[allow(unused_unsafe)]
    pub mod vtable1 {
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_write(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_read(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_writable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_readable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn new() -> u64 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_read(_: u32, _: *mut u8, _: usize) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_write(_: u32, _: *const u8, _: usize) -> u32 {
            unreachable!()
        }
        #[cfg(target_arch = "wasm32")]
        #[link(wasm_import_module = "wasi:filesystem/types@0.3.0-rc-2026-03-15")]
        unsafe extern "C" {
            #[link_name = "[stream-new-0][method]descriptor.read-directory"]
            fn new() -> u64;
            #[link_name = "[stream-cancel-write-0][method]descriptor.read-directory"]
            fn cancel_write(_: u32) -> u32;
            #[link_name = "[stream-cancel-read-0][method]descriptor.read-directory"]
            fn cancel_read(_: u32) -> u32;
            #[link_name = "[stream-drop-writable-0][method]descriptor.read-directory"]
            fn drop_writable(_: u32);
            #[link_name = "[stream-drop-readable-0][method]descriptor.read-directory"]
            fn drop_readable(_: u32);
            #[link_name = "[async-lower][stream-read-0][method]descriptor.read-directory"]
            fn start_read(_: u32, _: *mut u8, _: usize) -> u32;
            #[link_name = "[async-lower][stream-write-0][method]descriptor.read-directory"]
            fn start_write(_: u32, _: *const u8, _: usize) -> u32;
        }
        unsafe fn lift(
            ptr: *mut u8,
        ) -> super::super::wasi::filesystem::types::DirectoryEntry {
            unsafe {
                let l0 = i32::from(*ptr.add(0).cast::<u8>());
                use super::super::wasi::filesystem::types::DescriptorType as V5;
                let v5 = match l0 {
                    0 => V5::BlockDevice,
                    1 => V5::CharacterDevice,
                    2 => V5::Directory,
                    3 => V5::Fifo,
                    4 => V5::SymbolicLink,
                    5 => V5::RegularFile,
                    6 => V5::Socket,
                    n => {
                        debug_assert_eq!(n, 7, "invalid enum discriminant");
                        let e5 = {
                            let l1 = i32::from(
                                *ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                            );
                            match l1 {
                                0 => None,
                                1 => {
                                    let e = {
                                        let l2 = *ptr
                                            .add(2 * ::core::mem::size_of::<*const u8>())
                                            .cast::<*mut u8>();
                                        let l3 = *ptr
                                            .add(3 * ::core::mem::size_of::<*const u8>())
                                            .cast::<usize>();
                                        let len4 = l3;
                                        let bytes4 = super::super::_rt::Vec::from_raw_parts(
                                            l2.cast(),
                                            len4,
                                            len4,
                                        );
                                        super::super::_rt::string_lift(bytes4)
                                    };
                                    Some(e)
                                }
                                _ => super::super::_rt::invalid_enum_discriminant(),
                            }
                        };
                        V5::Other(e5)
                    }
                };
                let l6 = *ptr
                    .add(4 * ::core::mem::size_of::<*const u8>())
                    .cast::<*mut u8>();
                let l7 = *ptr
                    .add(5 * ::core::mem::size_of::<*const u8>())
                    .cast::<usize>();
                let len8 = l7;
                let bytes8 = super::super::_rt::Vec::from_raw_parts(
                    l6.cast(),
                    len8,
                    len8,
                );
                super::super::wasi::filesystem::types::DirectoryEntry {
                    type_: v5,
                    name: super::super::_rt::string_lift(bytes8),
                }
            }
        }
        unsafe fn lower(
            value: super::super::wasi::filesystem::types::DirectoryEntry,
            ptr: *mut u8,
        ) {
            unsafe {
                let super::super::wasi::filesystem::types::DirectoryEntry {
                    type_: type_0,
                    name: name0,
                } = value;
                use super::super::wasi::filesystem::types::DescriptorType as V2;
                match type_0 {
                    V2::BlockDevice => {
                        *ptr.add(0).cast::<u8>() = (0i32) as u8;
                    }
                    V2::CharacterDevice => {
                        *ptr.add(0).cast::<u8>() = (1i32) as u8;
                    }
                    V2::Directory => {
                        *ptr.add(0).cast::<u8>() = (2i32) as u8;
                    }
                    V2::Fifo => {
                        *ptr.add(0).cast::<u8>() = (3i32) as u8;
                    }
                    V2::SymbolicLink => {
                        *ptr.add(0).cast::<u8>() = (4i32) as u8;
                    }
                    V2::RegularFile => {
                        *ptr.add(0).cast::<u8>() = (5i32) as u8;
                    }
                    V2::Socket => {
                        *ptr.add(0).cast::<u8>() = (6i32) as u8;
                    }
                    V2::Other(e) => {
                        *ptr.add(0).cast::<u8>() = (7i32) as u8;
                        match e {
                            Some(e) => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (1i32) as u8;
                                let vec1 = (e.into_bytes()).into_boxed_slice();
                                let ptr1 = vec1.as_ptr().cast::<u8>();
                                let len1 = vec1.len();
                                ::core::mem::forget(vec1);
                                *ptr
                                    .add(3 * ::core::mem::size_of::<*const u8>())
                                    .cast::<usize>() = len1;
                                *ptr
                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                    .cast::<*mut u8>() = ptr1.cast_mut();
                            }
                            None => {
                                *ptr
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<u8>() = (0i32) as u8;
                            }
                        };
                    }
                }
                let vec3 = (name0.into_bytes()).into_boxed_slice();
                let ptr3 = vec3.as_ptr().cast::<u8>();
                let len3 = vec3.len();
                ::core::mem::forget(vec3);
                *ptr.add(5 * ::core::mem::size_of::<*const u8>()).cast::<usize>() = len3;
                *ptr.add(4 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>() = ptr3
                    .cast_mut();
            }
        }
        unsafe fn dealloc_lists(ptr: *mut u8) {
            unsafe {
                let l0 = i32::from(*ptr.add(0).cast::<u8>());
                match l0 {
                    0 => {}
                    1 => {}
                    2 => {}
                    3 => {}
                    4 => {}
                    5 => {}
                    6 => {}
                    _ => {
                        let l1 = i32::from(
                            *ptr.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                        );
                        match l1 {
                            0 => {}
                            _ => {
                                let l2 = *ptr
                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                    .cast::<*mut u8>();
                                let l3 = *ptr
                                    .add(3 * ::core::mem::size_of::<*const u8>())
                                    .cast::<usize>();
                                super::super::_rt::cabi_dealloc(l2, l3, 1);
                            }
                        }
                    }
                }
                let l4 = *ptr
                    .add(4 * ::core::mem::size_of::<*const u8>())
                    .cast::<*mut u8>();
                let l5 = *ptr
                    .add(5 * ::core::mem::size_of::<*const u8>())
                    .cast::<usize>();
                super::super::_rt::cabi_dealloc(l4, l5, 1);
            }
        }
        pub static VTABLE: wit_bindgen::rt::async_support::StreamVtable<
            super::super::wasi::filesystem::types::DirectoryEntry,
        > = wit_bindgen::rt::async_support::StreamVtable::<
            super::super::wasi::filesystem::types::DirectoryEntry,
        > {
            cancel_write,
            cancel_read,
            drop_writable,
            drop_readable,
            dealloc_lists: Some(dealloc_lists),
            layout: unsafe { ::core::alloc::Layout::from_size_align_unchecked(24, 4) },
            lift: Some(lift),
            lower: Some(lower),
            new,
            start_read,
            start_write,
        };
        impl super::StreamPayload
        for super::super::wasi::filesystem::types::DirectoryEntry {
            const VTABLE: &'static wit_bindgen::rt::async_support::StreamVtable<Self> = &VTABLE;
        }
    }
    #[doc(hidden)]
    #[allow(unused_unsafe)]
    pub mod vtable2 {
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_write(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn cancel_read(_: u32) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_writable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn drop_readable(_: u32) {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn new() -> u64 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_read(_: u32, _: *mut u8, _: usize) -> u32 {
            unreachable!()
        }
        #[cfg(not(target_arch = "wasm32"))]
        unsafe extern "C" fn start_write(_: u32, _: *const u8, _: usize) -> u32 {
            unreachable!()
        }
        #[cfg(target_arch = "wasm32")]
        #[link(wasm_import_module = "wasi:sockets/types@0.3.0-rc-2026-03-15")]
        unsafe extern "C" {
            #[link_name = "[stream-new-0][method]tcp-socket.listen"]
            fn new() -> u64;
            #[link_name = "[stream-cancel-write-0][method]tcp-socket.listen"]
            fn cancel_write(_: u32) -> u32;
            #[link_name = "[stream-cancel-read-0][method]tcp-socket.listen"]
            fn cancel_read(_: u32) -> u32;
            #[link_name = "[stream-drop-writable-0][method]tcp-socket.listen"]
            fn drop_writable(_: u32);
            #[link_name = "[stream-drop-readable-0][method]tcp-socket.listen"]
            fn drop_readable(_: u32);
            #[link_name = "[async-lower][stream-read-0][method]tcp-socket.listen"]
            fn start_read(_: u32, _: *mut u8, _: usize) -> u32;
            #[link_name = "[async-lower][stream-write-0][method]tcp-socket.listen"]
            fn start_write(_: u32, _: *const u8, _: usize) -> u32;
        }
        unsafe fn lift(ptr: *mut u8) -> super::super::wasi::sockets::types::TcpSocket {
            unsafe {
                let l0 = *ptr.add(0).cast::<i32>();
                super::super::wasi::sockets::types::TcpSocket::from_handle(l0 as u32)
            }
        }
        unsafe fn lower(
            value: super::super::wasi::sockets::types::TcpSocket,
            ptr: *mut u8,
        ) {
            unsafe {
                *ptr.add(0).cast::<i32>() = (value).take_handle() as i32;
            }
        }
        unsafe fn dealloc_lists(ptr: *mut u8) {
            unsafe {}
        }
        pub static VTABLE: wit_bindgen::rt::async_support::StreamVtable<
            super::super::wasi::sockets::types::TcpSocket,
        > = wit_bindgen::rt::async_support::StreamVtable::<
            super::super::wasi::sockets::types::TcpSocket,
        > {
            cancel_write,
            cancel_read,
            drop_writable,
            drop_readable,
            dealloc_lists: Some(dealloc_lists),
            layout: unsafe { ::core::alloc::Layout::from_size_align_unchecked(4, 4) },
            lift: Some(lift),
            lower: Some(lower),
            new,
            start_read,
            start_write,
        };
        impl super::StreamPayload for super::super::wasi::sockets::types::TcpSocket {
            const VTABLE: &'static wit_bindgen::rt::async_support::StreamVtable<Self> = &VTABLE;
        }
    }
    /// Creates a new Component Model `stream` with the specified payload type.
    pub fn new<T: StreamPayload>() -> (
        wit_bindgen::rt::async_support::StreamWriter<T>,
        wit_bindgen::rt::async_support::StreamReader<T>,
    ) {
        unsafe { wit_bindgen::rt::async_support::stream_new::<T>(T::VTABLE) }
    }
}
#[rustfmt::skip]
#[cfg(target_arch = "wasm32")]

#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.57.1:wasi:cli@0.3.0-rc-2026-03-15:imports:encoded worldrust-wasip3-0.6.0+wasi-0.3.0-rc-2026-03-15-from-crates-io-in-libstd"))]
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.57.1:wasi:cli@0.3.0-rc-2026-03-15:imports:encoded worldrust-wasip3-0.6.0+wasi-0.3.0-rc-2026-03-15-from-crates-io"))]

#[doc(hidden)]
#[allow(clippy::octal_escapes)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 8162] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xe4>\x01A\x02\x01A1\x01\
B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0fget-environment\x01\x02\x01ps\x01@\
\0\0\x03\x04\0\x0dget-arguments\x01\x04\x01ks\x01@\0\0\x05\x04\0\x0fget-initial-\
cwd\x01\x06\x03\0(wasi:cli/environment@0.3.0-rc-2026-03-15\x05\0\x01B\x03\x01j\0\
\0\x01@\x01\x06status\0\x01\0\x04\0\x04exit\x01\x01\x03\0!wasi:cli/exit@0.3.0-rc\
-2026-03-15\x05\x01\x01B\x02\x01m\x03\x02io\x15illegal-byte-sequence\x04pipe\x04\
\0\x0aerror-code\x03\0\0\x03\0\"wasi:cli/types@0.3.0-rc-2026-03-15\x05\x02\x02\x03\
\0\x02\x0aerror-code\x01B\x08\x02\x03\x02\x01\x03\x04\0\x0aerror-code\x03\0\0\x01\
f\x01}\x01j\0\x01\x01\x01e\x01\x03\x01o\x02\x02\x04\x01@\0\0\x05\x04\0\x0fread-v\
ia-stream\x01\x06\x03\0\"wasi:cli/stdin@0.3.0-rc-2026-03-15\x05\x04\x01B\x07\x02\
\x03\x02\x01\x03\x04\0\x0aerror-code\x03\0\0\x01f\x01}\x01j\0\x01\x01\x01e\x01\x03\
\x01@\x01\x04data\x02\0\x04\x04\0\x10write-via-stream\x01\x05\x03\0#wasi:cli/std\
out@0.3.0-rc-2026-03-15\x05\x05\x01B\x07\x02\x03\x02\x01\x03\x04\0\x0aerror-code\
\x03\0\0\x01f\x01}\x01j\0\x01\x01\x01e\x01\x03\x01@\x01\x04data\x02\0\x04\x04\0\x10\
write-via-stream\x01\x05\x03\0#wasi:cli/stderr@0.3.0-rc-2026-03-15\x05\x06\x01B\x01\
\x04\0\x0eterminal-input\x03\x01\x03\0+wasi:cli/terminal-input@0.3.0-rc-2026-03-\
15\x05\x07\x01B\x01\x04\0\x0fterminal-output\x03\x01\x03\0,wasi:cli/terminal-out\
put@0.3.0-rc-2026-03-15\x05\x08\x02\x03\0\x06\x0eterminal-input\x01B\x06\x02\x03\
\x02\x01\x09\x04\0\x0eterminal-input\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\
\x12get-terminal-stdin\x01\x04\x03\0+wasi:cli/terminal-stdin@0.3.0-rc-2026-03-15\
\x05\x0a\x02\x03\0\x07\x0fterminal-output\x01B\x06\x02\x03\x02\x01\x0b\x04\0\x0f\
terminal-output\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-std\
out\x01\x04\x03\0,wasi:cli/terminal-stdout@0.3.0-rc-2026-03-15\x05\x0c\x01B\x06\x02\
\x03\x02\x01\x0b\x04\0\x0fterminal-output\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\
\x04\0\x13get-terminal-stderr\x01\x04\x03\0,wasi:cli/terminal-stderr@0.3.0-rc-20\
26-03-15\x05\x0d\x01B\x02\x01w\x04\0\x08duration\x03\0\0\x03\0%wasi:clocks/types\
@0.3.0-rc-2026-03-15\x05\x0e\x02\x03\0\x0b\x08duration\x01B\x0c\x02\x03\x02\x01\x0f\
\x04\0\x08duration\x03\0\0\x01w\x04\0\x04mark\x03\0\x02\x01@\0\0\x03\x04\0\x03no\
w\x01\x04\x01@\0\0\x01\x04\0\x0eget-resolution\x01\x05\x01C\x01\x04when\x03\x01\0\
\x04\0\x0await-until\x01\x06\x01C\x01\x08how-long\x01\x01\0\x04\0\x08wait-for\x01\
\x07\x03\0/wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15\x05\x10\x01B\x08\x02\x03\
\x02\x01\x0f\x04\0\x08duration\x03\0\0\x01r\x02\x07secondsx\x0bnanosecondsy\x04\0\
\x07instant\x03\0\x02\x01@\0\0\x03\x04\0\x03now\x01\x04\x01@\0\0\x01\x04\0\x0ege\
t-resolution\x01\x05\x03\0,wasi:clocks/system-clock@0.3.0-rc-2026-03-15\x05\x11\x02\
\x03\0\x0d\x07instant\x01BZ\x02\x03\x02\x01\x12\x04\0\x07instant\x03\0\0\x01w\x04\
\0\x08filesize\x03\0\x02\x01ks\x01q\x08\x0cblock-device\0\0\x10character-device\0\
\0\x09directory\0\0\x04fifo\0\0\x0dsymbolic-link\0\0\x0cregular-file\0\0\x06sock\
et\0\0\x05other\x01\x04\0\x04\0\x0fdescriptor-type\x03\0\x05\x01n\x06\x04read\x05\
write\x13file-integrity-sync\x13data-integrity-sync\x14requested-write-sync\x10m\
utate-directory\x04\0\x10descriptor-flags\x03\0\x07\x01n\x01\x0esymlink-follow\x04\
\0\x0apath-flags\x03\0\x09\x01n\x04\x06create\x09directory\x09exclusive\x08trunc\
ate\x04\0\x0aopen-flags\x03\0\x0b\x01w\x04\0\x0alink-count\x03\0\x0d\x01k\x01\x01\
r\x06\x04type\x06\x0alink-count\x0e\x04size\x03\x15data-access-timestamp\x0f\x1b\
data-modification-timestamp\x0f\x17status-change-timestamp\x0f\x04\0\x0fdescript\
or-stat\x03\0\x10\x01q\x03\x09no-change\0\0\x03now\0\0\x09timestamp\x01\x01\0\x04\
\0\x0dnew-timestamp\x03\0\x12\x01r\x02\x04type\x06\x04names\x04\0\x0fdirectory-e\
ntry\x03\0\x14\x01q%\x06access\0\0\x07already\0\0\x0ebad-descriptor\0\0\x04busy\0\
\0\x08deadlock\0\0\x05quota\0\0\x05exist\0\0\x0efile-too-large\0\0\x15illegal-by\
te-sequence\0\0\x0bin-progress\0\0\x0binterrupted\0\0\x07invalid\0\0\x02io\0\0\x0c\
is-directory\0\0\x04loop\0\0\x0etoo-many-links\0\0\x0cmessage-size\0\0\x0dname-t\
oo-long\0\0\x09no-device\0\0\x08no-entry\0\0\x07no-lock\0\0\x13insufficient-memo\
ry\0\0\x12insufficient-space\0\0\x0dnot-directory\0\0\x09not-empty\0\0\x0fnot-re\
coverable\0\0\x0bunsupported\0\0\x06no-tty\0\0\x0eno-such-device\0\0\x08overflow\
\0\0\x0dnot-permitted\0\0\x04pipe\0\0\x09read-only\0\0\x0cinvalid-seek\0\0\x0ete\
xt-file-busy\0\0\x0ccross-device\0\0\x05other\x01\x04\0\x04\0\x0aerror-code\x03\0\
\x16\x01m\x06\x06normal\x0asequential\x06random\x09will-need\x09dont-need\x08no-\
reuse\x04\0\x06advice\x03\0\x18\x01r\x02\x05lowerw\x05upperw\x04\0\x13metadata-h\
ash-value\x03\0\x1a\x04\0\x0adescriptor\x03\x01\x01h\x1c\x01f\x01}\x01j\0\x01\x17\
\x01e\x01\x1f\x01o\x02\x1e\x20\x01@\x02\x04self\x1d\x06offset\x03\0!\x04\0\"[met\
hod]descriptor.read-via-stream\x01\"\x01@\x03\x04self\x1d\x04data\x1e\x06offset\x03\
\0\x20\x04\0#[method]descriptor.write-via-stream\x01#\x01@\x02\x04self\x1d\x04da\
ta\x1e\0\x20\x04\0$[method]descriptor.append-via-stream\x01$\x01C\x04\x04self\x1d\
\x06offset\x03\x06length\x03\x06advice\x19\0\x1f\x04\0\x19[method]descriptor.adv\
ise\x01%\x01C\x01\x04self\x1d\0\x1f\x04\0\x1c[method]descriptor.sync-data\x01&\x01\
j\x01\x08\x01\x17\x01C\x01\x04self\x1d\0'\x04\0\x1c[method]descriptor.get-flags\x01\
(\x01j\x01\x06\x01\x17\x01C\x01\x04self\x1d\0)\x04\0\x1b[method]descriptor.get-t\
ype\x01*\x01C\x02\x04self\x1d\x04size\x03\0\x1f\x04\0\x1b[method]descriptor.set-\
size\x01+\x01C\x03\x04self\x1d\x15data-access-timestamp\x13\x1bdata-modification\
-timestamp\x13\0\x1f\x04\0\x1c[method]descriptor.set-times\x01,\x01f\x01\x15\x01\
o\x02-\x20\x01@\x01\x04self\x1d\0.\x04\0![method]descriptor.read-directory\x01/\x04\
\0\x17[method]descriptor.sync\x01&\x01C\x02\x04self\x1d\x04paths\0\x1f\x04\0&[me\
thod]descriptor.create-directory-at\x010\x01j\x01\x11\x01\x17\x01C\x01\x04self\x1d\
\01\x04\0\x17[method]descriptor.stat\x012\x01C\x03\x04self\x1d\x0apath-flags\x0a\
\x04paths\01\x04\0\x1a[method]descriptor.stat-at\x013\x01C\x05\x04self\x1d\x0apa\
th-flags\x0a\x04paths\x15data-access-timestamp\x13\x1bdata-modification-timestam\
p\x13\0\x1f\x04\0\x1f[method]descriptor.set-times-at\x014\x01C\x05\x04self\x1d\x0e\
old-path-flags\x0a\x08old-paths\x0enew-descriptor\x1d\x08new-paths\0\x1f\x04\0\x1a\
[method]descriptor.link-at\x015\x01i\x1c\x01j\x016\x01\x17\x01C\x05\x04self\x1d\x0a\
path-flags\x0a\x04paths\x0aopen-flags\x0c\x05flags\x08\07\x04\0\x1a[method]descr\
iptor.open-at\x018\x01j\x01s\x01\x17\x01C\x02\x04self\x1d\x04paths\09\x04\0\x1e[\
method]descriptor.readlink-at\x01:\x04\0&[method]descriptor.remove-directory-at\x01\
0\x01C\x04\x04self\x1d\x08old-paths\x0enew-descriptor\x1d\x08new-paths\0\x1f\x04\
\0\x1c[method]descriptor.rename-at\x01;\x01C\x03\x04self\x1d\x08old-paths\x08new\
-paths\0\x1f\x04\0\x1d[method]descriptor.symlink-at\x01<\x04\0![method]descripto\
r.unlink-file-at\x010\x01C\x02\x04self\x1d\x05other\x1d\0\x7f\x04\0![method]desc\
riptor.is-same-object\x01=\x01j\x01\x1b\x01\x17\x01C\x01\x04self\x1d\0>\x04\0\x20\
[method]descriptor.metadata-hash\x01?\x01C\x03\x04self\x1d\x0apath-flags\x0a\x04\
paths\0>\x04\0#[method]descriptor.metadata-hash-at\x01@\x03\0)wasi:filesystem/ty\
pes@0.3.0-rc-2026-03-15\x05\x13\x02\x03\0\x0e\x0adescriptor\x01B\x07\x02\x03\x02\
\x01\x14\x04\0\x0adescriptor\x03\0\0\x01i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\x04\
\x04\0\x0fget-directories\x01\x05\x03\0,wasi:filesystem/preopens@0.3.0-rc-2026-0\
3-15\x05\x15\x01Br\x02\x03\x02\x01\x0f\x04\0\x08duration\x03\0\0\x01ks\x01q\x0f\x0d\
access-denied\0\0\x0dnot-supported\0\0\x10invalid-argument\0\0\x0dout-of-memory\0\
\0\x07timeout\0\0\x0dinvalid-state\0\0\x14address-not-bindable\0\0\x0eaddress-in\
-use\0\0\x12remote-unreachable\0\0\x12connection-refused\0\0\x11connection-broke\
n\0\0\x10connection-reset\0\0\x12connection-aborted\0\0\x12datagram-too-large\0\0\
\x05other\x01\x02\0\x04\0\x0aerror-code\x03\0\x03\x01m\x02\x04ipv4\x04ipv6\x04\0\
\x11ip-address-family\x03\0\x05\x01o\x04}}}}\x04\0\x0cipv4-address\x03\0\x07\x01\
o\x08{{{{{{{{\x04\0\x0cipv6-address\x03\0\x09\x01q\x02\x04ipv4\x01\x08\0\x04ipv6\
\x01\x0a\0\x04\0\x0aip-address\x03\0\x0b\x01r\x02\x04port{\x07address\x08\x04\0\x13\
ipv4-socket-address\x03\0\x0d\x01r\x04\x04port{\x09flow-infoy\x07address\x0a\x08\
scope-idy\x04\0\x13ipv6-socket-address\x03\0\x0f\x01q\x02\x04ipv4\x01\x0e\0\x04i\
pv6\x01\x10\0\x04\0\x11ip-socket-address\x03\0\x11\x04\0\x0atcp-socket\x03\x01\x04\
\0\x0audp-socket\x03\x01\x01i\x13\x01j\x01\x15\x01\x04\x01@\x01\x0eaddress-famil\
y\x06\0\x16\x04\0\x19[static]tcp-socket.create\x01\x17\x01h\x13\x01j\0\x01\x04\x01\
@\x02\x04self\x18\x0dlocal-address\x12\0\x19\x04\0\x17[method]tcp-socket.bind\x01\
\x1a\x01C\x02\x04self\x18\x0eremote-address\x12\0\x19\x04\0\x1a[method]tcp-socke\
t.connect\x01\x1b\x01f\x01\x15\x01j\x01\x1c\x01\x04\x01@\x01\x04self\x18\0\x1d\x04\
\0\x19[method]tcp-socket.listen\x01\x1e\x01f\x01}\x01e\x01\x19\x01@\x02\x04self\x18\
\x04data\x1f\0\x20\x04\0\x17[method]tcp-socket.send\x01!\x01o\x02\x1f\x20\x01@\x01\
\x04self\x18\0\"\x04\0\x1a[method]tcp-socket.receive\x01#\x01j\x01\x12\x01\x04\x01\
@\x01\x04self\x18\0$\x04\0$[method]tcp-socket.get-local-address\x01%\x04\0%[meth\
od]tcp-socket.get-remote-address\x01%\x01@\x01\x04self\x18\0\x7f\x04\0#[method]t\
cp-socket.get-is-listening\x01&\x01@\x01\x04self\x18\0\x06\x04\0%[method]tcp-soc\
ket.get-address-family\x01'\x01@\x02\x04self\x18\x05valuew\0\x19\x04\0*[method]t\
cp-socket.set-listen-backlog-size\x01(\x01j\x01\x7f\x01\x04\x01@\x01\x04self\x18\
\0)\x04\0)[method]tcp-socket.get-keep-alive-enabled\x01*\x01@\x02\x04self\x18\x05\
value\x7f\0\x19\x04\0)[method]tcp-socket.set-keep-alive-enabled\x01+\x01j\x01\x01\
\x01\x04\x01@\x01\x04self\x18\0,\x04\0+[method]tcp-socket.get-keep-alive-idle-ti\
me\x01-\x01@\x02\x04self\x18\x05value\x01\0\x19\x04\0+[method]tcp-socket.set-kee\
p-alive-idle-time\x01.\x04\0*[method]tcp-socket.get-keep-alive-interval\x01-\x04\
\0*[method]tcp-socket.set-keep-alive-interval\x01.\x01j\x01y\x01\x04\x01@\x01\x04\
self\x18\0/\x04\0'[method]tcp-socket.get-keep-alive-count\x010\x01@\x02\x04self\x18\
\x05valuey\0\x19\x04\0'[method]tcp-socket.set-keep-alive-count\x011\x01j\x01}\x01\
\x04\x01@\x01\x04self\x18\02\x04\0\x20[method]tcp-socket.get-hop-limit\x013\x01@\
\x02\x04self\x18\x05value}\0\x19\x04\0\x20[method]tcp-socket.set-hop-limit\x014\x01\
j\x01w\x01\x04\x01@\x01\x04self\x18\05\x04\0*[method]tcp-socket.get-receive-buff\
er-size\x016\x04\0*[method]tcp-socket.set-receive-buffer-size\x01(\x04\0'[method\
]tcp-socket.get-send-buffer-size\x016\x04\0'[method]tcp-socket.set-send-buffer-s\
ize\x01(\x01i\x14\x01j\x017\x01\x04\x01@\x01\x0eaddress-family\x06\08\x04\0\x19[\
static]udp-socket.create\x019\x01h\x14\x01@\x02\x04self:\x0dlocal-address\x12\0\x19\
\x04\0\x17[method]udp-socket.bind\x01;\x01@\x02\x04self:\x0eremote-address\x12\0\
\x19\x04\0\x1a[method]udp-socket.connect\x01<\x01@\x01\x04self:\0\x19\x04\0\x1d[\
method]udp-socket.disconnect\x01=\x01p}\x01k\x12\x01C\x03\x04self:\x04data>\x0er\
emote-address?\0\x19\x04\0\x17[method]udp-socket.send\x01@\x01o\x02>\x12\x01j\x01\
\xc1\0\x01\x04\x01C\x01\x04self:\0\xc2\0\x04\0\x1a[method]udp-socket.receive\x01\
C\x01@\x01\x04self:\0$\x04\0$[method]udp-socket.get-local-address\x01D\x04\0%[me\
thod]udp-socket.get-remote-address\x01D\x01@\x01\x04self:\0\x06\x04\0%[method]ud\
p-socket.get-address-family\x01E\x01@\x01\x04self:\02\x04\0([method]udp-socket.g\
et-unicast-hop-limit\x01F\x01@\x02\x04self:\x05value}\0\x19\x04\0([method]udp-so\
cket.set-unicast-hop-limit\x01G\x01@\x01\x04self:\05\x04\0*[method]udp-socket.ge\
t-receive-buffer-size\x01H\x01@\x02\x04self:\x05valuew\0\x19\x04\0*[method]udp-s\
ocket.set-receive-buffer-size\x01I\x04\0'[method]udp-socket.get-send-buffer-size\
\x01H\x04\0'[method]udp-socket.set-send-buffer-size\x01I\x03\0&wasi:sockets/type\
s@0.3.0-rc-2026-03-15\x05\x16\x02\x03\0\x10\x0aip-address\x01B\x09\x02\x03\x02\x01\
\x17\x04\0\x0aip-address\x03\0\0\x01ks\x01q\x06\x0daccess-denied\0\0\x10invalid-\
argument\0\0\x11name-unresolvable\0\0\x1atemporary-resolver-failure\0\0\x1aperma\
nent-resolver-failure\0\0\x05other\x01\x02\0\x04\0\x0aerror-code\x03\0\x03\x01p\x01\
\x01j\x01\x05\x01\x04\x01C\x01\x04names\0\x06\x04\0\x11resolve-addresses\x01\x07\
\x03\0/wasi:sockets/ip-name-lookup@0.3.0-rc-2026-03-15\x05\x18\x01B\x05\x01p}\x01\
@\x01\x07max-lenw\0\0\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-r\
andom-u64\x01\x02\x03\0&wasi:random/random@0.3.0-rc-2026-03-15\x05\x19\x01B\x05\x01\
p}\x01@\x01\x07max-lenw\0\0\x04\0\x19get-insecure-random-bytes\x01\x01\x01@\0\0w\
\x04\0\x17get-insecure-random-u64\x01\x02\x03\0(wasi:random/insecure@0.3.0-rc-20\
26-03-15\x05\x1a\x01B\x03\x01o\x02ww\x01@\0\0\0\x04\0\x11get-insecure-seed\x01\x01\
\x03\0-wasi:random/insecure-seed@0.3.0-rc-2026-03-15\x05\x1b\x04\0$wasi:cli/impo\
rts@0.3.0-rc-2026-03-15\x04\0\x0b\x0d\x01\0\x07imports\x03\0\0\0G\x09producers\x01\
\x0cprocessed-by\x02\x0dwit-component\x070.247.0\x10wit-bindgen-rust\x060.57.1";
#[inline(never)]
#[doc(hidden)]
pub fn __link_custom_section_describing_imports() {
    wit_bindgen::rt::maybe_link_cabi_realloc();
}
