1
- // Generated by `wit-bindgen` 0.41 .0. DO NOT EDIT!
1
+ // Generated by `wit-bindgen` 0.25 .0. DO NOT EDIT!
2
2
// Options used:
3
- // * runtime_path: "wit_bindgen_rt"
4
- #[ rustfmt:: skip]
5
- #[ allow( dead_code, clippy:: all) ]
3
+ #[ allow( dead_code) ]
6
4
pub mod docs {
5
+ #[ allow( dead_code) ]
7
6
pub mod adder {
8
- #[ allow( dead_code, async_fn_in_trait , unused_imports , clippy:: all) ]
7
+ #[ allow( dead_code, clippy:: all) ]
9
8
pub mod add {
10
9
#[ used]
11
10
#[ 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;
13
14
use super :: super :: super :: _rt;
14
15
#[ allow( unused_unsafe, clippy:: all) ]
15
16
pub fn add ( x : u32 , y : u32 ) -> u32 {
16
17
unsafe {
17
18
#[ cfg( target_arch = "wasm32" ) ]
18
19
#[ link( wasm_import_module = "docs:adder/add@0.1.0" ) ]
19
- unsafe extern "C" {
20
+ extern "C" {
20
21
#[ link_name = "add" ]
21
- fn wit_import0 ( _: i32 , _: i32 ) -> i32 ;
22
+ fn wit_import ( _: i32 , _: i32 ) -> i32 ;
22
23
}
24
+
23
25
#[ cfg( not( target_arch = "wasm32" ) ) ]
24
- unsafe extern "C" fn wit_import0 ( _: i32 , _: i32 ) -> i32 {
26
+ fn wit_import ( _: i32 , _: i32 ) -> i32 {
25
27
unreachable ! ( )
26
28
}
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 ) ) ;
28
30
ret as u32
29
31
}
30
32
}
31
33
}
32
34
}
33
35
}
34
- #[ rustfmt:: skip]
35
- #[ allow( dead_code, clippy:: all) ]
36
+ #[ allow( dead_code) ]
36
37
pub mod exports {
38
+ #[ allow( dead_code) ]
37
39
pub mod docs {
40
+ #[ allow( dead_code) ]
38
41
pub mod calculator {
39
- #[ allow( dead_code, async_fn_in_trait , unused_imports , clippy:: all) ]
42
+ #[ allow( dead_code, clippy:: all) ]
40
43
pub mod calculate {
41
44
#[ used]
42
45
#[ 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;
44
49
use super :: super :: super :: super :: _rt;
45
50
#[ repr( u8 ) ]
46
- #[ derive( Clone , Copy , Eq , Ord , PartialEq , PartialOrd ) ]
51
+ #[ derive( Clone , Copy , Eq , PartialEq ) ]
47
52
pub enum Op {
48
53
Add ,
49
54
}
50
55
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 {
55
57
match self {
56
58
Op :: Add => f. debug_tuple ( "Op::Add" ) . finish ( ) ,
57
59
}
58
60
}
59
61
}
62
+
60
63
impl Op {
61
64
#[ doc( hidden) ]
62
65
pub unsafe fn _lift ( val : u8 ) -> Op {
63
66
if !cfg ! ( debug_assertions) {
64
67
return :: core:: mem:: transmute ( val) ;
65
68
}
69
+
66
70
match val {
67
71
0 => Op :: Add ,
72
+
68
73
_ => panic ! ( "invalid enum discriminant" ) ,
69
74
}
70
75
}
71
76
}
77
+
72
78
#[ doc( hidden) ]
73
79
#[ allow( non_snake_case) ]
74
80
pub unsafe fn _export_eval_expression_cabi < T : Guest > (
75
81
arg0 : i32 ,
76
82
arg1 : i32 ,
77
83
arg2 : i32 ,
78
84
) -> 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 ) ;
85
89
_rt:: as_i32 ( result0)
86
90
}
87
91
pub trait Guest {
88
92
fn eval_expression ( op : Op , x : u32 , y : u32 ) -> u32 ;
89
93
}
90
94
#[ 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/calculate@0.1.0#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/calculate@0.1.0#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
+ }
100
105
#[ doc( hidden) ]
101
106
pub ( crate ) use __export_docs_calculator_calculate_0_1_0_cabi;
102
107
}
103
108
}
104
109
}
105
110
}
106
- #[ rustfmt:: skip]
107
111
mod _rt {
108
- #! [ allow ( dead_code , clippy :: all ) ]
112
+
109
113
pub fn as_i32 < T : AsI32 > ( t : T ) -> i32 {
110
114
t. as_i32 ( )
111
115
}
116
+
112
117
pub trait AsI32 {
113
118
fn as_i32 ( self ) -> i32 ;
114
119
}
120
+
115
121
impl < ' a , T : Copy + AsI32 > AsI32 for & ' a T {
116
122
fn as_i32 ( self ) -> i32 {
117
123
( * self ) . as_i32 ( )
118
124
}
119
125
}
126
+
120
127
impl AsI32 for i32 {
121
128
#[ inline]
122
129
fn as_i32 ( self ) -> i32 {
123
130
self as i32
124
131
}
125
132
}
133
+
126
134
impl AsI32 for u32 {
127
135
#[ inline]
128
136
fn as_i32 ( self ) -> i32 {
129
137
self as i32
130
138
}
131
139
}
140
+
132
141
impl AsI32 for i16 {
133
142
#[ inline]
134
143
fn as_i32 ( self ) -> i32 {
135
144
self as i32
136
145
}
137
146
}
147
+
138
148
impl AsI32 for u16 {
139
149
#[ inline]
140
150
fn as_i32 ( self ) -> i32 {
141
151
self as i32
142
152
}
143
153
}
154
+
144
155
impl AsI32 for i8 {
145
156
#[ inline]
146
157
fn as_i32 ( self ) -> i32 {
147
158
self as i32
148
159
}
149
160
}
161
+
150
162
impl AsI32 for u8 {
151
163
#[ inline]
152
164
fn as_i32 ( self ) -> i32 {
153
165
self as i32
154
166
}
155
167
}
168
+
156
169
impl AsI32 for char {
157
170
#[ inline]
158
171
fn as_i32 ( self ) -> i32 {
159
172
self as i32
160
173
}
161
174
}
175
+
162
176
impl AsI32 for usize {
163
177
#[ inline]
164
178
fn as_i32 ( self ) -> i32 {
165
179
self as i32
166
180
}
167
181
}
182
+
168
183
#[ cfg( target_arch = "wasm32" ) ]
169
184
pub fn run_ctors_once ( ) {
170
185
wit_bindgen_rt:: run_ctors_once ( ) ;
171
186
}
172
187
}
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.
175
191
///
176
192
/// For more information see the documentation of `wit_bindgen::generate!`.
177
193
///
@@ -188,34 +204,31 @@ mod _rt {
188
204
/// ```
189
205
#[ allow( unused_macros) ]
190
206
#[ doc( hidden) ]
207
+
191
208
macro_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
+ )
200
213
}
201
214
#[ doc( inline) ]
202
215
pub ( crate ) use __export_calculator_impl as export;
216
+
203
217
#[ cfg( target_arch = "wasm32" ) ]
204
- #[ unsafe(
205
- link_section = "component-type:wit-bindgen:0.41.0:docs:calculator@0.1.0:calculator:encoded world"
206
- ) ]
218
+ #[ link_section = "component-type:wit-bindgen:0.25.0:calculator:encoded world" ]
207
219
#[ doc( hidden) ]
208
- #[ allow( clippy:: octal_escapes) ]
209
220
pub static __WIT_BINDGEN_COMPONENT_TYPE: [ u8 ; 308 ] = * b"\
210
221
\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
- d@0.1.0\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/calculator@0.1.0\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
+ add@0.1.0\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
+ e@0.1.0\x05 \x01 \x04 \x01 \x20 docs:calculator/calculator@0.1.0\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
+
217
229
#[ inline( never) ]
218
230
#[ doc( hidden) ]
231
+ #[ cfg( target_arch = "wasm32" ) ]
219
232
pub fn __link_custom_section_describing_imports ( ) {
220
233
wit_bindgen_rt:: maybe_link_cabi_realloc ( ) ;
221
234
}
0 commit comments