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