1- // Generated by `wit-bindgen` 0.25 .0. DO NOT EDIT!
1+ // Generated by `wit-bindgen` 0.41 .0. DO NOT EDIT!
22// Options used:
3- #[ allow( dead_code) ]
3+ // * runtime_path: "wit_bindgen_rt"
4+ #[ rustfmt:: skip]
5+ #[ allow( dead_code, clippy:: all) ]
46pub mod docs {
5- #[ allow( dead_code) ]
67 pub mod adder {
7- #[ allow( dead_code, clippy:: all) ]
8+ #[ allow( dead_code, async_fn_in_trait , unused_imports , clippy:: all) ]
89 pub mod add {
910 #[ used]
1011 #[ doc( hidden) ]
11- #[ cfg( target_arch = "wasm32" ) ]
12- static __FORCE_SECTION_REF: fn ( ) =
13- super :: super :: super :: __link_custom_section_describing_imports;
12+ static __FORCE_SECTION_REF: fn ( ) = super :: super :: super :: __link_custom_section_describing_imports;
1413 use super :: super :: super :: _rt;
1514 #[ allow( unused_unsafe, clippy:: all) ]
1615 pub fn add ( x : u32 , y : u32 ) -> u32 {
1716 unsafe {
1817 #[ cfg( target_arch = "wasm32" ) ]
1918 #[ link( wasm_import_module = "docs:adder/[email protected] " ) ] 20- extern "C" {
19+ unsafe extern "C" {
2120 #[ link_name = "add" ]
22- fn wit_import ( _: i32 , _: i32 ) -> i32 ;
21+ fn wit_import0 ( _: i32 , _: i32 ) -> i32 ;
2322 }
24-
2523 #[ cfg( not( target_arch = "wasm32" ) ) ]
26- fn wit_import ( _: i32 , _: i32 ) -> i32 {
24+ unsafe extern "C" fn wit_import0 ( _: i32 , _: i32 ) -> i32 {
2725 unreachable ! ( )
2826 }
29- let ret = wit_import ( _rt:: as_i32 ( & a ) , _rt:: as_i32 ( & b ) ) ;
27+ let ret = unsafe { wit_import0 ( _rt:: as_i32 ( & x ) , _rt:: as_i32 ( & y ) ) } ;
3028 ret as u32
3129 }
3230 }
3331 }
3432 }
3533}
36- #[ allow( dead_code) ]
34+ #[ rustfmt:: skip]
35+ #[ allow( dead_code, clippy:: all) ]
3736pub mod exports {
38- #[ allow( dead_code) ]
3937 pub mod docs {
40- #[ allow( dead_code) ]
4138 pub mod calculator {
42- #[ allow( dead_code, clippy:: all) ]
39+ #[ allow( dead_code, async_fn_in_trait , unused_imports , clippy:: all) ]
4340 pub mod calculate {
4441 #[ used]
4542 #[ doc( hidden) ]
46- #[ cfg( target_arch = "wasm32" ) ]
47- static __FORCE_SECTION_REF: fn ( ) =
48- super :: super :: super :: super :: __link_custom_section_describing_imports;
43+ static __FORCE_SECTION_REF: fn ( ) = super :: super :: super :: super :: __link_custom_section_describing_imports;
4944 use super :: super :: super :: super :: _rt;
5045 #[ repr( u8 ) ]
51- #[ derive( Clone , Copy , Eq , PartialEq ) ]
46+ #[ derive( Clone , Copy , Eq , Ord , PartialEq , PartialOrd ) ]
5247 pub enum Op {
5348 Add ,
5449 }
5550 impl :: core:: fmt:: Debug for Op {
56- fn fmt ( & self , f : & mut :: core:: fmt:: Formatter < ' _ > ) -> :: core:: fmt:: Result {
51+ fn fmt (
52+ & self ,
53+ f : & mut :: core:: fmt:: Formatter < ' _ > ,
54+ ) -> :: core:: fmt:: Result {
5755 match self {
5856 Op :: Add => f. debug_tuple ( "Op::Add" ) . finish ( ) ,
5957 }
6058 }
6159 }
62-
6360 impl Op {
6461 #[ doc( hidden) ]
6562 pub unsafe fn _lift ( val : u8 ) -> Op {
6663 if !cfg ! ( debug_assertions) {
6764 return :: core:: mem:: transmute ( val) ;
6865 }
69-
7066 match val {
7167 0 => Op :: Add ,
72-
7368 _ => panic ! ( "invalid enum discriminant" ) ,
7469 }
7570 }
7671 }
77-
7872 #[ doc( hidden) ]
7973 #[ allow( non_snake_case) ]
8074 pub unsafe fn _export_eval_expression_cabi < T : Guest > (
8175 arg0 : i32 ,
8276 arg1 : i32 ,
8377 arg2 : i32 ,
8478 ) -> i32 {
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 ) ;
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+ ) ;
8985 _rt:: as_i32 ( result0)
9086 }
9187 pub trait Guest {
9288 fn eval_expression ( op : Op , x : u32 , y : u32 ) -> u32 ;
9389 }
9490 #[ doc( hidden) ]
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- }
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+ }
105100 #[ doc( hidden) ]
106101 pub ( crate ) use __export_docs_calculator_calculate_0_1_0_cabi;
107102 }
108103 }
109104 }
110105}
106+ #[ rustfmt:: skip]
111107mod _rt {
112-
108+ #! [ allow ( dead_code , clippy :: all ) ]
113109 pub fn as_i32 < T : AsI32 > ( t : T ) -> i32 {
114110 t. as_i32 ( )
115111 }
116-
117112 pub trait AsI32 {
118113 fn as_i32 ( self ) -> i32 ;
119114 }
120-
121115 impl < ' a , T : Copy + AsI32 > AsI32 for & ' a T {
122116 fn as_i32 ( self ) -> i32 {
123117 ( * self ) . as_i32 ( )
124118 }
125119 }
126-
127120 impl AsI32 for i32 {
128121 #[ inline]
129122 fn as_i32 ( self ) -> i32 {
130123 self as i32
131124 }
132125 }
133-
134126 impl AsI32 for u32 {
135127 #[ inline]
136128 fn as_i32 ( self ) -> i32 {
137129 self as i32
138130 }
139131 }
140-
141132 impl AsI32 for i16 {
142133 #[ inline]
143134 fn as_i32 ( self ) -> i32 {
144135 self as i32
145136 }
146137 }
147-
148138 impl AsI32 for u16 {
149139 #[ inline]
150140 fn as_i32 ( self ) -> i32 {
151141 self as i32
152142 }
153143 }
154-
155144 impl AsI32 for i8 {
156145 #[ inline]
157146 fn as_i32 ( self ) -> i32 {
158147 self as i32
159148 }
160149 }
161-
162150 impl AsI32 for u8 {
163151 #[ inline]
164152 fn as_i32 ( self ) -> i32 {
165153 self as i32
166154 }
167155 }
168-
169156 impl AsI32 for char {
170157 #[ inline]
171158 fn as_i32 ( self ) -> i32 {
172159 self as i32
173160 }
174161 }
175-
176162 impl AsI32 for usize {
177163 #[ inline]
178164 fn as_i32 ( self ) -> i32 {
179165 self as i32
180166 }
181167 }
182-
183168 #[ cfg( target_arch = "wasm32" ) ]
184169 pub fn run_ctors_once ( ) {
185170 wit_bindgen_rt:: run_ctors_once ( ) ;
186171 }
187172}
188-
189- /// Generates `#[no_mangle]` functions to export the specified type as the
190- /// root implementation of all generated traits.
173+ /// Generates `#[unsafe(no_mangle)]` functions to export the specified type as
174+ /// the root implementation of all generated traits.
191175///
192176/// For more information see the documentation of `wit_bindgen::generate!`.
193177///
@@ -204,31 +188,34 @@ mod _rt {
204188/// ```
205189#[ allow( unused_macros) ]
206190#[ doc( hidden) ]
207-
208191macro_rules! __export_calculator_impl {
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- )
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+ } ;
213200}
214201#[ doc( inline) ]
215202pub ( crate ) use __export_calculator_impl as export;
216-
217203#[ cfg( target_arch = "wasm32" ) ]
218- #[ link_section = "component-type:wit-bindgen:0.25.0:calculator:encoded world" ]
204+ #[ unsafe(
205+ link_section = "component-type:wit-bindgen:0.41.0:docs:[email protected] :calculator:encoded world" 206+ ) ]
219207#[ doc( hidden) ]
208+ #[ allow( clippy:: octal_escapes) ]
220209pub static __WIT_BINDGEN_COMPONENT_TYPE: [ u8 ; 308 ] = * b"\
221210\0 asm\x0d \0 \x01 \0 \0 \x19 \x16 wit-component-encoding\x04 \0 \x07 \xb3 \x01 \x01 A\x02 \x01 \
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-
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";
229217#[ inline( never) ]
230218#[ doc( hidden) ]
231- #[ cfg( target_arch = "wasm32" ) ]
232219pub fn __link_custom_section_describing_imports ( ) {
233220 wit_bindgen_rt:: maybe_link_cabi_realloc ( ) ;
234221}
0 commit comments