// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT!
// Options used:
//   * runtime_path: "wit_bindgen_rt"
//   * with "wasi:clocks/wall-clock@0.2.3" = "wstd::wasi::clocks::wall_clock"
//   * with "wasi:io/poll@0.2.3" = "wstd::wasi::io::poll"
//   * generate_unused_types
use wstd::wasi::clocks::wall_clock as __with_name0;
use wstd::wasi::io::poll as __with_name1;
#[rustfmt::skip]
#[allow(dead_code, clippy::all)]
pub mod golem {
    pub mod rpc0_2_2 {
        #[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 Datetime = super::super::super::__with_name0::Datetime;
            pub type Pollable = super::super::super::__with_name1::Pollable;
            /// UUID
            #[repr(C)]
            #[derive(Clone, Copy)]
            pub struct Uuid {
                pub high_bits: u64,
                pub low_bits: u64,
            }
            impl ::core::fmt::Debug for Uuid {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    f.debug_struct("Uuid")
                        .field("high-bits", &self.high_bits)
                        .field("low-bits", &self.low_bits)
                        .finish()
                }
            }
            /// Represents a Golem component
            #[repr(C)]
            #[derive(Clone, Copy)]
            pub struct ComponentId {
                pub uuid: Uuid,
            }
            impl ::core::fmt::Debug for ComponentId {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    f.debug_struct("ComponentId").field("uuid", &self.uuid).finish()
                }
            }
            /// Represents a Golem agent
            #[derive(Clone)]
            pub struct AgentId {
                /// Identifies the component the agent belongs to
                pub component_id: ComponentId,
                /// String representation of the agent ID (agent type and constructor parameters)
                pub agent_id: _rt::String,
            }
            impl ::core::fmt::Debug for AgentId {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    f.debug_struct("AgentId")
                        .field("component-id", &self.component_id)
                        .field("agent-id", &self.agent_id)
                        .finish()
                }
            }
            /// The index type used in `wit-value` and `wit-type` to identify nodes
            pub type NodeIndex = i32;
            /// Represents a WIT resource in an instance
            pub type ResourceId = u64;
            /// Resource handle modes
            #[repr(u8)]
            #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
            pub enum ResourceMode {
                /// The resource is owned by this handle
                Owned,
                /// The resource is owned by someone else, and this handle is just a borrow
                Borrowed,
            }
            impl ::core::fmt::Debug for ResourceMode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        ResourceMode::Owned => {
                            f.debug_tuple("ResourceMode::Owned").finish()
                        }
                        ResourceMode::Borrowed => {
                            f.debug_tuple("ResourceMode::Borrowed").finish()
                        }
                    }
                }
            }
            impl ResourceMode {
                #[doc(hidden)]
                pub unsafe fn _lift(val: u8) -> ResourceMode {
                    if !cfg!(debug_assertions) {
                        return ::core::mem::transmute(val);
                    }
                    match val {
                        0 => ResourceMode::Owned,
                        1 => ResourceMode::Borrowed,
                        _ => panic!("invalid enum discriminant"),
                    }
                }
            }
            /// Represents a type within a `wit-type` definition. `node-index` values are indices into the
            /// parent `wit-type`'s `nodes` list.
            #[derive(Clone)]
            pub enum WitTypeNode {
                /// Record type, defined by a list of name-type pairs.
                RecordType(_rt::Vec<(_rt::String, NodeIndex)>),
                /// Variant type, defined by a list of name-type pairs. The type is optional, in case it is not defined, the case
                /// is a unit case.
                VariantType(_rt::Vec<(_rt::String, Option<NodeIndex>)>),
                /// Enum type, defined by a list of its cases.
                EnumType(_rt::Vec<_rt::String>),
                /// Flags type, defined by a list of its flags.
                FlagsType(_rt::Vec<_rt::String>),
                /// Tuple type, defined by a list of its field's types.
                TupleType(_rt::Vec<NodeIndex>),
                /// List type, defined by the element type
                ListType(NodeIndex),
                /// Option type, defined by the element type
                OptionType(NodeIndex),
                /// Result type, defined by the success and error types. Both types are optional, in case they are not defined, the
                /// ok or error case is a unit case.
                ResultType((Option<NodeIndex>, Option<NodeIndex>)),
                /// Unsigned 8-bit integer
                PrimU8Type,
                /// Unsigned 16-bit integer
                PrimU16Type,
                /// Unsigned 32-bit integer
                PrimU32Type,
                /// Unsigned 64-bit integer
                PrimU64Type,
                /// Signed 8-bit integer
                PrimS8Type,
                /// Signed 16-bit integer
                PrimS16Type,
                /// Signed 32-bit integer
                PrimS32Type,
                /// Signed 64-bit integer
                PrimS64Type,
                /// 32-bit floating point number
                PrimF32Type,
                /// 64-bit floating point number
                PrimF64Type,
                /// Unicode character
                PrimCharType,
                /// Boolean value
                PrimBoolType,
                /// String value
                PrimStringType,
                /// Handle type, defined by a resource ID and borrowing mode
                HandleType((ResourceId, ResourceMode)),
            }
            impl ::core::fmt::Debug for WitTypeNode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        WitTypeNode::RecordType(e) => {
                            f.debug_tuple("WitTypeNode::RecordType").field(e).finish()
                        }
                        WitTypeNode::VariantType(e) => {
                            f.debug_tuple("WitTypeNode::VariantType").field(e).finish()
                        }
                        WitTypeNode::EnumType(e) => {
                            f.debug_tuple("WitTypeNode::EnumType").field(e).finish()
                        }
                        WitTypeNode::FlagsType(e) => {
                            f.debug_tuple("WitTypeNode::FlagsType").field(e).finish()
                        }
                        WitTypeNode::TupleType(e) => {
                            f.debug_tuple("WitTypeNode::TupleType").field(e).finish()
                        }
                        WitTypeNode::ListType(e) => {
                            f.debug_tuple("WitTypeNode::ListType").field(e).finish()
                        }
                        WitTypeNode::OptionType(e) => {
                            f.debug_tuple("WitTypeNode::OptionType").field(e).finish()
                        }
                        WitTypeNode::ResultType(e) => {
                            f.debug_tuple("WitTypeNode::ResultType").field(e).finish()
                        }
                        WitTypeNode::PrimU8Type => {
                            f.debug_tuple("WitTypeNode::PrimU8Type").finish()
                        }
                        WitTypeNode::PrimU16Type => {
                            f.debug_tuple("WitTypeNode::PrimU16Type").finish()
                        }
                        WitTypeNode::PrimU32Type => {
                            f.debug_tuple("WitTypeNode::PrimU32Type").finish()
                        }
                        WitTypeNode::PrimU64Type => {
                            f.debug_tuple("WitTypeNode::PrimU64Type").finish()
                        }
                        WitTypeNode::PrimS8Type => {
                            f.debug_tuple("WitTypeNode::PrimS8Type").finish()
                        }
                        WitTypeNode::PrimS16Type => {
                            f.debug_tuple("WitTypeNode::PrimS16Type").finish()
                        }
                        WitTypeNode::PrimS32Type => {
                            f.debug_tuple("WitTypeNode::PrimS32Type").finish()
                        }
                        WitTypeNode::PrimS64Type => {
                            f.debug_tuple("WitTypeNode::PrimS64Type").finish()
                        }
                        WitTypeNode::PrimF32Type => {
                            f.debug_tuple("WitTypeNode::PrimF32Type").finish()
                        }
                        WitTypeNode::PrimF64Type => {
                            f.debug_tuple("WitTypeNode::PrimF64Type").finish()
                        }
                        WitTypeNode::PrimCharType => {
                            f.debug_tuple("WitTypeNode::PrimCharType").finish()
                        }
                        WitTypeNode::PrimBoolType => {
                            f.debug_tuple("WitTypeNode::PrimBoolType").finish()
                        }
                        WitTypeNode::PrimStringType => {
                            f.debug_tuple("WitTypeNode::PrimStringType").finish()
                        }
                        WitTypeNode::HandleType(e) => {
                            f.debug_tuple("WitTypeNode::HandleType").field(e).finish()
                        }
                    }
                }
            }
            /// Represents a node of `wit-type`, with attached metadata
            #[derive(Clone)]
            pub struct NamedWitTypeNode {
                /// Name of the type
                pub name: Option<_rt::String>,
                /// Owner of the type (usually pointing to a WIT package and interface)
                pub owner: Option<_rt::String>,
                /// The node representing a type
                pub type_: WitTypeNode,
            }
            impl ::core::fmt::Debug for NamedWitTypeNode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    f.debug_struct("NamedWitTypeNode")
                        .field("name", &self.name)
                        .field("owner", &self.owner)
                        .field("type", &self.type_)
                        .finish()
                }
            }
            /// Describes a type of a `wit-value`
            #[derive(Clone)]
            pub struct WitType {
                /// The nodes consisting of the type definition. Because WIT does not support recursive types, the nodes are represented as a list of named nodes.
                /// The list is always non-empty, and the first item is the root node.
                pub nodes: _rt::Vec<NamedWitTypeNode>,
            }
            impl ::core::fmt::Debug for WitType {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    f.debug_struct("WitType").field("nodes", &self.nodes).finish()
                }
            }
            /// URI value
            #[derive(Clone)]
            pub struct Uri {
                pub value: _rt::String,
            }
            impl ::core::fmt::Debug for Uri {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    f.debug_struct("Uri").field("value", &self.value).finish()
                }
            }
            /// One node of a `wit-value`
            #[derive(Clone)]
            pub enum WitNode {
                /// A record value defined by a list of its field values
                RecordValue(_rt::Vec<NodeIndex>),
                /// A variant value defined by a pair of the case index and its inner value
                VariantValue((u32, Option<NodeIndex>)),
                /// An enum value defined by a case index
                EnumValue(u32),
                /// A flags value defined by a list of its flag states
                FlagsValue(_rt::Vec<bool>),
                /// A tuple value defined by a list of its item values
                TupleValue(_rt::Vec<NodeIndex>),
                /// A list value defined by a list of its item values
                ListValue(_rt::Vec<NodeIndex>),
                /// An option value defined by an optional inner value
                OptionValue(Option<NodeIndex>),
                /// A result value defined by either an ok value or an error value. Both values are optional,
                /// where the `none` case represents the absence of a value.
                ResultValue(Result<Option<NodeIndex>, Option<NodeIndex>>),
                /// Primitive unsigned 8-bit integer
                PrimU8(u8),
                /// Primitive unsigned 16-bit integer
                PrimU16(u16),
                /// Primitive unsigned 32-bit integer
                PrimU32(u32),
                /// Primitive unsigned 64-bit integer
                PrimU64(u64),
                /// Primitive signed 8-bit integer
                PrimS8(i8),
                /// Primitive signed 16-bit integer
                PrimS16(i16),
                /// Primitive signed 32-bit integer
                PrimS32(i32),
                /// Primitive signed 64-bit integer
                PrimS64(i64),
                /// Primitive 32-bit floating point number
                PrimFloat32(f32),
                /// Primitive 64-bit floating point number
                PrimFloat64(f64),
                /// Primitive character
                PrimChar(char),
                /// Primitive boolean
                PrimBool(bool),
                /// Primitive string
                PrimString(_rt::String),
                /// Resource handle pointing to a URI and a resource ID
                Handle((Uri, u64)),
            }
            impl ::core::fmt::Debug for WitNode {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        WitNode::RecordValue(e) => {
                            f.debug_tuple("WitNode::RecordValue").field(e).finish()
                        }
                        WitNode::VariantValue(e) => {
                            f.debug_tuple("WitNode::VariantValue").field(e).finish()
                        }
                        WitNode::EnumValue(e) => {
                            f.debug_tuple("WitNode::EnumValue").field(e).finish()
                        }
                        WitNode::FlagsValue(e) => {
                            f.debug_tuple("WitNode::FlagsValue").field(e).finish()
                        }
                        WitNode::TupleValue(e) => {
                            f.debug_tuple("WitNode::TupleValue").field(e).finish()
                        }
                        WitNode::ListValue(e) => {
                            f.debug_tuple("WitNode::ListValue").field(e).finish()
                        }
                        WitNode::OptionValue(e) => {
                            f.debug_tuple("WitNode::OptionValue").field(e).finish()
                        }
                        WitNode::ResultValue(e) => {
                            f.debug_tuple("WitNode::ResultValue").field(e).finish()
                        }
                        WitNode::PrimU8(e) => {
                            f.debug_tuple("WitNode::PrimU8").field(e).finish()
                        }
                        WitNode::PrimU16(e) => {
                            f.debug_tuple("WitNode::PrimU16").field(e).finish()
                        }
                        WitNode::PrimU32(e) => {
                            f.debug_tuple("WitNode::PrimU32").field(e).finish()
                        }
                        WitNode::PrimU64(e) => {
                            f.debug_tuple("WitNode::PrimU64").field(e).finish()
                        }
                        WitNode::PrimS8(e) => {
                            f.debug_tuple("WitNode::PrimS8").field(e).finish()
                        }
                        WitNode::PrimS16(e) => {
                            f.debug_tuple("WitNode::PrimS16").field(e).finish()
                        }
                        WitNode::PrimS32(e) => {
                            f.debug_tuple("WitNode::PrimS32").field(e).finish()
                        }
                        WitNode::PrimS64(e) => {
                            f.debug_tuple("WitNode::PrimS64").field(e).finish()
                        }
                        WitNode::PrimFloat32(e) => {
                            f.debug_tuple("WitNode::PrimFloat32").field(e).finish()
                        }
                        WitNode::PrimFloat64(e) => {
                            f.debug_tuple("WitNode::PrimFloat64").field(e).finish()
                        }
                        WitNode::PrimChar(e) => {
                            f.debug_tuple("WitNode::PrimChar").field(e).finish()
                        }
                        WitNode::PrimBool(e) => {
                            f.debug_tuple("WitNode::PrimBool").field(e).finish()
                        }
                        WitNode::PrimString(e) => {
                            f.debug_tuple("WitNode::PrimString").field(e).finish()
                        }
                        WitNode::Handle(e) => {
                            f.debug_tuple("WitNode::Handle").field(e).finish()
                        }
                    }
                }
            }
            /// Describes an arbitrary value
            #[derive(Clone)]
            pub struct WitValue {
                /// The list of `wit-node` values that make up the value. The list is always non-empty,
                /// and the first element is the root node describing the value. Because WIT does not support
                /// recursive types, further nodes are pushed into this list, and referenced by index from their parent node.
                pub nodes: _rt::Vec<WitNode>,
            }
            impl ::core::fmt::Debug for WitValue {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    f.debug_struct("WitValue").field("nodes", &self.nodes).finish()
                }
            }
            /// A value and its type
            #[derive(Clone)]
            pub struct ValueAndType {
                /// Value
                pub value: WitValue,
                /// Type of `value`
                pub typ: WitType,
            }
            impl ::core::fmt::Debug for ValueAndType {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    f.debug_struct("ValueAndType")
                        .field("value", &self.value)
                        .field("typ", &self.typ)
                        .finish()
                }
            }
            /// Possible failures of an RPC call
            #[derive(Clone)]
            pub enum RpcError {
                /// Protocol level error
                ProtocolError(_rt::String),
                /// Access denied
                Denied(_rt::String),
                /// Target agent or function not found
                NotFound(_rt::String),
                /// Internal error on the remote side
                RemoteInternalError(_rt::String),
            }
            impl ::core::fmt::Debug for RpcError {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    match self {
                        RpcError::ProtocolError(e) => {
                            f.debug_tuple("RpcError::ProtocolError").field(e).finish()
                        }
                        RpcError::Denied(e) => {
                            f.debug_tuple("RpcError::Denied").field(e).finish()
                        }
                        RpcError::NotFound(e) => {
                            f.debug_tuple("RpcError::NotFound").field(e).finish()
                        }
                        RpcError::RemoteInternalError(e) => {
                            f.debug_tuple("RpcError::RemoteInternalError")
                                .field(e)
                                .finish()
                        }
                    }
                }
            }
            impl ::core::fmt::Display for RpcError {
                fn fmt(
                    &self,
                    f: &mut ::core::fmt::Formatter<'_>,
                ) -> ::core::fmt::Result {
                    write!(f, "{:?}", self)
                }
            }
            impl std::error::Error for RpcError {}
            /// An RPC client
            #[derive(Debug)]
            #[repr(transparent)]
            pub struct WasmRpc {
                handle: _rt::Resource<WasmRpc>,
            }
            impl WasmRpc {
                #[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 WasmRpc {
                #[inline]
                unsafe fn drop(_handle: u32) {
                    #[cfg(not(target_arch = "wasm32"))]
                    unreachable!();
                    #[cfg(target_arch = "wasm32")]
                    {
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[resource-drop]wasm-rpc"]
                            fn drop(_: u32);
                        }
                        unsafe { drop(_handle) };
                    }
                }
            }
            /// Represents a pollable invocation result
            #[derive(Debug)]
            #[repr(transparent)]
            pub struct FutureInvokeResult {
                handle: _rt::Resource<FutureInvokeResult>,
            }
            impl FutureInvokeResult {
                #[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 FutureInvokeResult {
                #[inline]
                unsafe fn drop(_handle: u32) {
                    #[cfg(not(target_arch = "wasm32"))]
                    unreachable!();
                    #[cfg(target_arch = "wasm32")]
                    {
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[resource-drop]future-invoke-result"]
                            fn drop(_: u32);
                        }
                        unsafe { drop(_handle) };
                    }
                }
            }
            /// Cancellation token for scheduled invocations
            #[derive(Debug)]
            #[repr(transparent)]
            pub struct CancellationToken {
                handle: _rt::Resource<CancellationToken>,
            }
            impl CancellationToken {
                #[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 CancellationToken {
                #[inline]
                unsafe fn drop(_handle: u32) {
                    #[cfg(not(target_arch = "wasm32"))]
                    unreachable!();
                    #[cfg(target_arch = "wasm32")]
                    {
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[resource-drop]cancellation-token"]
                            fn drop(_: u32);
                        }
                        unsafe { drop(_handle) };
                    }
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Parses a UUID from a string
            pub fn parse_uuid(uuid: &str) -> Result<Uuid, _rt::String> {
                unsafe {
                    #[repr(align(8))]
                    struct RetArea([::core::mem::MaybeUninit<u8>; 24]);
                    let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 24]);
                    let vec0 = uuid;
                    let ptr0 = vec0.as_ptr().cast::<u8>();
                    let len0 = vec0.len();
                    let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                    unsafe extern "C" {
                        #[link_name = "parse-uuid"]
                        fn wit_import2(_: *mut u8, _: usize, _: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) {
                        unreachable!()
                    }
                    unsafe { wit_import2(ptr0.cast_mut(), len0, ptr1) };
                    let l3 = i32::from(*ptr1.add(0).cast::<u8>());
                    let result9 = match l3 {
                        0 => {
                            let e = {
                                let l4 = *ptr1.add(8).cast::<i64>();
                                let l5 = *ptr1.add(16).cast::<i64>();
                                Uuid {
                                    high_bits: l4 as u64,
                                    low_bits: l5 as u64,
                                }
                            };
                            Ok(e)
                        }
                        1 => {
                            let e = {
                                let l6 = *ptr1.add(8).cast::<*mut u8>();
                                let l7 = *ptr1
                                    .add(8 + 1 * ::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)
                            };
                            Err(e)
                        }
                        _ => _rt::invalid_enum_discriminant(),
                    };
                    result9
                }
            }
            #[allow(unused_unsafe, clippy::all)]
            /// Converts a UUID to a string
            pub fn uuid_to_string(uuid: Uuid) -> _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 Uuid { high_bits: high_bits0, low_bits: low_bits0 } = uuid;
                    let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
                    #[cfg(target_arch = "wasm32")]
                    #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                    unsafe extern "C" {
                        #[link_name = "uuid-to-string"]
                        fn wit_import2(_: i64, _: i64, _: *mut u8);
                    }
                    #[cfg(not(target_arch = "wasm32"))]
                    unsafe extern "C" fn wit_import2(_: i64, _: i64, _: *mut u8) {
                        unreachable!()
                    }
                    unsafe {
                        wit_import2(
                            _rt::as_i64(high_bits0),
                            _rt::as_i64(low_bits0),
                            ptr1,
                        )
                    };
                    let l3 = *ptr1.add(0).cast::<*mut u8>();
                    let l4 = *ptr1
                        .add(::core::mem::size_of::<*const u8>())
                        .cast::<usize>();
                    let len5 = l4;
                    let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5);
                    let result6 = _rt::string_lift(bytes5);
                    result6
                }
            }
            impl WasmRpc {
                #[allow(unused_unsafe, clippy::all)]
                /// Constructs the RPC client connecting to the given target agent
                pub fn new(agent_id: &AgentId) -> Self {
                    unsafe {
                        let AgentId {
                            component_id: component_id0,
                            agent_id: agent_id0,
                        } = agent_id;
                        let ComponentId { uuid: uuid1 } = component_id0;
                        let Uuid { high_bits: high_bits2, low_bits: low_bits2 } = uuid1;
                        let vec3 = agent_id0;
                        let ptr3 = vec3.as_ptr().cast::<u8>();
                        let len3 = vec3.len();
                        #[cfg(target_arch = "wasm32")]
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[constructor]wasm-rpc"]
                            fn wit_import4(_: i64, _: i64, _: *mut u8, _: usize) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import4(
                            _: i64,
                            _: i64,
                            _: *mut u8,
                            _: usize,
                        ) -> i32 {
                            unreachable!()
                        }
                        let ret = unsafe {
                            wit_import4(
                                _rt::as_i64(high_bits2),
                                _rt::as_i64(low_bits2),
                                ptr3.cast_mut(),
                                len3,
                            )
                        };
                        unsafe { WasmRpc::from_handle(ret as u32) }
                    }
                }
            }
            impl WasmRpc {
                #[allow(unused_unsafe, clippy::all)]
                /// Invokes a remote function with the given parameters, and awaits the result
                pub fn invoke_and_await(
                    &self,
                    function_name: &str,
                    function_params: &[WitValue],
                ) -> Result<WitValue, RpcError> {
                    unsafe {
                        let mut cleanup_list = _rt::Vec::new();
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 4
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let vec0 = function_name;
                        let ptr0 = vec0.as_ptr().cast::<u8>();
                        let len0 = vec0.len();
                        let vec12 = function_params;
                        let len12 = vec12.len();
                        let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
                            vec12.len() * (2 * ::core::mem::size_of::<*const u8>()),
                            ::core::mem::size_of::<*const u8>(),
                        );
                        let result12 = if layout12.size() != 0 {
                            let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
                            if ptr.is_null() {
                                _rt::alloc::handle_alloc_error(layout12);
                            }
                            ptr
                        } else {
                            ::core::ptr::null_mut()
                        };
                        for (i, e) in vec12.into_iter().enumerate() {
                            let base = result12
                                .add(i * (2 * ::core::mem::size_of::<*const u8>()));
                            {
                                let WitValue { nodes: nodes1 } = e;
                                let vec11 = nodes1;
                                let len11 = vec11.len();
                                let layout11 = _rt::alloc::Layout::from_size_align_unchecked(
                                    vec11.len()
                                        * (16 + 2 * ::core::mem::size_of::<*const u8>()),
                                    8,
                                );
                                let result11 = if layout11.size() != 0 {
                                    let ptr = _rt::alloc::alloc(layout11).cast::<u8>();
                                    if ptr.is_null() {
                                        _rt::alloc::handle_alloc_error(layout11);
                                    }
                                    ptr
                                } else {
                                    ::core::ptr::null_mut()
                                };
                                for (i, e) in vec11.into_iter().enumerate() {
                                    let base = result11
                                        .add(i * (16 + 2 * ::core::mem::size_of::<*const u8>()));
                                    {
                                        match e {
                                            WitNode::RecordValue(e) => {
                                                *base.add(0).cast::<u8>() = (0i32) as u8;
                                                let vec2 = e;
                                                let ptr2 = vec2.as_ptr().cast::<u8>();
                                                let len2 = vec2.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len2;
                                                *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
                                            }
                                            WitNode::VariantValue(e) => {
                                                *base.add(0).cast::<u8>() = (1i32) as u8;
                                                let (t3_0, t3_1) = e;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(t3_0);
                                                match t3_1 {
                                                    Some(e) => {
                                                        *base.add(12).cast::<u8>() = (1i32) as u8;
                                                        *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(12).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::EnumValue(e) => {
                                                *base.add(0).cast::<u8>() = (2i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::FlagsValue(e) => {
                                                *base.add(0).cast::<u8>() = (3i32) as u8;
                                                let vec4 = e;
                                                let len4 = vec4.len();
                                                let layout4 = _rt::alloc::Layout::from_size_align_unchecked(
                                                    vec4.len() * 1,
                                                    1,
                                                );
                                                let result4 = if layout4.size() != 0 {
                                                    let ptr = _rt::alloc::alloc(layout4).cast::<u8>();
                                                    if ptr.is_null() {
                                                        _rt::alloc::handle_alloc_error(layout4);
                                                    }
                                                    ptr
                                                } else {
                                                    ::core::ptr::null_mut()
                                                };
                                                for (i, e) in vec4.into_iter().enumerate() {
                                                    let base = result4.add(i * 1);
                                                    {
                                                        *base.add(0).cast::<u8>() = (match e {
                                                            true => 1,
                                                            false => 0,
                                                        }) as u8;
                                                    }
                                                }
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len4;
                                                *base.add(8).cast::<*mut u8>() = result4;
                                                cleanup_list.extend_from_slice(&[(result4, layout4)]);
                                            }
                                            WitNode::TupleValue(e) => {
                                                *base.add(0).cast::<u8>() = (4i32) as u8;
                                                let vec5 = e;
                                                let ptr5 = vec5.as_ptr().cast::<u8>();
                                                let len5 = vec5.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len5;
                                                *base.add(8).cast::<*mut u8>() = ptr5.cast_mut();
                                            }
                                            WitNode::ListValue(e) => {
                                                *base.add(0).cast::<u8>() = (5i32) as u8;
                                                let vec6 = e;
                                                let ptr6 = vec6.as_ptr().cast::<u8>();
                                                let len6 = vec6.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len6;
                                                *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
                                            }
                                            WitNode::OptionValue(e) => {
                                                *base.add(0).cast::<u8>() = (6i32) as u8;
                                                match e {
                                                    Some(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        *base.add(12).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::ResultValue(e) => {
                                                *base.add(0).cast::<u8>() = (7i32) as u8;
                                                match e {
                                                    Ok(e) => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                    Err(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                };
                                            }
                                            WitNode::PrimU8(e) => {
                                                *base.add(0).cast::<u8>() = (8i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimU16(e) => {
                                                *base.add(0).cast::<u8>() = (9i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimU32(e) => {
                                                *base.add(0).cast::<u8>() = (10i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimU64(e) => {
                                                *base.add(0).cast::<u8>() = (11i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimS8(e) => {
                                                *base.add(0).cast::<u8>() = (12i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimS16(e) => {
                                                *base.add(0).cast::<u8>() = (13i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimS32(e) => {
                                                *base.add(0).cast::<u8>() = (14i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimS64(e) => {
                                                *base.add(0).cast::<u8>() = (15i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimFloat32(e) => {
                                                *base.add(0).cast::<u8>() = (16i32) as u8;
                                                *base.add(8).cast::<f32>() = _rt::as_f32(e);
                                            }
                                            WitNode::PrimFloat64(e) => {
                                                *base.add(0).cast::<u8>() = (17i32) as u8;
                                                *base.add(8).cast::<f64>() = _rt::as_f64(e);
                                            }
                                            WitNode::PrimChar(e) => {
                                                *base.add(0).cast::<u8>() = (18i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimBool(e) => {
                                                *base.add(0).cast::<u8>() = (19i32) as u8;
                                                *base.add(8).cast::<u8>() = (match e {
                                                    true => 1,
                                                    false => 0,
                                                }) as u8;
                                            }
                                            WitNode::PrimString(e) => {
                                                *base.add(0).cast::<u8>() = (20i32) as u8;
                                                let vec7 = e;
                                                let ptr7 = vec7.as_ptr().cast::<u8>();
                                                let len7 = vec7.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len7;
                                                *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
                                            }
                                            WitNode::Handle(e) => {
                                                *base.add(0).cast::<u8>() = (21i32) as u8;
                                                let (t8_0, t8_1) = e;
                                                let Uri { value: value9 } = t8_0;
                                                let vec10 = value9;
                                                let ptr10 = vec10.as_ptr().cast::<u8>();
                                                let len10 = vec10.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len10;
                                                *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
                                                *base
                                                    .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i64>() = _rt::as_i64(t8_1);
                                            }
                                        }
                                    }
                                }
                                *base
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<usize>() = len11;
                                *base.add(0).cast::<*mut u8>() = result11;
                                cleanup_list.extend_from_slice(&[(result11, layout11)]);
                            }
                        }
                        let ptr13 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[method]wasm-rpc.invoke-and-await"]
                            fn wit_import14(
                                _: i32,
                                _: *mut u8,
                                _: usize,
                                _: *mut u8,
                                _: usize,
                                _: *mut u8,
                            );
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import14(
                            _: i32,
                            _: *mut u8,
                            _: usize,
                            _: *mut u8,
                            _: usize,
                            _: *mut u8,
                        ) {
                            unreachable!()
                        }
                        unsafe {
                            wit_import14(
                                (self).handle() as i32,
                                ptr0.cast_mut(),
                                len0,
                                result12,
                                len12,
                                ptr13,
                            )
                        };
                        let l15 = i32::from(*ptr13.add(0).cast::<u8>());
                        let result78 = match l15 {
                            0 => {
                                let e = {
                                    let l16 = *ptr13
                                        .add(::core::mem::size_of::<*const u8>())
                                        .cast::<*mut u8>();
                                    let l17 = *ptr13
                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                        .cast::<usize>();
                                    let base63 = l16;
                                    let len63 = l17;
                                    let mut result63 = _rt::Vec::with_capacity(len63);
                                    for i in 0..len63 {
                                        let base = base63
                                            .add(i * (16 + 2 * ::core::mem::size_of::<*const u8>()));
                                        let e63 = {
                                            let l18 = i32::from(*base.add(0).cast::<u8>());
                                            let v62 = match l18 {
                                                0 => {
                                                    let e62 = {
                                                        let l19 = *base.add(8).cast::<*mut u8>();
                                                        let l20 = *base
                                                            .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                            .cast::<usize>();
                                                        let len21 = l20;
                                                        _rt::Vec::from_raw_parts(l19.cast(), len21, len21)
                                                    };
                                                    WitNode::RecordValue(e62)
                                                }
                                                1 => {
                                                    let e62 = {
                                                        let l22 = *base.add(8).cast::<i32>();
                                                        let l23 = i32::from(*base.add(12).cast::<u8>());
                                                        (
                                                            l22 as u32,
                                                            match l23 {
                                                                0 => None,
                                                                1 => {
                                                                    let e = {
                                                                        let l24 = *base.add(16).cast::<i32>();
                                                                        l24
                                                                    };
                                                                    Some(e)
                                                                }
                                                                _ => _rt::invalid_enum_discriminant(),
                                                            },
                                                        )
                                                    };
                                                    WitNode::VariantValue(e62)
                                                }
                                                2 => {
                                                    let e62 = {
                                                        let l25 = *base.add(8).cast::<i32>();
                                                        l25 as u32
                                                    };
                                                    WitNode::EnumValue(e62)
                                                }
                                                3 => {
                                                    let e62 = {
                                                        let l26 = *base.add(8).cast::<*mut u8>();
                                                        let l27 = *base
                                                            .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                            .cast::<usize>();
                                                        let base29 = l26;
                                                        let len29 = l27;
                                                        let mut result29 = _rt::Vec::with_capacity(len29);
                                                        for i in 0..len29 {
                                                            let base = base29.add(i * 1);
                                                            let e29 = {
                                                                let l28 = i32::from(*base.add(0).cast::<u8>());
                                                                _rt::bool_lift(l28 as u8)
                                                            };
                                                            result29.push(e29);
                                                        }
                                                        _rt::cabi_dealloc(base29, len29 * 1, 1);
                                                        result29
                                                    };
                                                    WitNode::FlagsValue(e62)
                                                }
                                                4 => {
                                                    let e62 = {
                                                        let l30 = *base.add(8).cast::<*mut u8>();
                                                        let l31 = *base
                                                            .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                            .cast::<usize>();
                                                        let len32 = l31;
                                                        _rt::Vec::from_raw_parts(l30.cast(), len32, len32)
                                                    };
                                                    WitNode::TupleValue(e62)
                                                }
                                                5 => {
                                                    let e62 = {
                                                        let l33 = *base.add(8).cast::<*mut u8>();
                                                        let l34 = *base
                                                            .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                            .cast::<usize>();
                                                        let len35 = l34;
                                                        _rt::Vec::from_raw_parts(l33.cast(), len35, len35)
                                                    };
                                                    WitNode::ListValue(e62)
                                                }
                                                6 => {
                                                    let e62 = {
                                                        let l36 = i32::from(*base.add(8).cast::<u8>());
                                                        match l36 {
                                                            0 => None,
                                                            1 => {
                                                                let e = {
                                                                    let l37 = *base.add(12).cast::<i32>();
                                                                    l37
                                                                };
                                                                Some(e)
                                                            }
                                                            _ => _rt::invalid_enum_discriminant(),
                                                        }
                                                    };
                                                    WitNode::OptionValue(e62)
                                                }
                                                7 => {
                                                    let e62 = {
                                                        let l38 = i32::from(*base.add(8).cast::<u8>());
                                                        match l38 {
                                                            0 => {
                                                                let e = {
                                                                    let l39 = i32::from(*base.add(12).cast::<u8>());
                                                                    match l39 {
                                                                        0 => None,
                                                                        1 => {
                                                                            let e = {
                                                                                let l40 = *base.add(16).cast::<i32>();
                                                                                l40
                                                                            };
                                                                            Some(e)
                                                                        }
                                                                        _ => _rt::invalid_enum_discriminant(),
                                                                    }
                                                                };
                                                                Ok(e)
                                                            }
                                                            1 => {
                                                                let e = {
                                                                    let l41 = i32::from(*base.add(12).cast::<u8>());
                                                                    match l41 {
                                                                        0 => None,
                                                                        1 => {
                                                                            let e = {
                                                                                let l42 = *base.add(16).cast::<i32>();
                                                                                l42
                                                                            };
                                                                            Some(e)
                                                                        }
                                                                        _ => _rt::invalid_enum_discriminant(),
                                                                    }
                                                                };
                                                                Err(e)
                                                            }
                                                            _ => _rt::invalid_enum_discriminant(),
                                                        }
                                                    };
                                                    WitNode::ResultValue(e62)
                                                }
                                                8 => {
                                                    let e62 = {
                                                        let l43 = i32::from(*base.add(8).cast::<u8>());
                                                        l43 as u8
                                                    };
                                                    WitNode::PrimU8(e62)
                                                }
                                                9 => {
                                                    let e62 = {
                                                        let l44 = i32::from(*base.add(8).cast::<u16>());
                                                        l44 as u16
                                                    };
                                                    WitNode::PrimU16(e62)
                                                }
                                                10 => {
                                                    let e62 = {
                                                        let l45 = *base.add(8).cast::<i32>();
                                                        l45 as u32
                                                    };
                                                    WitNode::PrimU32(e62)
                                                }
                                                11 => {
                                                    let e62 = {
                                                        let l46 = *base.add(8).cast::<i64>();
                                                        l46 as u64
                                                    };
                                                    WitNode::PrimU64(e62)
                                                }
                                                12 => {
                                                    let e62 = {
                                                        let l47 = i32::from(*base.add(8).cast::<i8>());
                                                        l47 as i8
                                                    };
                                                    WitNode::PrimS8(e62)
                                                }
                                                13 => {
                                                    let e62 = {
                                                        let l48 = i32::from(*base.add(8).cast::<i16>());
                                                        l48 as i16
                                                    };
                                                    WitNode::PrimS16(e62)
                                                }
                                                14 => {
                                                    let e62 = {
                                                        let l49 = *base.add(8).cast::<i32>();
                                                        l49
                                                    };
                                                    WitNode::PrimS32(e62)
                                                }
                                                15 => {
                                                    let e62 = {
                                                        let l50 = *base.add(8).cast::<i64>();
                                                        l50
                                                    };
                                                    WitNode::PrimS64(e62)
                                                }
                                                16 => {
                                                    let e62 = {
                                                        let l51 = *base.add(8).cast::<f32>();
                                                        l51
                                                    };
                                                    WitNode::PrimFloat32(e62)
                                                }
                                                17 => {
                                                    let e62 = {
                                                        let l52 = *base.add(8).cast::<f64>();
                                                        l52
                                                    };
                                                    WitNode::PrimFloat64(e62)
                                                }
                                                18 => {
                                                    let e62 = {
                                                        let l53 = *base.add(8).cast::<i32>();
                                                        _rt::char_lift(l53 as u32)
                                                    };
                                                    WitNode::PrimChar(e62)
                                                }
                                                19 => {
                                                    let e62 = {
                                                        let l54 = i32::from(*base.add(8).cast::<u8>());
                                                        _rt::bool_lift(l54 as u8)
                                                    };
                                                    WitNode::PrimBool(e62)
                                                }
                                                20 => {
                                                    let e62 = {
                                                        let l55 = *base.add(8).cast::<*mut u8>();
                                                        let l56 = *base
                                                            .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                            .cast::<usize>();
                                                        let len57 = l56;
                                                        let bytes57 = _rt::Vec::from_raw_parts(
                                                            l55.cast(),
                                                            len57,
                                                            len57,
                                                        );
                                                        _rt::string_lift(bytes57)
                                                    };
                                                    WitNode::PrimString(e62)
                                                }
                                                n => {
                                                    debug_assert_eq!(n, 21, "invalid enum discriminant");
                                                    let e62 = {
                                                        let l58 = *base.add(8).cast::<*mut u8>();
                                                        let l59 = *base
                                                            .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                            .cast::<usize>();
                                                        let len60 = l59;
                                                        let bytes60 = _rt::Vec::from_raw_parts(
                                                            l58.cast(),
                                                            len60,
                                                            len60,
                                                        );
                                                        let l61 = *base
                                                            .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                            .cast::<i64>();
                                                        (
                                                            Uri {
                                                                value: _rt::string_lift(bytes60),
                                                            },
                                                            l61 as u64,
                                                        )
                                                    };
                                                    WitNode::Handle(e62)
                                                }
                                            };
                                            v62
                                        };
                                        result63.push(e63);
                                    }
                                    _rt::cabi_dealloc(
                                        base63,
                                        len63 * (16 + 2 * ::core::mem::size_of::<*const u8>()),
                                        8,
                                    );
                                    WitValue { nodes: result63 }
                                };
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l64 = i32::from(
                                        *ptr13.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v77 = match l64 {
                                        0 => {
                                            let e77 = {
                                                let l65 = *ptr13
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l66 = *ptr13
                                                    .add(3 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>();
                                                let len67 = l66;
                                                let bytes67 = _rt::Vec::from_raw_parts(
                                                    l65.cast(),
                                                    len67,
                                                    len67,
                                                );
                                                _rt::string_lift(bytes67)
                                            };
                                            RpcError::ProtocolError(e77)
                                        }
                                        1 => {
                                            let e77 = {
                                                let l68 = *ptr13
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l69 = *ptr13
                                                    .add(3 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>();
                                                let len70 = l69;
                                                let bytes70 = _rt::Vec::from_raw_parts(
                                                    l68.cast(),
                                                    len70,
                                                    len70,
                                                );
                                                _rt::string_lift(bytes70)
                                            };
                                            RpcError::Denied(e77)
                                        }
                                        2 => {
                                            let e77 = {
                                                let l71 = *ptr13
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l72 = *ptr13
                                                    .add(3 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>();
                                                let len73 = l72;
                                                let bytes73 = _rt::Vec::from_raw_parts(
                                                    l71.cast(),
                                                    len73,
                                                    len73,
                                                );
                                                _rt::string_lift(bytes73)
                                            };
                                            RpcError::NotFound(e77)
                                        }
                                        n => {
                                            debug_assert_eq!(n, 3, "invalid enum discriminant");
                                            let e77 = {
                                                let l74 = *ptr13
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l75 = *ptr13
                                                    .add(3 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>();
                                                let len76 = l75;
                                                let bytes76 = _rt::Vec::from_raw_parts(
                                                    l74.cast(),
                                                    len76,
                                                    len76,
                                                );
                                                _rt::string_lift(bytes76)
                                            };
                                            RpcError::RemoteInternalError(e77)
                                        }
                                    };
                                    v77
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        if layout12.size() != 0 {
                            _rt::alloc::dealloc(result12.cast(), layout12);
                        }
                        for (ptr, layout) in cleanup_list {
                            if layout.size() != 0 {
                                _rt::alloc::dealloc(ptr.cast(), layout);
                            }
                        }
                        result78
                    }
                }
            }
            impl WasmRpc {
                #[allow(unused_unsafe, clippy::all)]
                /// Triggers the invocation of a remote function with the given parameters, and returns immediately.
                pub fn invoke(
                    &self,
                    function_name: &str,
                    function_params: &[WitValue],
                ) -> Result<(), RpcError> {
                    unsafe {
                        let mut cleanup_list = _rt::Vec::new();
                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
                        struct RetArea(
                            [::core::mem::MaybeUninit<
                                u8,
                            >; 4 * ::core::mem::size_of::<*const u8>()],
                        );
                        let mut ret_area = RetArea(
                            [::core::mem::MaybeUninit::uninit(); 4
                                * ::core::mem::size_of::<*const u8>()],
                        );
                        let vec0 = function_name;
                        let ptr0 = vec0.as_ptr().cast::<u8>();
                        let len0 = vec0.len();
                        let vec12 = function_params;
                        let len12 = vec12.len();
                        let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
                            vec12.len() * (2 * ::core::mem::size_of::<*const u8>()),
                            ::core::mem::size_of::<*const u8>(),
                        );
                        let result12 = if layout12.size() != 0 {
                            let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
                            if ptr.is_null() {
                                _rt::alloc::handle_alloc_error(layout12);
                            }
                            ptr
                        } else {
                            ::core::ptr::null_mut()
                        };
                        for (i, e) in vec12.into_iter().enumerate() {
                            let base = result12
                                .add(i * (2 * ::core::mem::size_of::<*const u8>()));
                            {
                                let WitValue { nodes: nodes1 } = e;
                                let vec11 = nodes1;
                                let len11 = vec11.len();
                                let layout11 = _rt::alloc::Layout::from_size_align_unchecked(
                                    vec11.len()
                                        * (16 + 2 * ::core::mem::size_of::<*const u8>()),
                                    8,
                                );
                                let result11 = if layout11.size() != 0 {
                                    let ptr = _rt::alloc::alloc(layout11).cast::<u8>();
                                    if ptr.is_null() {
                                        _rt::alloc::handle_alloc_error(layout11);
                                    }
                                    ptr
                                } else {
                                    ::core::ptr::null_mut()
                                };
                                for (i, e) in vec11.into_iter().enumerate() {
                                    let base = result11
                                        .add(i * (16 + 2 * ::core::mem::size_of::<*const u8>()));
                                    {
                                        match e {
                                            WitNode::RecordValue(e) => {
                                                *base.add(0).cast::<u8>() = (0i32) as u8;
                                                let vec2 = e;
                                                let ptr2 = vec2.as_ptr().cast::<u8>();
                                                let len2 = vec2.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len2;
                                                *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
                                            }
                                            WitNode::VariantValue(e) => {
                                                *base.add(0).cast::<u8>() = (1i32) as u8;
                                                let (t3_0, t3_1) = e;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(t3_0);
                                                match t3_1 {
                                                    Some(e) => {
                                                        *base.add(12).cast::<u8>() = (1i32) as u8;
                                                        *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(12).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::EnumValue(e) => {
                                                *base.add(0).cast::<u8>() = (2i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::FlagsValue(e) => {
                                                *base.add(0).cast::<u8>() = (3i32) as u8;
                                                let vec4 = e;
                                                let len4 = vec4.len();
                                                let layout4 = _rt::alloc::Layout::from_size_align_unchecked(
                                                    vec4.len() * 1,
                                                    1,
                                                );
                                                let result4 = if layout4.size() != 0 {
                                                    let ptr = _rt::alloc::alloc(layout4).cast::<u8>();
                                                    if ptr.is_null() {
                                                        _rt::alloc::handle_alloc_error(layout4);
                                                    }
                                                    ptr
                                                } else {
                                                    ::core::ptr::null_mut()
                                                };
                                                for (i, e) in vec4.into_iter().enumerate() {
                                                    let base = result4.add(i * 1);
                                                    {
                                                        *base.add(0).cast::<u8>() = (match e {
                                                            true => 1,
                                                            false => 0,
                                                        }) as u8;
                                                    }
                                                }
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len4;
                                                *base.add(8).cast::<*mut u8>() = result4;
                                                cleanup_list.extend_from_slice(&[(result4, layout4)]);
                                            }
                                            WitNode::TupleValue(e) => {
                                                *base.add(0).cast::<u8>() = (4i32) as u8;
                                                let vec5 = e;
                                                let ptr5 = vec5.as_ptr().cast::<u8>();
                                                let len5 = vec5.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len5;
                                                *base.add(8).cast::<*mut u8>() = ptr5.cast_mut();
                                            }
                                            WitNode::ListValue(e) => {
                                                *base.add(0).cast::<u8>() = (5i32) as u8;
                                                let vec6 = e;
                                                let ptr6 = vec6.as_ptr().cast::<u8>();
                                                let len6 = vec6.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len6;
                                                *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
                                            }
                                            WitNode::OptionValue(e) => {
                                                *base.add(0).cast::<u8>() = (6i32) as u8;
                                                match e {
                                                    Some(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        *base.add(12).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::ResultValue(e) => {
                                                *base.add(0).cast::<u8>() = (7i32) as u8;
                                                match e {
                                                    Ok(e) => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                    Err(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                };
                                            }
                                            WitNode::PrimU8(e) => {
                                                *base.add(0).cast::<u8>() = (8i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimU16(e) => {
                                                *base.add(0).cast::<u8>() = (9i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimU32(e) => {
                                                *base.add(0).cast::<u8>() = (10i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimU64(e) => {
                                                *base.add(0).cast::<u8>() = (11i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimS8(e) => {
                                                *base.add(0).cast::<u8>() = (12i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimS16(e) => {
                                                *base.add(0).cast::<u8>() = (13i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimS32(e) => {
                                                *base.add(0).cast::<u8>() = (14i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimS64(e) => {
                                                *base.add(0).cast::<u8>() = (15i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimFloat32(e) => {
                                                *base.add(0).cast::<u8>() = (16i32) as u8;
                                                *base.add(8).cast::<f32>() = _rt::as_f32(e);
                                            }
                                            WitNode::PrimFloat64(e) => {
                                                *base.add(0).cast::<u8>() = (17i32) as u8;
                                                *base.add(8).cast::<f64>() = _rt::as_f64(e);
                                            }
                                            WitNode::PrimChar(e) => {
                                                *base.add(0).cast::<u8>() = (18i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimBool(e) => {
                                                *base.add(0).cast::<u8>() = (19i32) as u8;
                                                *base.add(8).cast::<u8>() = (match e {
                                                    true => 1,
                                                    false => 0,
                                                }) as u8;
                                            }
                                            WitNode::PrimString(e) => {
                                                *base.add(0).cast::<u8>() = (20i32) as u8;
                                                let vec7 = e;
                                                let ptr7 = vec7.as_ptr().cast::<u8>();
                                                let len7 = vec7.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len7;
                                                *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
                                            }
                                            WitNode::Handle(e) => {
                                                *base.add(0).cast::<u8>() = (21i32) as u8;
                                                let (t8_0, t8_1) = e;
                                                let Uri { value: value9 } = t8_0;
                                                let vec10 = value9;
                                                let ptr10 = vec10.as_ptr().cast::<u8>();
                                                let len10 = vec10.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len10;
                                                *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
                                                *base
                                                    .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i64>() = _rt::as_i64(t8_1);
                                            }
                                        }
                                    }
                                }
                                *base
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<usize>() = len11;
                                *base.add(0).cast::<*mut u8>() = result11;
                                cleanup_list.extend_from_slice(&[(result11, layout11)]);
                            }
                        }
                        let ptr13 = ret_area.0.as_mut_ptr().cast::<u8>();
                        #[cfg(target_arch = "wasm32")]
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[method]wasm-rpc.invoke"]
                            fn wit_import14(
                                _: i32,
                                _: *mut u8,
                                _: usize,
                                _: *mut u8,
                                _: usize,
                                _: *mut u8,
                            );
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import14(
                            _: i32,
                            _: *mut u8,
                            _: usize,
                            _: *mut u8,
                            _: usize,
                            _: *mut u8,
                        ) {
                            unreachable!()
                        }
                        unsafe {
                            wit_import14(
                                (self).handle() as i32,
                                ptr0.cast_mut(),
                                len0,
                                result12,
                                len12,
                                ptr13,
                            )
                        };
                        let l15 = i32::from(*ptr13.add(0).cast::<u8>());
                        let result30 = match l15 {
                            0 => {
                                let e = ();
                                Ok(e)
                            }
                            1 => {
                                let e = {
                                    let l16 = i32::from(
                                        *ptr13.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    let v29 = match l16 {
                                        0 => {
                                            let e29 = {
                                                let l17 = *ptr13
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l18 = *ptr13
                                                    .add(3 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>();
                                                let len19 = l18;
                                                let bytes19 = _rt::Vec::from_raw_parts(
                                                    l17.cast(),
                                                    len19,
                                                    len19,
                                                );
                                                _rt::string_lift(bytes19)
                                            };
                                            RpcError::ProtocolError(e29)
                                        }
                                        1 => {
                                            let e29 = {
                                                let l20 = *ptr13
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l21 = *ptr13
                                                    .add(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)
                                            };
                                            RpcError::Denied(e29)
                                        }
                                        2 => {
                                            let e29 = {
                                                let l23 = *ptr13
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l24 = *ptr13
                                                    .add(3 * ::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)
                                            };
                                            RpcError::NotFound(e29)
                                        }
                                        n => {
                                            debug_assert_eq!(n, 3, "invalid enum discriminant");
                                            let e29 = {
                                                let l26 = *ptr13
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l27 = *ptr13
                                                    .add(3 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>();
                                                let len28 = l27;
                                                let bytes28 = _rt::Vec::from_raw_parts(
                                                    l26.cast(),
                                                    len28,
                                                    len28,
                                                );
                                                _rt::string_lift(bytes28)
                                            };
                                            RpcError::RemoteInternalError(e29)
                                        }
                                    };
                                    v29
                                };
                                Err(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        if layout12.size() != 0 {
                            _rt::alloc::dealloc(result12.cast(), layout12);
                        }
                        for (ptr, layout) in cleanup_list {
                            if layout.size() != 0 {
                                _rt::alloc::dealloc(ptr.cast(), layout);
                            }
                        }
                        result30
                    }
                }
            }
            impl WasmRpc {
                #[allow(unused_unsafe, clippy::all)]
                /// Invokes a remote function with the given parameters, and returns a `future-invoke-result` value which can
                /// be polled for the result.
                ///
                /// With this function it is possible to call multiple (different) agents simultaneously.
                pub fn async_invoke_and_await(
                    &self,
                    function_name: &str,
                    function_params: &[WitValue],
                ) -> FutureInvokeResult {
                    unsafe {
                        let mut cleanup_list = _rt::Vec::new();
                        let vec0 = function_name;
                        let ptr0 = vec0.as_ptr().cast::<u8>();
                        let len0 = vec0.len();
                        let vec12 = function_params;
                        let len12 = vec12.len();
                        let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
                            vec12.len() * (2 * ::core::mem::size_of::<*const u8>()),
                            ::core::mem::size_of::<*const u8>(),
                        );
                        let result12 = if layout12.size() != 0 {
                            let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
                            if ptr.is_null() {
                                _rt::alloc::handle_alloc_error(layout12);
                            }
                            ptr
                        } else {
                            ::core::ptr::null_mut()
                        };
                        for (i, e) in vec12.into_iter().enumerate() {
                            let base = result12
                                .add(i * (2 * ::core::mem::size_of::<*const u8>()));
                            {
                                let WitValue { nodes: nodes1 } = e;
                                let vec11 = nodes1;
                                let len11 = vec11.len();
                                let layout11 = _rt::alloc::Layout::from_size_align_unchecked(
                                    vec11.len()
                                        * (16 + 2 * ::core::mem::size_of::<*const u8>()),
                                    8,
                                );
                                let result11 = if layout11.size() != 0 {
                                    let ptr = _rt::alloc::alloc(layout11).cast::<u8>();
                                    if ptr.is_null() {
                                        _rt::alloc::handle_alloc_error(layout11);
                                    }
                                    ptr
                                } else {
                                    ::core::ptr::null_mut()
                                };
                                for (i, e) in vec11.into_iter().enumerate() {
                                    let base = result11
                                        .add(i * (16 + 2 * ::core::mem::size_of::<*const u8>()));
                                    {
                                        match e {
                                            WitNode::RecordValue(e) => {
                                                *base.add(0).cast::<u8>() = (0i32) as u8;
                                                let vec2 = e;
                                                let ptr2 = vec2.as_ptr().cast::<u8>();
                                                let len2 = vec2.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len2;
                                                *base.add(8).cast::<*mut u8>() = ptr2.cast_mut();
                                            }
                                            WitNode::VariantValue(e) => {
                                                *base.add(0).cast::<u8>() = (1i32) as u8;
                                                let (t3_0, t3_1) = e;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(t3_0);
                                                match t3_1 {
                                                    Some(e) => {
                                                        *base.add(12).cast::<u8>() = (1i32) as u8;
                                                        *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(12).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::EnumValue(e) => {
                                                *base.add(0).cast::<u8>() = (2i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::FlagsValue(e) => {
                                                *base.add(0).cast::<u8>() = (3i32) as u8;
                                                let vec4 = e;
                                                let len4 = vec4.len();
                                                let layout4 = _rt::alloc::Layout::from_size_align_unchecked(
                                                    vec4.len() * 1,
                                                    1,
                                                );
                                                let result4 = if layout4.size() != 0 {
                                                    let ptr = _rt::alloc::alloc(layout4).cast::<u8>();
                                                    if ptr.is_null() {
                                                        _rt::alloc::handle_alloc_error(layout4);
                                                    }
                                                    ptr
                                                } else {
                                                    ::core::ptr::null_mut()
                                                };
                                                for (i, e) in vec4.into_iter().enumerate() {
                                                    let base = result4.add(i * 1);
                                                    {
                                                        *base.add(0).cast::<u8>() = (match e {
                                                            true => 1,
                                                            false => 0,
                                                        }) as u8;
                                                    }
                                                }
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len4;
                                                *base.add(8).cast::<*mut u8>() = result4;
                                                cleanup_list.extend_from_slice(&[(result4, layout4)]);
                                            }
                                            WitNode::TupleValue(e) => {
                                                *base.add(0).cast::<u8>() = (4i32) as u8;
                                                let vec5 = e;
                                                let ptr5 = vec5.as_ptr().cast::<u8>();
                                                let len5 = vec5.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len5;
                                                *base.add(8).cast::<*mut u8>() = ptr5.cast_mut();
                                            }
                                            WitNode::ListValue(e) => {
                                                *base.add(0).cast::<u8>() = (5i32) as u8;
                                                let vec6 = e;
                                                let ptr6 = vec6.as_ptr().cast::<u8>();
                                                let len6 = vec6.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len6;
                                                *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
                                            }
                                            WitNode::OptionValue(e) => {
                                                *base.add(0).cast::<u8>() = (6i32) as u8;
                                                match e {
                                                    Some(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        *base.add(12).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::ResultValue(e) => {
                                                *base.add(0).cast::<u8>() = (7i32) as u8;
                                                match e {
                                                    Ok(e) => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                    Err(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                };
                                            }
                                            WitNode::PrimU8(e) => {
                                                *base.add(0).cast::<u8>() = (8i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimU16(e) => {
                                                *base.add(0).cast::<u8>() = (9i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimU32(e) => {
                                                *base.add(0).cast::<u8>() = (10i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimU64(e) => {
                                                *base.add(0).cast::<u8>() = (11i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimS8(e) => {
                                                *base.add(0).cast::<u8>() = (12i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimS16(e) => {
                                                *base.add(0).cast::<u8>() = (13i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimS32(e) => {
                                                *base.add(0).cast::<u8>() = (14i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimS64(e) => {
                                                *base.add(0).cast::<u8>() = (15i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimFloat32(e) => {
                                                *base.add(0).cast::<u8>() = (16i32) as u8;
                                                *base.add(8).cast::<f32>() = _rt::as_f32(e);
                                            }
                                            WitNode::PrimFloat64(e) => {
                                                *base.add(0).cast::<u8>() = (17i32) as u8;
                                                *base.add(8).cast::<f64>() = _rt::as_f64(e);
                                            }
                                            WitNode::PrimChar(e) => {
                                                *base.add(0).cast::<u8>() = (18i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimBool(e) => {
                                                *base.add(0).cast::<u8>() = (19i32) as u8;
                                                *base.add(8).cast::<u8>() = (match e {
                                                    true => 1,
                                                    false => 0,
                                                }) as u8;
                                            }
                                            WitNode::PrimString(e) => {
                                                *base.add(0).cast::<u8>() = (20i32) as u8;
                                                let vec7 = e;
                                                let ptr7 = vec7.as_ptr().cast::<u8>();
                                                let len7 = vec7.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len7;
                                                *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
                                            }
                                            WitNode::Handle(e) => {
                                                *base.add(0).cast::<u8>() = (21i32) as u8;
                                                let (t8_0, t8_1) = e;
                                                let Uri { value: value9 } = t8_0;
                                                let vec10 = value9;
                                                let ptr10 = vec10.as_ptr().cast::<u8>();
                                                let len10 = vec10.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len10;
                                                *base.add(8).cast::<*mut u8>() = ptr10.cast_mut();
                                                *base
                                                    .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i64>() = _rt::as_i64(t8_1);
                                            }
                                        }
                                    }
                                }
                                *base
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<usize>() = len11;
                                *base.add(0).cast::<*mut u8>() = result11;
                                cleanup_list.extend_from_slice(&[(result11, layout11)]);
                            }
                        }
                        #[cfg(target_arch = "wasm32")]
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[method]wasm-rpc.async-invoke-and-await"]
                            fn wit_import13(
                                _: i32,
                                _: *mut u8,
                                _: usize,
                                _: *mut u8,
                                _: usize,
                            ) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import13(
                            _: i32,
                            _: *mut u8,
                            _: usize,
                            _: *mut u8,
                            _: usize,
                        ) -> i32 {
                            unreachable!()
                        }
                        let ret = unsafe {
                            wit_import13(
                                (self).handle() as i32,
                                ptr0.cast_mut(),
                                len0,
                                result12,
                                len12,
                            )
                        };
                        if layout12.size() != 0 {
                            _rt::alloc::dealloc(result12.cast(), layout12);
                        }
                        for (ptr, layout) in cleanup_list {
                            if layout.size() != 0 {
                                _rt::alloc::dealloc(ptr.cast(), layout);
                            }
                        }
                        unsafe { FutureInvokeResult::from_handle(ret as u32) }
                    }
                }
            }
            impl WasmRpc {
                #[allow(unused_unsafe, clippy::all)]
                /// Schedule invocation for later
                pub fn schedule_invocation(
                    &self,
                    scheduled_time: Datetime,
                    function_name: &str,
                    function_params: &[WitValue],
                ) -> () {
                    unsafe {
                        let mut cleanup_list = _rt::Vec::new();
                        let super::super::super::__with_name0::Datetime {
                            seconds: seconds0,
                            nanoseconds: nanoseconds0,
                        } = scheduled_time;
                        let vec1 = function_name;
                        let ptr1 = vec1.as_ptr().cast::<u8>();
                        let len1 = vec1.len();
                        let vec13 = function_params;
                        let len13 = vec13.len();
                        let layout13 = _rt::alloc::Layout::from_size_align_unchecked(
                            vec13.len() * (2 * ::core::mem::size_of::<*const u8>()),
                            ::core::mem::size_of::<*const u8>(),
                        );
                        let result13 = if layout13.size() != 0 {
                            let ptr = _rt::alloc::alloc(layout13).cast::<u8>();
                            if ptr.is_null() {
                                _rt::alloc::handle_alloc_error(layout13);
                            }
                            ptr
                        } else {
                            ::core::ptr::null_mut()
                        };
                        for (i, e) in vec13.into_iter().enumerate() {
                            let base = result13
                                .add(i * (2 * ::core::mem::size_of::<*const u8>()));
                            {
                                let WitValue { nodes: nodes2 } = e;
                                let vec12 = nodes2;
                                let len12 = vec12.len();
                                let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
                                    vec12.len()
                                        * (16 + 2 * ::core::mem::size_of::<*const u8>()),
                                    8,
                                );
                                let result12 = if layout12.size() != 0 {
                                    let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
                                    if ptr.is_null() {
                                        _rt::alloc::handle_alloc_error(layout12);
                                    }
                                    ptr
                                } else {
                                    ::core::ptr::null_mut()
                                };
                                for (i, e) in vec12.into_iter().enumerate() {
                                    let base = result12
                                        .add(i * (16 + 2 * ::core::mem::size_of::<*const u8>()));
                                    {
                                        match e {
                                            WitNode::RecordValue(e) => {
                                                *base.add(0).cast::<u8>() = (0i32) as u8;
                                                let vec3 = e;
                                                let ptr3 = vec3.as_ptr().cast::<u8>();
                                                let len3 = vec3.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len3;
                                                *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
                                            }
                                            WitNode::VariantValue(e) => {
                                                *base.add(0).cast::<u8>() = (1i32) as u8;
                                                let (t4_0, t4_1) = e;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(t4_0);
                                                match t4_1 {
                                                    Some(e) => {
                                                        *base.add(12).cast::<u8>() = (1i32) as u8;
                                                        *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(12).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::EnumValue(e) => {
                                                *base.add(0).cast::<u8>() = (2i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::FlagsValue(e) => {
                                                *base.add(0).cast::<u8>() = (3i32) as u8;
                                                let vec5 = e;
                                                let len5 = vec5.len();
                                                let layout5 = _rt::alloc::Layout::from_size_align_unchecked(
                                                    vec5.len() * 1,
                                                    1,
                                                );
                                                let result5 = if layout5.size() != 0 {
                                                    let ptr = _rt::alloc::alloc(layout5).cast::<u8>();
                                                    if ptr.is_null() {
                                                        _rt::alloc::handle_alloc_error(layout5);
                                                    }
                                                    ptr
                                                } else {
                                                    ::core::ptr::null_mut()
                                                };
                                                for (i, e) in vec5.into_iter().enumerate() {
                                                    let base = result5.add(i * 1);
                                                    {
                                                        *base.add(0).cast::<u8>() = (match e {
                                                            true => 1,
                                                            false => 0,
                                                        }) as u8;
                                                    }
                                                }
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len5;
                                                *base.add(8).cast::<*mut u8>() = result5;
                                                cleanup_list.extend_from_slice(&[(result5, layout5)]);
                                            }
                                            WitNode::TupleValue(e) => {
                                                *base.add(0).cast::<u8>() = (4i32) as u8;
                                                let vec6 = e;
                                                let ptr6 = vec6.as_ptr().cast::<u8>();
                                                let len6 = vec6.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len6;
                                                *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
                                            }
                                            WitNode::ListValue(e) => {
                                                *base.add(0).cast::<u8>() = (5i32) as u8;
                                                let vec7 = e;
                                                let ptr7 = vec7.as_ptr().cast::<u8>();
                                                let len7 = vec7.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len7;
                                                *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
                                            }
                                            WitNode::OptionValue(e) => {
                                                *base.add(0).cast::<u8>() = (6i32) as u8;
                                                match e {
                                                    Some(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        *base.add(12).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::ResultValue(e) => {
                                                *base.add(0).cast::<u8>() = (7i32) as u8;
                                                match e {
                                                    Ok(e) => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                    Err(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                };
                                            }
                                            WitNode::PrimU8(e) => {
                                                *base.add(0).cast::<u8>() = (8i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimU16(e) => {
                                                *base.add(0).cast::<u8>() = (9i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimU32(e) => {
                                                *base.add(0).cast::<u8>() = (10i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimU64(e) => {
                                                *base.add(0).cast::<u8>() = (11i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimS8(e) => {
                                                *base.add(0).cast::<u8>() = (12i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimS16(e) => {
                                                *base.add(0).cast::<u8>() = (13i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimS32(e) => {
                                                *base.add(0).cast::<u8>() = (14i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimS64(e) => {
                                                *base.add(0).cast::<u8>() = (15i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimFloat32(e) => {
                                                *base.add(0).cast::<u8>() = (16i32) as u8;
                                                *base.add(8).cast::<f32>() = _rt::as_f32(e);
                                            }
                                            WitNode::PrimFloat64(e) => {
                                                *base.add(0).cast::<u8>() = (17i32) as u8;
                                                *base.add(8).cast::<f64>() = _rt::as_f64(e);
                                            }
                                            WitNode::PrimChar(e) => {
                                                *base.add(0).cast::<u8>() = (18i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimBool(e) => {
                                                *base.add(0).cast::<u8>() = (19i32) as u8;
                                                *base.add(8).cast::<u8>() = (match e {
                                                    true => 1,
                                                    false => 0,
                                                }) as u8;
                                            }
                                            WitNode::PrimString(e) => {
                                                *base.add(0).cast::<u8>() = (20i32) as u8;
                                                let vec8 = e;
                                                let ptr8 = vec8.as_ptr().cast::<u8>();
                                                let len8 = vec8.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len8;
                                                *base.add(8).cast::<*mut u8>() = ptr8.cast_mut();
                                            }
                                            WitNode::Handle(e) => {
                                                *base.add(0).cast::<u8>() = (21i32) as u8;
                                                let (t9_0, t9_1) = e;
                                                let Uri { value: value10 } = t9_0;
                                                let vec11 = value10;
                                                let ptr11 = vec11.as_ptr().cast::<u8>();
                                                let len11 = vec11.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len11;
                                                *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
                                                *base
                                                    .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i64>() = _rt::as_i64(t9_1);
                                            }
                                        }
                                    }
                                }
                                *base
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<usize>() = len12;
                                *base.add(0).cast::<*mut u8>() = result12;
                                cleanup_list.extend_from_slice(&[(result12, layout12)]);
                            }
                        }
                        #[cfg(target_arch = "wasm32")]
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[method]wasm-rpc.schedule-invocation"]
                            fn wit_import14(
                                _: i32,
                                _: i64,
                                _: i32,
                                _: *mut u8,
                                _: usize,
                                _: *mut u8,
                                _: usize,
                            );
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import14(
                            _: i32,
                            _: i64,
                            _: i32,
                            _: *mut u8,
                            _: usize,
                            _: *mut u8,
                            _: usize,
                        ) {
                            unreachable!()
                        }
                        unsafe {
                            wit_import14(
                                (self).handle() as i32,
                                _rt::as_i64(seconds0),
                                _rt::as_i32(nanoseconds0),
                                ptr1.cast_mut(),
                                len1,
                                result13,
                                len13,
                            )
                        };
                        if layout13.size() != 0 {
                            _rt::alloc::dealloc(result13.cast(), layout13);
                        }
                        for (ptr, layout) in cleanup_list {
                            if layout.size() != 0 {
                                _rt::alloc::dealloc(ptr.cast(), layout);
                            }
                        }
                    }
                }
            }
            impl WasmRpc {
                #[allow(unused_unsafe, clippy::all)]
                /// Schedule invocation for later. Call cancel on the returned resource to cancel the invocation before the scheduled time.
                pub fn schedule_cancelable_invocation(
                    &self,
                    scheduled_time: Datetime,
                    function_name: &str,
                    function_params: &[WitValue],
                ) -> CancellationToken {
                    unsafe {
                        let mut cleanup_list = _rt::Vec::new();
                        let super::super::super::__with_name0::Datetime {
                            seconds: seconds0,
                            nanoseconds: nanoseconds0,
                        } = scheduled_time;
                        let vec1 = function_name;
                        let ptr1 = vec1.as_ptr().cast::<u8>();
                        let len1 = vec1.len();
                        let vec13 = function_params;
                        let len13 = vec13.len();
                        let layout13 = _rt::alloc::Layout::from_size_align_unchecked(
                            vec13.len() * (2 * ::core::mem::size_of::<*const u8>()),
                            ::core::mem::size_of::<*const u8>(),
                        );
                        let result13 = if layout13.size() != 0 {
                            let ptr = _rt::alloc::alloc(layout13).cast::<u8>();
                            if ptr.is_null() {
                                _rt::alloc::handle_alloc_error(layout13);
                            }
                            ptr
                        } else {
                            ::core::ptr::null_mut()
                        };
                        for (i, e) in vec13.into_iter().enumerate() {
                            let base = result13
                                .add(i * (2 * ::core::mem::size_of::<*const u8>()));
                            {
                                let WitValue { nodes: nodes2 } = e;
                                let vec12 = nodes2;
                                let len12 = vec12.len();
                                let layout12 = _rt::alloc::Layout::from_size_align_unchecked(
                                    vec12.len()
                                        * (16 + 2 * ::core::mem::size_of::<*const u8>()),
                                    8,
                                );
                                let result12 = if layout12.size() != 0 {
                                    let ptr = _rt::alloc::alloc(layout12).cast::<u8>();
                                    if ptr.is_null() {
                                        _rt::alloc::handle_alloc_error(layout12);
                                    }
                                    ptr
                                } else {
                                    ::core::ptr::null_mut()
                                };
                                for (i, e) in vec12.into_iter().enumerate() {
                                    let base = result12
                                        .add(i * (16 + 2 * ::core::mem::size_of::<*const u8>()));
                                    {
                                        match e {
                                            WitNode::RecordValue(e) => {
                                                *base.add(0).cast::<u8>() = (0i32) as u8;
                                                let vec3 = e;
                                                let ptr3 = vec3.as_ptr().cast::<u8>();
                                                let len3 = vec3.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len3;
                                                *base.add(8).cast::<*mut u8>() = ptr3.cast_mut();
                                            }
                                            WitNode::VariantValue(e) => {
                                                *base.add(0).cast::<u8>() = (1i32) as u8;
                                                let (t4_0, t4_1) = e;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(t4_0);
                                                match t4_1 {
                                                    Some(e) => {
                                                        *base.add(12).cast::<u8>() = (1i32) as u8;
                                                        *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(12).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::EnumValue(e) => {
                                                *base.add(0).cast::<u8>() = (2i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::FlagsValue(e) => {
                                                *base.add(0).cast::<u8>() = (3i32) as u8;
                                                let vec5 = e;
                                                let len5 = vec5.len();
                                                let layout5 = _rt::alloc::Layout::from_size_align_unchecked(
                                                    vec5.len() * 1,
                                                    1,
                                                );
                                                let result5 = if layout5.size() != 0 {
                                                    let ptr = _rt::alloc::alloc(layout5).cast::<u8>();
                                                    if ptr.is_null() {
                                                        _rt::alloc::handle_alloc_error(layout5);
                                                    }
                                                    ptr
                                                } else {
                                                    ::core::ptr::null_mut()
                                                };
                                                for (i, e) in vec5.into_iter().enumerate() {
                                                    let base = result5.add(i * 1);
                                                    {
                                                        *base.add(0).cast::<u8>() = (match e {
                                                            true => 1,
                                                            false => 0,
                                                        }) as u8;
                                                    }
                                                }
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len5;
                                                *base.add(8).cast::<*mut u8>() = result5;
                                                cleanup_list.extend_from_slice(&[(result5, layout5)]);
                                            }
                                            WitNode::TupleValue(e) => {
                                                *base.add(0).cast::<u8>() = (4i32) as u8;
                                                let vec6 = e;
                                                let ptr6 = vec6.as_ptr().cast::<u8>();
                                                let len6 = vec6.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len6;
                                                *base.add(8).cast::<*mut u8>() = ptr6.cast_mut();
                                            }
                                            WitNode::ListValue(e) => {
                                                *base.add(0).cast::<u8>() = (5i32) as u8;
                                                let vec7 = e;
                                                let ptr7 = vec7.as_ptr().cast::<u8>();
                                                let len7 = vec7.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len7;
                                                *base.add(8).cast::<*mut u8>() = ptr7.cast_mut();
                                            }
                                            WitNode::OptionValue(e) => {
                                                *base.add(0).cast::<u8>() = (6i32) as u8;
                                                match e {
                                                    Some(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        *base.add(12).cast::<i32>() = _rt::as_i32(e);
                                                    }
                                                    None => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                    }
                                                };
                                            }
                                            WitNode::ResultValue(e) => {
                                                *base.add(0).cast::<u8>() = (7i32) as u8;
                                                match e {
                                                    Ok(e) => {
                                                        *base.add(8).cast::<u8>() = (0i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                    Err(e) => {
                                                        *base.add(8).cast::<u8>() = (1i32) as u8;
                                                        match e {
                                                            Some(e) => {
                                                                *base.add(12).cast::<u8>() = (1i32) as u8;
                                                                *base.add(16).cast::<i32>() = _rt::as_i32(e);
                                                            }
                                                            None => {
                                                                *base.add(12).cast::<u8>() = (0i32) as u8;
                                                            }
                                                        };
                                                    }
                                                };
                                            }
                                            WitNode::PrimU8(e) => {
                                                *base.add(0).cast::<u8>() = (8i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimU16(e) => {
                                                *base.add(0).cast::<u8>() = (9i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimU32(e) => {
                                                *base.add(0).cast::<u8>() = (10i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimU64(e) => {
                                                *base.add(0).cast::<u8>() = (11i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimS8(e) => {
                                                *base.add(0).cast::<u8>() = (12i32) as u8;
                                                *base.add(8).cast::<u8>() = (_rt::as_i32(e)) as u8;
                                            }
                                            WitNode::PrimS16(e) => {
                                                *base.add(0).cast::<u8>() = (13i32) as u8;
                                                *base.add(8).cast::<u16>() = (_rt::as_i32(e)) as u16;
                                            }
                                            WitNode::PrimS32(e) => {
                                                *base.add(0).cast::<u8>() = (14i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimS64(e) => {
                                                *base.add(0).cast::<u8>() = (15i32) as u8;
                                                *base.add(8).cast::<i64>() = _rt::as_i64(e);
                                            }
                                            WitNode::PrimFloat32(e) => {
                                                *base.add(0).cast::<u8>() = (16i32) as u8;
                                                *base.add(8).cast::<f32>() = _rt::as_f32(e);
                                            }
                                            WitNode::PrimFloat64(e) => {
                                                *base.add(0).cast::<u8>() = (17i32) as u8;
                                                *base.add(8).cast::<f64>() = _rt::as_f64(e);
                                            }
                                            WitNode::PrimChar(e) => {
                                                *base.add(0).cast::<u8>() = (18i32) as u8;
                                                *base.add(8).cast::<i32>() = _rt::as_i32(e);
                                            }
                                            WitNode::PrimBool(e) => {
                                                *base.add(0).cast::<u8>() = (19i32) as u8;
                                                *base.add(8).cast::<u8>() = (match e {
                                                    true => 1,
                                                    false => 0,
                                                }) as u8;
                                            }
                                            WitNode::PrimString(e) => {
                                                *base.add(0).cast::<u8>() = (20i32) as u8;
                                                let vec8 = e;
                                                let ptr8 = vec8.as_ptr().cast::<u8>();
                                                let len8 = vec8.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len8;
                                                *base.add(8).cast::<*mut u8>() = ptr8.cast_mut();
                                            }
                                            WitNode::Handle(e) => {
                                                *base.add(0).cast::<u8>() = (21i32) as u8;
                                                let (t9_0, t9_1) = e;
                                                let Uri { value: value10 } = t9_0;
                                                let vec11 = value10;
                                                let ptr11 = vec11.as_ptr().cast::<u8>();
                                                let len11 = vec11.len();
                                                *base
                                                    .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>() = len11;
                                                *base.add(8).cast::<*mut u8>() = ptr11.cast_mut();
                                                *base
                                                    .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<i64>() = _rt::as_i64(t9_1);
                                            }
                                        }
                                    }
                                }
                                *base
                                    .add(::core::mem::size_of::<*const u8>())
                                    .cast::<usize>() = len12;
                                *base.add(0).cast::<*mut u8>() = result12;
                                cleanup_list.extend_from_slice(&[(result12, layout12)]);
                            }
                        }
                        #[cfg(target_arch = "wasm32")]
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[method]wasm-rpc.schedule-cancelable-invocation"]
                            fn wit_import14(
                                _: i32,
                                _: i64,
                                _: i32,
                                _: *mut u8,
                                _: usize,
                                _: *mut u8,
                                _: usize,
                            ) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import14(
                            _: i32,
                            _: i64,
                            _: i32,
                            _: *mut u8,
                            _: usize,
                            _: *mut u8,
                            _: usize,
                        ) -> i32 {
                            unreachable!()
                        }
                        let ret = unsafe {
                            wit_import14(
                                (self).handle() as i32,
                                _rt::as_i64(seconds0),
                                _rt::as_i32(nanoseconds0),
                                ptr1.cast_mut(),
                                len1,
                                result13,
                                len13,
                            )
                        };
                        if layout13.size() != 0 {
                            _rt::alloc::dealloc(result13.cast(), layout13);
                        }
                        for (ptr, layout) in cleanup_list {
                            if layout.size() != 0 {
                                _rt::alloc::dealloc(ptr.cast(), layout);
                            }
                        }
                        unsafe { CancellationToken::from_handle(ret as u32) }
                    }
                }
            }
            impl FutureInvokeResult {
                #[allow(unused_unsafe, clippy::all)]
                /// Subscribes to the result of the invocation
                pub fn subscribe(&self) -> Pollable {
                    unsafe {
                        #[cfg(target_arch = "wasm32")]
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[method]future-invoke-result.subscribe"]
                            fn wit_import0(_: i32) -> i32;
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
                            unreachable!()
                        }
                        let ret = unsafe { wit_import0((self).handle() as i32) };
                        unsafe {
                            super::super::super::__with_name1::Pollable::from_handle(
                                ret as u32,
                            )
                        }
                    }
                }
            }
            impl FutureInvokeResult {
                #[allow(unused_unsafe, clippy::all)]
                /// Poll for the invocation. If the invocation has not completed yet, returns `none`.
                pub fn get(&self) -> Option<Result<WitValue, RpcError>> {
                    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 = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[method]future-invoke-result.get"]
                            fn wit_import1(_: i32, _: *mut u8);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
                            unreachable!()
                        }
                        unsafe { wit_import1((self).handle() as i32, ptr0) };
                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
                        let result66 = match l2 {
                            0 => None,
                            1 => {
                                let e = {
                                    let l3 = i32::from(
                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
                                    );
                                    match l3 {
                                        0 => {
                                            let e = {
                                                let l4 = *ptr0
                                                    .add(2 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<*mut u8>();
                                                let l5 = *ptr0
                                                    .add(3 * ::core::mem::size_of::<*const u8>())
                                                    .cast::<usize>();
                                                let base51 = l4;
                                                let len51 = l5;
                                                let mut result51 = _rt::Vec::with_capacity(len51);
                                                for i in 0..len51 {
                                                    let base = base51
                                                        .add(i * (16 + 2 * ::core::mem::size_of::<*const u8>()));
                                                    let e51 = {
                                                        let l6 = i32::from(*base.add(0).cast::<u8>());
                                                        let v50 = match l6 {
                                                            0 => {
                                                                let e50 = {
                                                                    let l7 = *base.add(8).cast::<*mut u8>();
                                                                    let l8 = *base
                                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                        .cast::<usize>();
                                                                    let len9 = l8;
                                                                    _rt::Vec::from_raw_parts(l7.cast(), len9, len9)
                                                                };
                                                                WitNode::RecordValue(e50)
                                                            }
                                                            1 => {
                                                                let e50 = {
                                                                    let l10 = *base.add(8).cast::<i32>();
                                                                    let l11 = i32::from(*base.add(12).cast::<u8>());
                                                                    (
                                                                        l10 as u32,
                                                                        match l11 {
                                                                            0 => None,
                                                                            1 => {
                                                                                let e = {
                                                                                    let l12 = *base.add(16).cast::<i32>();
                                                                                    l12
                                                                                };
                                                                                Some(e)
                                                                            }
                                                                            _ => _rt::invalid_enum_discriminant(),
                                                                        },
                                                                    )
                                                                };
                                                                WitNode::VariantValue(e50)
                                                            }
                                                            2 => {
                                                                let e50 = {
                                                                    let l13 = *base.add(8).cast::<i32>();
                                                                    l13 as u32
                                                                };
                                                                WitNode::EnumValue(e50)
                                                            }
                                                            3 => {
                                                                let e50 = {
                                                                    let l14 = *base.add(8).cast::<*mut u8>();
                                                                    let l15 = *base
                                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                        .cast::<usize>();
                                                                    let base17 = l14;
                                                                    let len17 = l15;
                                                                    let mut result17 = _rt::Vec::with_capacity(len17);
                                                                    for i in 0..len17 {
                                                                        let base = base17.add(i * 1);
                                                                        let e17 = {
                                                                            let l16 = i32::from(*base.add(0).cast::<u8>());
                                                                            _rt::bool_lift(l16 as u8)
                                                                        };
                                                                        result17.push(e17);
                                                                    }
                                                                    _rt::cabi_dealloc(base17, len17 * 1, 1);
                                                                    result17
                                                                };
                                                                WitNode::FlagsValue(e50)
                                                            }
                                                            4 => {
                                                                let e50 = {
                                                                    let l18 = *base.add(8).cast::<*mut u8>();
                                                                    let l19 = *base
                                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                        .cast::<usize>();
                                                                    let len20 = l19;
                                                                    _rt::Vec::from_raw_parts(l18.cast(), len20, len20)
                                                                };
                                                                WitNode::TupleValue(e50)
                                                            }
                                                            5 => {
                                                                let e50 = {
                                                                    let l21 = *base.add(8).cast::<*mut u8>();
                                                                    let l22 = *base
                                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                        .cast::<usize>();
                                                                    let len23 = l22;
                                                                    _rt::Vec::from_raw_parts(l21.cast(), len23, len23)
                                                                };
                                                                WitNode::ListValue(e50)
                                                            }
                                                            6 => {
                                                                let e50 = {
                                                                    let l24 = i32::from(*base.add(8).cast::<u8>());
                                                                    match l24 {
                                                                        0 => None,
                                                                        1 => {
                                                                            let e = {
                                                                                let l25 = *base.add(12).cast::<i32>();
                                                                                l25
                                                                            };
                                                                            Some(e)
                                                                        }
                                                                        _ => _rt::invalid_enum_discriminant(),
                                                                    }
                                                                };
                                                                WitNode::OptionValue(e50)
                                                            }
                                                            7 => {
                                                                let e50 = {
                                                                    let l26 = i32::from(*base.add(8).cast::<u8>());
                                                                    match l26 {
                                                                        0 => {
                                                                            let e = {
                                                                                let l27 = i32::from(*base.add(12).cast::<u8>());
                                                                                match l27 {
                                                                                    0 => None,
                                                                                    1 => {
                                                                                        let e = {
                                                                                            let l28 = *base.add(16).cast::<i32>();
                                                                                            l28
                                                                                        };
                                                                                        Some(e)
                                                                                    }
                                                                                    _ => _rt::invalid_enum_discriminant(),
                                                                                }
                                                                            };
                                                                            Ok(e)
                                                                        }
                                                                        1 => {
                                                                            let e = {
                                                                                let l29 = i32::from(*base.add(12).cast::<u8>());
                                                                                match l29 {
                                                                                    0 => None,
                                                                                    1 => {
                                                                                        let e = {
                                                                                            let l30 = *base.add(16).cast::<i32>();
                                                                                            l30
                                                                                        };
                                                                                        Some(e)
                                                                                    }
                                                                                    _ => _rt::invalid_enum_discriminant(),
                                                                                }
                                                                            };
                                                                            Err(e)
                                                                        }
                                                                        _ => _rt::invalid_enum_discriminant(),
                                                                    }
                                                                };
                                                                WitNode::ResultValue(e50)
                                                            }
                                                            8 => {
                                                                let e50 = {
                                                                    let l31 = i32::from(*base.add(8).cast::<u8>());
                                                                    l31 as u8
                                                                };
                                                                WitNode::PrimU8(e50)
                                                            }
                                                            9 => {
                                                                let e50 = {
                                                                    let l32 = i32::from(*base.add(8).cast::<u16>());
                                                                    l32 as u16
                                                                };
                                                                WitNode::PrimU16(e50)
                                                            }
                                                            10 => {
                                                                let e50 = {
                                                                    let l33 = *base.add(8).cast::<i32>();
                                                                    l33 as u32
                                                                };
                                                                WitNode::PrimU32(e50)
                                                            }
                                                            11 => {
                                                                let e50 = {
                                                                    let l34 = *base.add(8).cast::<i64>();
                                                                    l34 as u64
                                                                };
                                                                WitNode::PrimU64(e50)
                                                            }
                                                            12 => {
                                                                let e50 = {
                                                                    let l35 = i32::from(*base.add(8).cast::<i8>());
                                                                    l35 as i8
                                                                };
                                                                WitNode::PrimS8(e50)
                                                            }
                                                            13 => {
                                                                let e50 = {
                                                                    let l36 = i32::from(*base.add(8).cast::<i16>());
                                                                    l36 as i16
                                                                };
                                                                WitNode::PrimS16(e50)
                                                            }
                                                            14 => {
                                                                let e50 = {
                                                                    let l37 = *base.add(8).cast::<i32>();
                                                                    l37
                                                                };
                                                                WitNode::PrimS32(e50)
                                                            }
                                                            15 => {
                                                                let e50 = {
                                                                    let l38 = *base.add(8).cast::<i64>();
                                                                    l38
                                                                };
                                                                WitNode::PrimS64(e50)
                                                            }
                                                            16 => {
                                                                let e50 = {
                                                                    let l39 = *base.add(8).cast::<f32>();
                                                                    l39
                                                                };
                                                                WitNode::PrimFloat32(e50)
                                                            }
                                                            17 => {
                                                                let e50 = {
                                                                    let l40 = *base.add(8).cast::<f64>();
                                                                    l40
                                                                };
                                                                WitNode::PrimFloat64(e50)
                                                            }
                                                            18 => {
                                                                let e50 = {
                                                                    let l41 = *base.add(8).cast::<i32>();
                                                                    _rt::char_lift(l41 as u32)
                                                                };
                                                                WitNode::PrimChar(e50)
                                                            }
                                                            19 => {
                                                                let e50 = {
                                                                    let l42 = i32::from(*base.add(8).cast::<u8>());
                                                                    _rt::bool_lift(l42 as u8)
                                                                };
                                                                WitNode::PrimBool(e50)
                                                            }
                                                            20 => {
                                                                let e50 = {
                                                                    let l43 = *base.add(8).cast::<*mut u8>();
                                                                    let l44 = *base
                                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                        .cast::<usize>();
                                                                    let len45 = l44;
                                                                    let bytes45 = _rt::Vec::from_raw_parts(
                                                                        l43.cast(),
                                                                        len45,
                                                                        len45,
                                                                    );
                                                                    _rt::string_lift(bytes45)
                                                                };
                                                                WitNode::PrimString(e50)
                                                            }
                                                            n => {
                                                                debug_assert_eq!(n, 21, "invalid enum discriminant");
                                                                let e50 = {
                                                                    let l46 = *base.add(8).cast::<*mut u8>();
                                                                    let l47 = *base
                                                                        .add(8 + 1 * ::core::mem::size_of::<*const u8>())
                                                                        .cast::<usize>();
                                                                    let len48 = l47;
                                                                    let bytes48 = _rt::Vec::from_raw_parts(
                                                                        l46.cast(),
                                                                        len48,
                                                                        len48,
                                                                    );
                                                                    let l49 = *base
                                                                        .add(8 + 2 * ::core::mem::size_of::<*const u8>())
                                                                        .cast::<i64>();
                                                                    (
                                                                        Uri {
                                                                            value: _rt::string_lift(bytes48),
                                                                        },
                                                                        l49 as u64,
                                                                    )
                                                                };
                                                                WitNode::Handle(e50)
                                                            }
                                                        };
                                                        v50
                                                    };
                                                    result51.push(e51);
                                                }
                                                _rt::cabi_dealloc(
                                                    base51,
                                                    len51 * (16 + 2 * ::core::mem::size_of::<*const u8>()),
                                                    8,
                                                );
                                                WitValue { nodes: result51 }
                                            };
                                            Ok(e)
                                        }
                                        1 => {
                                            let e = {
                                                let l52 = i32::from(
                                                    *ptr0
                                                        .add(2 * ::core::mem::size_of::<*const u8>())
                                                        .cast::<u8>(),
                                                );
                                                let v65 = match l52 {
                                                    0 => {
                                                        let e65 = {
                                                            let l53 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l54 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len55 = l54;
                                                            let bytes55 = _rt::Vec::from_raw_parts(
                                                                l53.cast(),
                                                                len55,
                                                                len55,
                                                            );
                                                            _rt::string_lift(bytes55)
                                                        };
                                                        RpcError::ProtocolError(e65)
                                                    }
                                                    1 => {
                                                        let e65 = {
                                                            let l56 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l57 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len58 = l57;
                                                            let bytes58 = _rt::Vec::from_raw_parts(
                                                                l56.cast(),
                                                                len58,
                                                                len58,
                                                            );
                                                            _rt::string_lift(bytes58)
                                                        };
                                                        RpcError::Denied(e65)
                                                    }
                                                    2 => {
                                                        let e65 = {
                                                            let l59 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l60 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len61 = l60;
                                                            let bytes61 = _rt::Vec::from_raw_parts(
                                                                l59.cast(),
                                                                len61,
                                                                len61,
                                                            );
                                                            _rt::string_lift(bytes61)
                                                        };
                                                        RpcError::NotFound(e65)
                                                    }
                                                    n => {
                                                        debug_assert_eq!(n, 3, "invalid enum discriminant");
                                                        let e65 = {
                                                            let l62 = *ptr0
                                                                .add(3 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<*mut u8>();
                                                            let l63 = *ptr0
                                                                .add(4 * ::core::mem::size_of::<*const u8>())
                                                                .cast::<usize>();
                                                            let len64 = l63;
                                                            let bytes64 = _rt::Vec::from_raw_parts(
                                                                l62.cast(),
                                                                len64,
                                                                len64,
                                                            );
                                                            _rt::string_lift(bytes64)
                                                        };
                                                        RpcError::RemoteInternalError(e65)
                                                    }
                                                };
                                                v65
                                            };
                                            Err(e)
                                        }
                                        _ => _rt::invalid_enum_discriminant(),
                                    }
                                };
                                Some(e)
                            }
                            _ => _rt::invalid_enum_discriminant(),
                        };
                        result66
                    }
                }
            }
            impl CancellationToken {
                #[allow(unused_unsafe, clippy::all)]
                /// Cancel the scheduled invocation
                pub fn cancel(&self) -> () {
                    unsafe {
                        #[cfg(target_arch = "wasm32")]
                        #[link(wasm_import_module = "golem:rpc/types@0.2.2")]
                        unsafe extern "C" {
                            #[link_name = "[method]cancellation-token.cancel"]
                            fn wit_import0(_: i32);
                        }
                        #[cfg(not(target_arch = "wasm32"))]
                        unsafe extern "C" fn wit_import0(_: i32) {
                            unreachable!()
                        }
                        unsafe { wit_import0((self).handle() as i32) };
                    }
                }
            }
        }
    }
}
#[rustfmt::skip]
mod _rt {
    #![allow(dead_code, clippy::all)]
    pub use alloc_crate::string::String;
    pub use alloc_crate::vec::Vec;
    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 != 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 unsafe fn string_lift(bytes: Vec<u8>) -> String {
        if cfg!(debug_assertions) {
            String::from_utf8(bytes).unwrap()
        } else {
            String::from_utf8_unchecked(bytes)
        }
    }
    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_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 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
        }
    }
    pub use alloc_crate::alloc;
    pub fn as_f32<T: AsF32>(t: T) -> f32 {
        t.as_f32()
    }
    pub trait AsF32 {
        fn as_f32(self) -> f32;
    }
    impl<'a, T: Copy + AsF32> AsF32 for &'a T {
        fn as_f32(self) -> f32 {
            (*self).as_f32()
        }
    }
    impl AsF32 for f32 {
        #[inline]
        fn as_f32(self) -> f32 {
            self as f32
        }
    }
    pub fn as_f64<T: AsF64>(t: T) -> f64 {
        t.as_f64()
    }
    pub trait AsF64 {
        fn as_f64(self) -> f64;
    }
    impl<'a, T: Copy + AsF64> AsF64 for &'a T {
        fn as_f64(self) -> f64 {
            (*self).as_f64()
        }
    }
    impl AsF64 for f64 {
        #[inline]
        fn as_f64(self) -> f64 {
            self as f64
        }
    }
    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
        }
    }
    pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) {
        if size == 0 {
            return;
        }
        let layout = alloc::Layout::from_size_align_unchecked(size, align);
        alloc::dealloc(ptr, layout);
    }
    pub unsafe fn char_lift(val: u32) -> char {
        if cfg!(debug_assertions) {
            core::char::from_u32(val).unwrap()
        } else {
            core::char::from_u32_unchecked(val)
        }
    }
    extern crate alloc as alloc_crate;
}
#[cfg(target_arch = "wasm32")]
#[unsafe(
    link_section = "component-type:wit-bindgen:0.41.0:golem:rpc:wasm-rpc:encoded world"
)]
#[doc(hidden)]
#[allow(clippy::octal_escapes)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 2456] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x99\x12\x01A\x02\x01\
A\x08\x01B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08datetime\x03\0\0\x01\
@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\0\x1cwasi:clocks/\
wall-clock@0.2.3\x05\0\x01B\x0a\x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04sel\
f\x01\0\x7f\x04\0\x16[method]pollable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\
\0\x16[method]pollable.block\x01\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\
\0\x04poll\x01\x06\x03\0\x12wasi:io/poll@0.2.3\x05\x01\x02\x03\0\0\x08datetime\x02\
\x03\0\x01\x08pollable\x01BU\x02\x03\x02\x01\x02\x04\0\x08datetime\x03\0\0\x02\x03\
\x02\x01\x03\x04\0\x08pollable\x03\0\x02\x01r\x02\x09high-bitsw\x08low-bitsw\x04\
\0\x04uuid\x03\0\x04\x01r\x01\x04uuid\x05\x04\0\x0ccomponent-id\x03\0\x06\x01r\x02\
\x0ccomponent-id\x07\x08agent-ids\x04\0\x08agent-id\x03\0\x08\x01z\x04\0\x0anode\
-index\x03\0\x0a\x01w\x04\0\x0bresource-id\x03\0\x0c\x01m\x02\x05owned\x08borrow\
ed\x04\0\x0dresource-mode\x03\0\x0e\x01o\x02s\x0b\x01p\x10\x01k\x0b\x01o\x02s\x12\
\x01p\x13\x01ps\x01p\x0b\x01o\x02\x12\x12\x01o\x02\x0d\x0f\x01q\x16\x0brecord-ty\
pe\x01\x11\0\x0cvariant-type\x01\x14\0\x09enum-type\x01\x15\0\x0aflags-type\x01\x15\
\0\x0atuple-type\x01\x16\0\x09list-type\x01\x0b\0\x0boption-type\x01\x0b\0\x0bre\
sult-type\x01\x17\0\x0cprim-u8-type\0\0\x0dprim-u16-type\0\0\x0dprim-u32-type\0\0\
\x0dprim-u64-type\0\0\x0cprim-s8-type\0\0\x0dprim-s16-type\0\0\x0dprim-s32-type\0\
\0\x0dprim-s64-type\0\0\x0dprim-f32-type\0\0\x0dprim-f64-type\0\0\x0eprim-char-t\
ype\0\0\x0eprim-bool-type\0\0\x10prim-string-type\0\0\x0bhandle-type\x01\x18\0\x04\
\0\x0dwit-type-node\x03\0\x19\x01ks\x01r\x03\x04name\x1b\x05owner\x1b\x04type\x1a\
\x04\0\x13named-wit-type-node\x03\0\x1c\x01p\x1d\x01r\x01\x05nodes\x1e\x04\0\x08\
wit-type\x03\0\x1f\x01r\x01\x05values\x04\0\x03uri\x03\0!\x01o\x02y\x12\x01p\x7f\
\x01j\x01\x12\x01\x12\x01o\x02\"w\x01q\x16\x0crecord-value\x01\x16\0\x0dvariant-\
value\x01#\0\x0aenum-value\x01y\0\x0bflags-value\x01$\0\x0btuple-value\x01\x16\0\
\x0alist-value\x01\x16\0\x0coption-value\x01\x12\0\x0cresult-value\x01%\0\x07pri\
m-u8\x01}\0\x08prim-u16\x01{\0\x08prim-u32\x01y\0\x08prim-u64\x01w\0\x07prim-s8\x01\
~\0\x08prim-s16\x01|\0\x08prim-s32\x01z\0\x08prim-s64\x01x\0\x0cprim-float32\x01\
v\0\x0cprim-float64\x01u\0\x09prim-char\x01t\0\x09prim-bool\x01\x7f\0\x0bprim-st\
ring\x01s\0\x06handle\x01&\0\x04\0\x08wit-node\x03\0'\x01p(\x01r\x01\x05nodes)\x04\
\0\x09wit-value\x03\0*\x01r\x02\x05value+\x03typ\x20\x04\0\x0evalue-and-type\x03\
\0,\x01q\x04\x0eprotocol-error\x01s\0\x06denied\x01s\0\x09not-found\x01s\0\x15re\
mote-internal-error\x01s\0\x04\0\x09rpc-error\x03\0.\x04\0\x08wasm-rpc\x03\x01\x04\
\0\x14future-invoke-result\x03\x01\x04\0\x12cancellation-token\x03\x01\x01i0\x01\
@\x01\x08agent-id\x09\03\x04\0\x15[constructor]wasm-rpc\x014\x01h0\x01p+\x01j\x01\
+\x01/\x01@\x03\x04self5\x0dfunction-names\x0ffunction-params6\07\x04\0![method]\
wasm-rpc.invoke-and-await\x018\x01j\0\x01/\x01@\x03\x04self5\x0dfunction-names\x0f\
function-params6\09\x04\0\x17[method]wasm-rpc.invoke\x01:\x01i1\x01@\x03\x04self\
5\x0dfunction-names\x0ffunction-params6\0;\x04\0'[method]wasm-rpc.async-invoke-a\
nd-await\x01<\x01@\x04\x04self5\x0escheduled-time\x01\x0dfunction-names\x0ffunct\
ion-params6\x01\0\x04\0$[method]wasm-rpc.schedule-invocation\x01=\x01i2\x01@\x04\
\x04self5\x0escheduled-time\x01\x0dfunction-names\x0ffunction-params6\0>\x04\0/[\
method]wasm-rpc.schedule-cancelable-invocation\x01?\x01h1\x01i\x03\x01@\x01\x04s\
elf\xc0\0\0\xc1\0\x04\0&[method]future-invoke-result.subscribe\x01B\x01k7\x01@\x01\
\x04self\xc0\0\0\xc3\0\x04\0\x20[method]future-invoke-result.get\x01D\x01h2\x01@\
\x01\x04self\xc5\0\x01\0\x04\0![method]cancellation-token.cancel\x01F\x01j\x01\x05\
\x01s\x01@\x01\x04uuids\0\xc7\0\x04\0\x0aparse-uuid\x01H\x01@\x01\x04uuid\x05\0s\
\x04\0\x0euuid-to-string\x01I\x03\0\x15golem:rpc/types@0.2.2\x05\x04\x04\0\x12go\
lem:rpc/wasm-rpc\x04\0\x0b\x0e\x01\0\x08wasm-rpc\x03\0\0\0G\x09producers\x01\x0c\
processed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\x060.41.0";
#[inline(never)]
#[doc(hidden)]
pub fn __link_custom_section_describing_imports() {
    wit_bindgen_rt::maybe_link_cabi_realloc();
}
