1- // Generated by `wit-bindgen` 0.41 .0. DO NOT EDIT!
1+ // Generated by `wit-bindgen` 0.25 .0. DO NOT EDIT!
22// Options used:
3- // * runtime_path: "wit_bindgen_rt"
4- #[ rustfmt:: skip]
5- #[ allow( dead_code, clippy:: all) ]
3+ #[ allow( dead_code) ]
64pub mod docs {
5+ #[ allow( dead_code) ]
76 pub mod adder {
8- #[ allow( dead_code, async_fn_in_trait , unused_imports , clippy:: all) ]
7+ #[ allow( dead_code, clippy:: all) ]
98 pub mod add {
109 #[ used]
1110 #[ doc( hidden) ]
12- static __FORCE_SECTION_REF: fn ( ) = super :: super :: super :: __link_custom_section_describing_imports;
11+ #[ cfg( target_arch = "wasm32" ) ]
12+ static __FORCE_SECTION_REF: fn ( ) =
13+ super :: super :: super :: __link_custom_section_describing_imports;
1314 use super :: super :: super :: _rt;
1415 #[ allow( unused_unsafe, clippy:: all) ]
1516 pub fn add ( x : u32 , y : u32 ) -> u32 {
1617 unsafe {
1718 #[ cfg( target_arch = "wasm32" ) ]
1819 #[ link( wasm_import_module = "docs:adder/[email protected] " ) ] 19- unsafe extern "C" {
20+ extern "C" {
2021 #[ link_name = "add" ]
21- fn wit_import0 ( _: i32 , _: i32 ) -> i32 ;
22+ fn wit_import ( _: i32 , _: i32 ) -> i32 ;
2223 }
24+
2325 #[ cfg( not( target_arch = "wasm32" ) ) ]
24- unsafe extern "C" fn wit_import0 ( _: i32 , _: i32 ) -> i32 {
26+ fn wit_import ( _: i32 , _: i32 ) -> i32 {
2527 unreachable ! ( )
2628 }
27- let ret = unsafe { wit_import0 ( _rt:: as_i32 ( & x ) , _rt:: as_i32 ( & y ) ) } ;
29+ let ret = wit_import ( _rt:: as_i32 ( & a ) , _rt:: as_i32 ( & b ) ) ;
2830 ret as u32
2931 }
3032 }
3133 }
3234 }
3335}
34- #[ rustfmt:: skip]
35- #[ allow( dead_code, clippy:: all) ]
36+ #[ allow( dead_code) ]
3637pub mod exports {
38+ #[ allow( dead_code) ]
3739 pub mod docs {
40+ #[ allow( dead_code) ]
3841 pub mod calculator {
39- #[ allow( dead_code, async_fn_in_trait , unused_imports , clippy:: all) ]
42+ #[ allow( dead_code, clippy:: all) ]
4043 pub mod calculate {
4144 #[ used]
4245 #[ doc( hidden) ]
43- static __FORCE_SECTION_REF: fn ( ) = super :: super :: super :: super :: __link_custom_section_describing_imports;
46+ #[ cfg( target_arch = "wasm32" ) ]
47+ static __FORCE_SECTION_REF: fn ( ) =
48+ super :: super :: super :: super :: __link_custom_section_describing_imports;
4449 use super :: super :: super :: super :: _rt;
4550 #[ repr( u8 ) ]
46- #[ derive( Clone , Copy , Eq , Ord , PartialEq , PartialOrd ) ]
51+ #[ derive( Clone , Copy , Eq , PartialEq ) ]
4752 pub enum Op {
4853 Add ,
4954 }
5055 impl :: core:: fmt:: Debug for Op {
51- fn fmt (
52- & self ,
53- f : & mut :: core:: fmt:: Formatter < ' _ > ,
54- ) -> :: core:: fmt:: Result {
56+ fn fmt ( & self , f : & mut :: core:: fmt:: Formatter < ' _ > ) -> :: core:: fmt:: Result {
5557 match self {
5658 Op :: Add => f. debug_tuple ( "Op::Add" ) . finish ( ) ,
5759 }
5860 }
5961 }
62+
6063 impl Op {
6164 #[ doc( hidden) ]
6265 pub unsafe fn _lift ( val : u8 ) -> Op {
6366 if !cfg ! ( debug_assertions) {
6467 return :: core:: mem:: transmute ( val) ;
6568 }
69+
6670 match val {
6771 0 => Op :: Add ,
72+
6873 _ => panic ! ( "invalid enum discriminant" ) ,
6974 }
7075 }
7176 }
77+
7278 #[ doc( hidden) ]
7379 #[ allow( non_snake_case) ]
7480 pub unsafe fn _export_eval_expression_cabi < T : Guest > (
7581 arg0 : i32 ,
7682 arg1 : i32 ,
7783 arg2 : i32 ,
7884 ) -> i32 {
79- #[ cfg( target_arch = "wasm32" ) ] _rt:: run_ctors_once ( ) ;
80- let result0 = T :: eval_expression (
81- Op :: _lift ( arg0 as u8 ) ,
82- arg1 as u32 ,
83- arg2 as u32 ,
84- ) ;
85+ #[ cfg( target_arch = "wasm32" ) ]
86+ _rt:: run_ctors_once ( ) ;
87+ let result0 =
88+ T :: eval_expression ( Op :: _lift ( arg0 as u8 ) , arg1 as u32 , arg2 as u32 ) ;
8589 _rt:: as_i32 ( result0)
8690 }
8791 pub trait Guest {
8892 fn eval_expression ( op : Op , x : u32 , y : u32 ) -> u32 ;
8993 }
9094 #[ doc( hidden) ]
91- macro_rules! __export_docs_calculator_calculate_0_1_0_cabi {
92- ( $ty: ident with_types_in $( $path_to_types: tt) * ) => {
93- const _ : ( ) = { #[ unsafe ( export_name =
94- "docs:calculator/[email protected] #eval-expression" ) ] unsafe extern
95- "C" fn export_eval_expression( arg0 : i32 , arg1 : i32 , arg2 :
96- i32 , ) -> i32 { unsafe { $( $path_to_types) * ::
97- _export_eval_expression_cabi:: <$ty > ( arg0, arg1, arg2) } } } ;
98- } ;
99- }
95+
96+ macro_rules! __export_docs_calculator_calculate_0_1_0_cabi{
97+ ( $ty: ident with_types_in $( $path_to_types: tt) * ) => ( const _: ( ) = {
98+
99+ #
[ export_name =
"docs:calculator/[email protected] #eval-expression" ] 100+ unsafe extern "C" fn export_eval_expression( arg0: i32 , arg1: i32 , arg2: i32 , ) -> i32 {
101+ $( $path_to_types) * :: _export_eval_expression_cabi:: <$ty>( arg0, arg1, arg2)
102+ }
103+ } ; ) ;
104+ }
100105 #[ doc( hidden) ]
101106 pub ( crate ) use __export_docs_calculator_calculate_0_1_0_cabi;
102107 }
103108 }
104109 }
105110}
106- #[ rustfmt:: skip]
107111mod _rt {
108- #! [ allow ( dead_code , clippy :: all ) ]
112+
109113 pub fn as_i32 < T : AsI32 > ( t : T ) -> i32 {
110114 t. as_i32 ( )
111115 }
116+
112117 pub trait AsI32 {
113118 fn as_i32 ( self ) -> i32 ;
114119 }
120+
115121 impl < ' a , T : Copy + AsI32 > AsI32 for & ' a T {
116122 fn as_i32 ( self ) -> i32 {
117123 ( * self ) . as_i32 ( )
118124 }
119125 }
126+
120127 impl AsI32 for i32 {
121128 #[ inline]
122129 fn as_i32 ( self ) -> i32 {
123130 self as i32
124131 }
125132 }
133+
126134 impl AsI32 for u32 {
127135 #[ inline]
128136 fn as_i32 ( self ) -> i32 {
129137 self as i32
130138 }
131139 }
140+
132141 impl AsI32 for i16 {
133142 #[ inline]
134143 fn as_i32 ( self ) -> i32 {
135144 self as i32
136145 }
137146 }
147+
138148 impl AsI32 for u16 {
139149 #[ inline]
140150 fn as_i32 ( self ) -> i32 {
141151 self as i32
142152 }
143153 }
154+
144155 impl AsI32 for i8 {
145156 #[ inline]
146157 fn as_i32 ( self ) -> i32 {
147158 self as i32
148159 }
149160 }
161+
150162 impl AsI32 for u8 {
151163 #[ inline]
152164 fn as_i32 ( self ) -> i32 {
153165 self as i32
154166 }
155167 }
168+
156169 impl AsI32 for char {
157170 #[ inline]
158171 fn as_i32 ( self ) -> i32 {
159172 self as i32
160173 }
161174 }
175+
162176 impl AsI32 for usize {
163177 #[ inline]
164178 fn as_i32 ( self ) -> i32 {
165179 self as i32
166180 }
167181 }
182+
168183 #[ cfg( target_arch = "wasm32" ) ]
169184 pub fn run_ctors_once ( ) {
170185 wit_bindgen_rt:: run_ctors_once ( ) ;
171186 }
172187}
173- /// Generates `#[unsafe(no_mangle)]` functions to export the specified type as
174- /// the root implementation of all generated traits.
188+
189+ /// Generates `#[no_mangle]` functions to export the specified type as the
190+ /// root implementation of all generated traits.
175191///
176192/// For more information see the documentation of `wit_bindgen::generate!`.
177193///
@@ -188,34 +204,31 @@ mod _rt {
188204/// ```
189205#[ allow( unused_macros) ]
190206#[ doc( hidden) ]
207+
191208macro_rules! __export_calculator_impl {
192- ( $ty: ident) => {
193- self :: export!( $ty with_types_in self ) ;
194- } ;
195- ( $ty: ident with_types_in $( $path_to_types_root: tt) * ) => {
196- $( $path_to_types_root) * ::
197- exports:: docs:: calculator:: calculate:: __export_docs_calculator_calculate_0_1_0_cabi!( $ty
198- with_types_in $( $path_to_types_root) * :: exports:: docs:: calculator:: calculate) ;
199- } ;
209+ ( $ty: ident) => ( self :: export!( $ty with_types_in self ) ; ) ;
210+ ( $ty: ident with_types_in $( $path_to_types_root: tt) * ) => (
211+ $( $path_to_types_root) * :: exports:: docs:: calculator:: calculate:: __export_docs_calculator_calculate_0_1_0_cabi!( $ty with_types_in $( $path_to_types_root) * :: exports:: docs:: calculator:: calculate) ;
212+ )
200213}
201214#[ doc( inline) ]
202215pub ( crate ) use __export_calculator_impl as export;
216+
203217#[ cfg( target_arch = "wasm32" ) ]
204- #[ unsafe(
205- link_section = "component-type:wit-bindgen:0.41.0:docs:[email protected] :calculator:encoded world" 206- ) ]
218+ #[ link_section = "component-type:wit-bindgen:0.25.0:calculator:encoded world" ]
207219#[ doc( hidden) ]
208- #[ allow( clippy:: octal_escapes) ]
209220pub static __WIT_BINDGEN_COMPONENT_TYPE: [ u8 ; 308 ] = * b"\
210221\0 asm\x0d \0 \x01 \0 \0 \x19 \x16 wit-component-encoding\x04 \0 \x07 \xb3 \x01 \x01 A\x02 \x01 \
211- A\x04 \x01 B\x02 \x01 @\x02 \x01 xy\x01 yy\0 y\x04 \0 \x03 add\x01 \0 \x03 \0 \x14 docs:adder/ad\
212- [email protected] \x05 \0 \x01 B\x04 \x01 m\x01 \x03 add\x04 \0 \x02 op\x03 \0 \0 \x01 @\x03 \x02 op\x01 \x01 \ 213- xy\x01 yy\0 y\x04 \0 \x0f eval-expression\x01 \x02 \x04 \0 \x1f docs:calculator/calculate@\
214- 0.1.0\x05 \x01 \x04 \0 \x20 docs:calculator/[email protected] \x04 \0 \x0b \x10 \x01 \0 \x0a c\ 215- alculator\x03 \0 \0 \0 G\x09 producers\x01 \x0c processed-by\x02 \x0d wit-component\x07 0.\
216- 227.1\x10 wit-bindgen-rust\x06 0.41.0";
222+ A\x04 \x01 B\x02 \x01 @\x02 \x01 ay\x01 by\0 y\x04 \0 \x03 add\x01 \0 \x03 \x01 \x14 docs:adder/\
223+ [email protected] \x05 \0 \x01 B\x04 \x01 m\x01 \x03 add\x04 \0 \x02 op\x03 \0 \0 \x01 @\x03 \x02 op\x01 \x01 \ 224+ xy\x01 yy\0 y\x04 \0 \x0f eval-expression\x01 \x02 \x04 \x01 \x1f docs:calculator/calculat\
225+ [email protected] \x05 \x01 \x04 \x01 \x20 docs:calculator/[email protected] \x04 \0 \x0b \x10 \x01 \0 \x0a \ 226+ calculator\x03 \0 \0 \0 G\x09 producers\x01 \x0c processed-by\x02 \x0d wit-component\x07 0\
227+ .208.1\x10 wit-bindgen-rust\x06 0.25.0";
228+
217229#[ inline( never) ]
218230#[ doc( hidden) ]
231+ #[ cfg( target_arch = "wasm32" ) ]
219232pub fn __link_custom_section_describing_imports ( ) {
220233 wit_bindgen_rt:: maybe_link_cabi_realloc ( ) ;
221234}
0 commit comments