diff --git a/wasm-component-model-resource/calculator.rs b/wasm-component-model-resource/calculator.rs index 2d9bf75f..7684b748 100644 --- a/wasm-component-model-resource/calculator.rs +++ b/wasm-component-model-resource/calculator.rs @@ -1,9 +1,12 @@ -// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.24.0. DO NOT EDIT! // Options used: +#[allow(dead_code)] pub mod exports { + #[allow(dead_code)] pub mod vscode { + #[allow(dead_code)] pub mod example { - #[allow(clippy::all)] + #[allow(dead_code, clippy::all)] pub mod types { #[used] #[doc(hidden)] @@ -131,9 +134,15 @@ pub mod exports { } } + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _MachineRep); + } + fn as_ptr(&self) -> *mut _MachineRep { Machine::type_guard::(); - unsafe { T::_resource_rep(self.handle()).cast() } + T::_resource_rep(self.handle()).cast() } } @@ -192,12 +201,14 @@ pub mod exports { #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_constructor_machine_cabi(arg0: i32,arg1: i32,arg2: i32,) -> i32 {let result0 = Machine::new(T::new(arg0 as u32, arg1 as u32, Operation::_lift(arg2 as u8))); + pub unsafe fn _export_constructor_machine_cabi(arg0: i32,arg1: i32,arg2: i32,) -> i32 {#[cfg(target_arch="wasm32")] + _rt::run_ctors_once();let result0 = Machine::new(T::new(arg0 as u32, arg1 as u32, Operation::_lift(arg2 as u8))); (result0).take_handle() as i32 } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_machine_execute_cabi(arg0: i32,) -> i32 {let result0 = T::execute(MachineBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_machine_execute_cabi(arg0: *mut u8,) -> i32 {#[cfg(target_arch="wasm32")] + _rt::run_ctors_once();let result0 = T::execute(MachineBorrow::lift(arg0 as u32 as usize).get()); _rt::as_i32(result0) } pub trait Guest { @@ -210,7 +221,10 @@ pub mod exports { where Self: Sized { #[cfg(not(target_arch = "wasm32"))] - unreachable!(); + { + let _ = val; + unreachable!(); + } #[cfg(target_arch = "wasm32")] { @@ -228,7 +242,10 @@ pub mod exports { where Self: Sized { #[cfg(not(target_arch = "wasm32"))] - unreachable!(); + { + let _ = handle; + unreachable!(); + } #[cfg(target_arch = "wasm32")] { @@ -257,9 +274,21 @@ pub mod exports { $($path_to_types)*::_export_constructor_machine_cabi::<<$ty as $($path_to_types)*::Guest>::Machine>(arg0, arg1, arg2) } #[export_name = "vscode:example/types#[method]machine.execute"] - unsafe extern "C" fn export_method_machine_execute(arg0: i32,) -> i32 { + unsafe extern "C" fn export_method_machine_execute(arg0: *mut u8,) -> i32 { $($path_to_types)*::_export_method_machine_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Machine>(arg0) } + + const _: () = { + #[doc(hidden)] + #[export_name = "vscode:example/types#[dtor]machine"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::Machine::dtor::< + <$ty as $($path_to_types)*::Guest>::Machine + >(rep) + } + }; + };); } #[doc(hidden)] @@ -368,6 +397,11 @@ mod _rt { } pub use alloc_crate::boxed::Box; + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen::rt::run_ctors_once(); + } + pub fn as_i32(t: T) -> i32 { t.as_i32() } @@ -469,7 +503,7 @@ macro_rules! __export_calculator_impl { pub(crate) use __export_calculator_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.21.0:calculator:encoded world"] +#[link_section = "component-type:wit-bindgen:0.24.0:calculator:encoded world"] #[doc(hidden)] pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 338] = *b"\ \0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xd1\x01\x01A\x02\x01\ @@ -478,8 +512,8 @@ A\x02\x01B\x09\x01m\x04\x03add\x03sub\x03mul\x03div\x04\0\x09operation\x03\0\0\x \x04\0\x14[constructor]machine\x01\x04\x01h\x02\x01@\x01\x04self\x05\0y\x04\0\x17\ [method]machine.execute\x01\x06\x04\x01\x14vscode:example/types\x05\0\x04\x01\x19\ vscode:example/calculator\x04\0\x0b\x10\x01\0\x0acalculator\x03\0\0\0G\x09produc\ -ers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x060\ -.21.0"; +ers\x01\x0cprocessed-by\x02\x0dwit-component\x070.202.0\x10wit-bindgen-rust\x060\ +.24.0"; #[inline(never)] #[doc(hidden)] diff --git a/wasm-component-model-resource/src/lib.rs b/wasm-component-model-resource/src/lib.rs index 73836384..86cad762 100644 --- a/wasm-component-model-resource/src/lib.rs +++ b/wasm-component-model-resource/src/lib.rs @@ -1,9 +1,12 @@ -// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.24.0. DO NOT EDIT! // Options used: +#[allow(dead_code)] pub mod exports { + #[allow(dead_code)] pub mod vscode { + #[allow(dead_code)] pub mod example { - #[allow(clippy::all)] + #[allow(dead_code, clippy::all)] pub mod types { #[used] #[doc(hidden)] @@ -131,9 +134,15 @@ pub mod exports { } } + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _MachineRep); + } + fn as_ptr(&self) -> *mut _MachineRep { Machine::type_guard::(); - unsafe { T::_resource_rep(self.handle()).cast() } + T::_resource_rep(self.handle()).cast() } } @@ -192,12 +201,14 @@ pub mod exports { #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_constructor_machine_cabi(arg0: i32,arg1: i32,arg2: i32,) -> i32 {let result0 = Machine::new(T::new(arg0 as u32, arg1 as u32, Operation::_lift(arg2 as u8))); + pub unsafe fn _export_constructor_machine_cabi(arg0: i32,arg1: i32,arg2: i32,) -> i32 {#[cfg(target_arch="wasm32")] + _rt::run_ctors_once();let result0 = Machine::new(T::new(arg0 as u32, arg1 as u32, Operation::_lift(arg2 as u8))); (result0).take_handle() as i32 } #[doc(hidden)] #[allow(non_snake_case)] - pub unsafe fn _export_method_machine_execute_cabi(arg0: i32,) -> i32 {let result0 = T::execute(MachineBorrow::lift(arg0 as u32 as usize).get()); + pub unsafe fn _export_method_machine_execute_cabi(arg0: *mut u8,) -> i32 {#[cfg(target_arch="wasm32")] + _rt::run_ctors_once();let result0 = T::execute(MachineBorrow::lift(arg0 as u32 as usize).get()); _rt::as_i32(result0) } pub trait Guest { @@ -210,7 +221,10 @@ pub mod exports { where Self: Sized { #[cfg(not(target_arch = "wasm32"))] - unreachable!(); + { + let _ = val; + unreachable!(); + } #[cfg(target_arch = "wasm32")] { @@ -228,7 +242,10 @@ pub mod exports { where Self: Sized { #[cfg(not(target_arch = "wasm32"))] - unreachable!(); + { + let _ = handle; + unreachable!(); + } #[cfg(target_arch = "wasm32")] { @@ -257,9 +274,21 @@ pub mod exports { $($path_to_types)*::_export_constructor_machine_cabi::<<$ty as $($path_to_types)*::Guest>::Machine>(arg0, arg1, arg2) } #[export_name = "vscode:example/types#[method]machine.execute"] - unsafe extern "C" fn export_method_machine_execute(arg0: i32,) -> i32 { + unsafe extern "C" fn export_method_machine_execute(arg0: *mut u8,) -> i32 { $($path_to_types)*::_export_method_machine_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Machine>(arg0) } + + const _: () = { + #[doc(hidden)] + #[export_name = "vscode:example/types#[dtor]machine"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::Machine::dtor::< + <$ty as $($path_to_types)*::Guest>::Machine + >(rep) + } + }; + };); } #[doc(hidden)] @@ -368,6 +397,11 @@ mod _rt { } pub use alloc_crate::boxed::Box; + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen::rt::run_ctors_once(); + } + pub fn as_i32(t: T) -> i32 { t.as_i32() } @@ -466,13 +500,6 @@ impl GuestMachine for CalcMachine { } } -impl Drop for CalcMachine { - fn drop(&mut self) { - self.left = 0; - self.right = 0; - } -} - struct Implementation; impl Guest for Implementation { type Machine = CalcMachine; @@ -493,7 +520,7 @@ macro_rules! __export_calculator_impl { pub(crate) use __export_calculator_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.21.0:calculator:encoded world"] +#[link_section = "component-type:wit-bindgen:0.24.0:calculator:encoded world"] #[doc(hidden)] pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 338] = *b"\ \0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xd1\x01\x01A\x02\x01\ @@ -502,12 +529,13 @@ A\x02\x01B\x09\x01m\x04\x03add\x03sub\x03mul\x03div\x04\0\x09operation\x03\0\0\x \x04\0\x14[constructor]machine\x01\x04\x01h\x02\x01@\x01\x04self\x05\0y\x04\0\x17\ [method]machine.execute\x01\x06\x04\x01\x14vscode:example/types\x05\0\x04\x01\x19\ vscode:example/calculator\x04\0\x0b\x10\x01\0\x0acalculator\x03\0\0\0G\x09produc\ -ers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x060\ -.21.0"; +ers\x01\x0cprocessed-by\x02\x0dwit-component\x070.202.0\x10wit-bindgen-rust\x060\ +.24.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] pub fn __link_custom_section_describing_imports() { wit_bindgen::rt::maybe_link_cabi_realloc(); -} \ No newline at end of file +} +