1 | #![allow (clippy::too_many_arguments)] |
2 | |
3 | mod napi1 { |
4 | use super::super::types::*; |
5 | use std::os::raw::{c_char, c_void}; |
6 | |
7 | generate!( |
8 | extern "C" { |
9 | fn napi_get_last_error_info( |
10 | env: napi_env, |
11 | result: *mut *const napi_extended_error_info, |
12 | ) -> napi_status; |
13 | |
14 | fn napi_get_undefined(env: napi_env, result: *mut napi_value) -> napi_status; |
15 | fn napi_get_null(env: napi_env, result: *mut napi_value) -> napi_status; |
16 | fn napi_get_global(env: napi_env, result: *mut napi_value) -> napi_status; |
17 | fn napi_get_boolean(env: napi_env, value: bool, result: *mut napi_value) -> napi_status; |
18 | fn napi_create_object(env: napi_env, result: *mut napi_value) -> napi_status; |
19 | fn napi_create_array(env: napi_env, result: *mut napi_value) -> napi_status; |
20 | fn napi_create_array_with_length( |
21 | env: napi_env, |
22 | length: usize, |
23 | result: *mut napi_value, |
24 | ) -> napi_status; |
25 | fn napi_create_double(env: napi_env, value: f64, result: *mut napi_value) -> napi_status; |
26 | fn napi_create_int32(env: napi_env, value: i32, result: *mut napi_value) -> napi_status; |
27 | fn napi_create_uint32(env: napi_env, value: u32, result: *mut napi_value) -> napi_status; |
28 | fn napi_create_int64(env: napi_env, value: i64, result: *mut napi_value) -> napi_status; |
29 | fn napi_create_string_latin1( |
30 | env: napi_env, |
31 | str_: *const c_char, |
32 | length: usize, |
33 | result: *mut napi_value, |
34 | ) -> napi_status; |
35 | fn napi_create_string_utf8( |
36 | env: napi_env, |
37 | str_: *const c_char, |
38 | length: usize, |
39 | result: *mut napi_value, |
40 | ) -> napi_status; |
41 | fn napi_create_string_utf16( |
42 | env: napi_env, |
43 | str_: *const u16, |
44 | length: usize, |
45 | result: *mut napi_value, |
46 | ) -> napi_status; |
47 | fn napi_create_symbol( |
48 | env: napi_env, |
49 | description: napi_value, |
50 | result: *mut napi_value, |
51 | ) -> napi_status; |
52 | fn napi_create_function( |
53 | env: napi_env, |
54 | utf8name: *const c_char, |
55 | length: usize, |
56 | cb: napi_callback, |
57 | data: *mut c_void, |
58 | result: *mut napi_value, |
59 | ) -> napi_status; |
60 | fn napi_create_error( |
61 | env: napi_env, |
62 | code: napi_value, |
63 | msg: napi_value, |
64 | result: *mut napi_value, |
65 | ) -> napi_status; |
66 | fn napi_create_type_error( |
67 | env: napi_env, |
68 | code: napi_value, |
69 | msg: napi_value, |
70 | result: *mut napi_value, |
71 | ) -> napi_status; |
72 | fn napi_create_range_error( |
73 | env: napi_env, |
74 | code: napi_value, |
75 | msg: napi_value, |
76 | result: *mut napi_value, |
77 | ) -> napi_status; |
78 | fn napi_typeof(env: napi_env, value: napi_value, result: *mut napi_valuetype) -> napi_status; |
79 | fn napi_get_value_double(env: napi_env, value: napi_value, result: *mut f64) -> napi_status; |
80 | fn napi_get_value_int32(env: napi_env, value: napi_value, result: *mut i32) -> napi_status; |
81 | fn napi_get_value_uint32(env: napi_env, value: napi_value, result: *mut u32) -> napi_status; |
82 | fn napi_get_value_int64(env: napi_env, value: napi_value, result: *mut i64) -> napi_status; |
83 | fn napi_get_value_bool(env: napi_env, value: napi_value, result: *mut bool) -> napi_status; |
84 | fn napi_get_value_string_latin1( |
85 | env: napi_env, |
86 | value: napi_value, |
87 | buf: *mut c_char, |
88 | bufsize: usize, |
89 | result: *mut usize, |
90 | ) -> napi_status; |
91 | fn napi_get_value_string_utf8( |
92 | env: napi_env, |
93 | value: napi_value, |
94 | buf: *mut c_char, |
95 | bufsize: usize, |
96 | result: *mut usize, |
97 | ) -> napi_status; |
98 | fn napi_get_value_string_utf16( |
99 | env: napi_env, |
100 | value: napi_value, |
101 | buf: *mut u16, |
102 | bufsize: usize, |
103 | result: *mut usize, |
104 | ) -> napi_status; |
105 | fn napi_coerce_to_bool( |
106 | env: napi_env, |
107 | value: napi_value, |
108 | result: *mut napi_value, |
109 | ) -> napi_status; |
110 | fn napi_coerce_to_number( |
111 | env: napi_env, |
112 | value: napi_value, |
113 | result: *mut napi_value, |
114 | ) -> napi_status; |
115 | fn napi_coerce_to_object( |
116 | env: napi_env, |
117 | value: napi_value, |
118 | result: *mut napi_value, |
119 | ) -> napi_status; |
120 | fn napi_coerce_to_string( |
121 | env: napi_env, |
122 | value: napi_value, |
123 | result: *mut napi_value, |
124 | ) -> napi_status; |
125 | fn napi_get_prototype( |
126 | env: napi_env, |
127 | object: napi_value, |
128 | result: *mut napi_value, |
129 | ) -> napi_status; |
130 | fn napi_get_property_names( |
131 | env: napi_env, |
132 | object: napi_value, |
133 | result: *mut napi_value, |
134 | ) -> napi_status; |
135 | fn napi_set_property( |
136 | env: napi_env, |
137 | object: napi_value, |
138 | key: napi_value, |
139 | value: napi_value, |
140 | ) -> napi_status; |
141 | fn napi_has_property( |
142 | env: napi_env, |
143 | object: napi_value, |
144 | key: napi_value, |
145 | result: *mut bool, |
146 | ) -> napi_status; |
147 | fn napi_get_property( |
148 | env: napi_env, |
149 | object: napi_value, |
150 | key: napi_value, |
151 | result: *mut napi_value, |
152 | ) -> napi_status; |
153 | fn napi_delete_property( |
154 | env: napi_env, |
155 | object: napi_value, |
156 | key: napi_value, |
157 | result: *mut bool, |
158 | ) -> napi_status; |
159 | fn napi_has_own_property( |
160 | env: napi_env, |
161 | object: napi_value, |
162 | key: napi_value, |
163 | result: *mut bool, |
164 | ) -> napi_status; |
165 | fn napi_set_named_property( |
166 | env: napi_env, |
167 | object: napi_value, |
168 | utf8name: *const c_char, |
169 | value: napi_value, |
170 | ) -> napi_status; |
171 | fn napi_has_named_property( |
172 | env: napi_env, |
173 | object: napi_value, |
174 | utf8name: *const c_char, |
175 | result: *mut bool, |
176 | ) -> napi_status; |
177 | fn napi_get_named_property( |
178 | env: napi_env, |
179 | object: napi_value, |
180 | utf8name: *const c_char, |
181 | result: *mut napi_value, |
182 | ) -> napi_status; |
183 | fn napi_set_element( |
184 | env: napi_env, |
185 | object: napi_value, |
186 | index: u32, |
187 | value: napi_value, |
188 | ) -> napi_status; |
189 | fn napi_has_element( |
190 | env: napi_env, |
191 | object: napi_value, |
192 | index: u32, |
193 | result: *mut bool, |
194 | ) -> napi_status; |
195 | fn napi_get_element( |
196 | env: napi_env, |
197 | object: napi_value, |
198 | index: u32, |
199 | result: *mut napi_value, |
200 | ) -> napi_status; |
201 | fn napi_delete_element( |
202 | env: napi_env, |
203 | object: napi_value, |
204 | index: u32, |
205 | result: *mut bool, |
206 | ) -> napi_status; |
207 | fn napi_define_properties( |
208 | env: napi_env, |
209 | object: napi_value, |
210 | property_count: usize, |
211 | properties: *const napi_property_descriptor, |
212 | ) -> napi_status; |
213 | fn napi_is_array(env: napi_env, value: napi_value, result: *mut bool) -> napi_status; |
214 | fn napi_get_array_length(env: napi_env, value: napi_value, result: *mut u32) -> napi_status; |
215 | fn napi_strict_equals( |
216 | env: napi_env, |
217 | lhs: napi_value, |
218 | rhs: napi_value, |
219 | result: *mut bool, |
220 | ) -> napi_status; |
221 | fn napi_call_function( |
222 | env: napi_env, |
223 | recv: napi_value, |
224 | func: napi_value, |
225 | argc: usize, |
226 | argv: *const napi_value, |
227 | result: *mut napi_value, |
228 | ) -> napi_status; |
229 | fn napi_new_instance( |
230 | env: napi_env, |
231 | constructor: napi_value, |
232 | argc: usize, |
233 | argv: *const napi_value, |
234 | result: *mut napi_value, |
235 | ) -> napi_status; |
236 | fn napi_instanceof( |
237 | env: napi_env, |
238 | object: napi_value, |
239 | constructor: napi_value, |
240 | result: *mut bool, |
241 | ) -> napi_status; |
242 | fn napi_get_cb_info( |
243 | env: napi_env, |
244 | cbinfo: napi_callback_info, |
245 | argc: *mut usize, |
246 | argv: *mut napi_value, |
247 | this_arg: *mut napi_value, |
248 | data: *mut *mut c_void, |
249 | ) -> napi_status; |
250 | fn napi_get_new_target( |
251 | env: napi_env, |
252 | cbinfo: napi_callback_info, |
253 | result: *mut napi_value, |
254 | ) -> napi_status; |
255 | fn napi_define_class( |
256 | env: napi_env, |
257 | utf8name: *const c_char, |
258 | length: usize, |
259 | constructor: napi_callback, |
260 | data: *mut c_void, |
261 | property_count: usize, |
262 | properties: *const napi_property_descriptor, |
263 | result: *mut napi_value, |
264 | ) -> napi_status; |
265 | fn napi_wrap( |
266 | env: napi_env, |
267 | js_object: napi_value, |
268 | native_object: *mut c_void, |
269 | finalize_cb: napi_finalize, |
270 | finalize_hint: *mut c_void, |
271 | result: *mut napi_ref, |
272 | ) -> napi_status; |
273 | fn napi_unwrap(env: napi_env, js_object: napi_value, result: *mut *mut c_void) |
274 | -> napi_status; |
275 | fn napi_remove_wrap( |
276 | env: napi_env, |
277 | js_object: napi_value, |
278 | result: *mut *mut c_void, |
279 | ) -> napi_status; |
280 | fn napi_create_external( |
281 | env: napi_env, |
282 | data: *mut c_void, |
283 | finalize_cb: napi_finalize, |
284 | finalize_hint: *mut c_void, |
285 | result: *mut napi_value, |
286 | ) -> napi_status; |
287 | fn napi_get_value_external( |
288 | env: napi_env, |
289 | value: napi_value, |
290 | result: *mut *mut c_void, |
291 | ) -> napi_status; |
292 | fn napi_create_reference( |
293 | env: napi_env, |
294 | value: napi_value, |
295 | initial_refcount: u32, |
296 | result: *mut napi_ref, |
297 | ) -> napi_status; |
298 | fn napi_delete_reference(env: napi_env, ref_: napi_ref) -> napi_status; |
299 | fn napi_reference_ref(env: napi_env, ref_: napi_ref, result: *mut u32) -> napi_status; |
300 | fn napi_reference_unref(env: napi_env, ref_: napi_ref, result: *mut u32) -> napi_status; |
301 | fn napi_get_reference_value( |
302 | env: napi_env, |
303 | ref_: napi_ref, |
304 | result: *mut napi_value, |
305 | ) -> napi_status; |
306 | fn napi_open_handle_scope(env: napi_env, result: *mut napi_handle_scope) -> napi_status; |
307 | fn napi_close_handle_scope(env: napi_env, scope: napi_handle_scope) -> napi_status; |
308 | fn napi_open_escapable_handle_scope( |
309 | env: napi_env, |
310 | result: *mut napi_escapable_handle_scope, |
311 | ) -> napi_status; |
312 | fn napi_close_escapable_handle_scope( |
313 | env: napi_env, |
314 | scope: napi_escapable_handle_scope, |
315 | ) -> napi_status; |
316 | fn napi_escape_handle( |
317 | env: napi_env, |
318 | scope: napi_escapable_handle_scope, |
319 | escapee: napi_value, |
320 | result: *mut napi_value, |
321 | ) -> napi_status; |
322 | fn napi_throw(env: napi_env, error: napi_value) -> napi_status; |
323 | fn napi_throw_error(env: napi_env, code: *const c_char, msg: *const c_char) -> napi_status; |
324 | fn napi_throw_type_error( |
325 | env: napi_env, |
326 | code: *const c_char, |
327 | msg: *const c_char, |
328 | ) -> napi_status; |
329 | fn napi_throw_range_error( |
330 | env: napi_env, |
331 | code: *const c_char, |
332 | msg: *const c_char, |
333 | ) -> napi_status; |
334 | fn napi_is_error(env: napi_env, value: napi_value, result: *mut bool) -> napi_status; |
335 | fn napi_is_exception_pending(env: napi_env, result: *mut bool) -> napi_status; |
336 | fn napi_get_and_clear_last_exception(env: napi_env, result: *mut napi_value) -> napi_status; |
337 | fn napi_is_arraybuffer(env: napi_env, value: napi_value, result: *mut bool) -> napi_status; |
338 | fn napi_create_arraybuffer( |
339 | env: napi_env, |
340 | byte_length: usize, |
341 | data: *mut *mut c_void, |
342 | result: *mut napi_value, |
343 | ) -> napi_status; |
344 | fn napi_create_external_arraybuffer( |
345 | env: napi_env, |
346 | external_data: *mut c_void, |
347 | byte_length: usize, |
348 | finalize_cb: napi_finalize, |
349 | finalize_hint: *mut c_void, |
350 | result: *mut napi_value, |
351 | ) -> napi_status; |
352 | fn napi_get_arraybuffer_info( |
353 | env: napi_env, |
354 | arraybuffer: napi_value, |
355 | data: *mut *mut c_void, |
356 | byte_length: *mut usize, |
357 | ) -> napi_status; |
358 | fn napi_is_typedarray(env: napi_env, value: napi_value, result: *mut bool) -> napi_status; |
359 | fn napi_create_typedarray( |
360 | env: napi_env, |
361 | type_: napi_typedarray_type, |
362 | length: usize, |
363 | arraybuffer: napi_value, |
364 | byte_offset: usize, |
365 | result: *mut napi_value, |
366 | ) -> napi_status; |
367 | fn napi_get_typedarray_info( |
368 | env: napi_env, |
369 | typedarray: napi_value, |
370 | type_: *mut napi_typedarray_type, |
371 | length: *mut usize, |
372 | data: *mut *mut c_void, |
373 | arraybuffer: *mut napi_value, |
374 | byte_offset: *mut usize, |
375 | ) -> napi_status; |
376 | fn napi_create_dataview( |
377 | env: napi_env, |
378 | length: usize, |
379 | arraybuffer: napi_value, |
380 | byte_offset: usize, |
381 | result: *mut napi_value, |
382 | ) -> napi_status; |
383 | fn napi_is_dataview(env: napi_env, value: napi_value, result: *mut bool) -> napi_status; |
384 | fn napi_get_dataview_info( |
385 | env: napi_env, |
386 | dataview: napi_value, |
387 | bytelength: *mut usize, |
388 | data: *mut *mut c_void, |
389 | arraybuffer: *mut napi_value, |
390 | byte_offset: *mut usize, |
391 | ) -> napi_status; |
392 | fn napi_get_version(env: napi_env, result: *mut u32) -> napi_status; |
393 | fn napi_create_promise( |
394 | env: napi_env, |
395 | deferred: *mut napi_deferred, |
396 | promise: *mut napi_value, |
397 | ) -> napi_status; |
398 | fn napi_resolve_deferred( |
399 | env: napi_env, |
400 | deferred: napi_deferred, |
401 | resolution: napi_value, |
402 | ) -> napi_status; |
403 | fn napi_reject_deferred( |
404 | env: napi_env, |
405 | deferred: napi_deferred, |
406 | rejection: napi_value, |
407 | ) -> napi_status; |
408 | fn napi_is_promise(env: napi_env, value: napi_value, is_promise: *mut bool) -> napi_status; |
409 | fn napi_run_script(env: napi_env, script: napi_value, result: *mut napi_value) |
410 | -> napi_status; |
411 | fn napi_adjust_external_memory( |
412 | env: napi_env, |
413 | change_in_bytes: i64, |
414 | adjusted_value: *mut i64, |
415 | ) -> napi_status; |
416 | fn napi_module_register(mod_: *mut napi_module); |
417 | fn napi_fatal_error( |
418 | location: *const c_char, |
419 | location_len: usize, |
420 | message: *const c_char, |
421 | message_len: usize, |
422 | ); |
423 | fn napi_async_init( |
424 | env: napi_env, |
425 | async_resource: napi_value, |
426 | async_resource_name: napi_value, |
427 | result: *mut napi_async_context, |
428 | ) -> napi_status; |
429 | fn napi_async_destroy(env: napi_env, async_context: napi_async_context) -> napi_status; |
430 | fn napi_make_callback( |
431 | env: napi_env, |
432 | async_context: napi_async_context, |
433 | recv: napi_value, |
434 | func: napi_value, |
435 | argc: usize, |
436 | argv: *const napi_value, |
437 | result: *mut napi_value, |
438 | ) -> napi_status; |
439 | fn napi_create_buffer( |
440 | env: napi_env, |
441 | length: usize, |
442 | data: *mut *mut c_void, |
443 | result: *mut napi_value, |
444 | ) -> napi_status; |
445 | fn napi_create_external_buffer( |
446 | env: napi_env, |
447 | length: usize, |
448 | data: *mut c_void, |
449 | finalize_cb: napi_finalize, |
450 | finalize_hint: *mut c_void, |
451 | result: *mut napi_value, |
452 | ) -> napi_status; |
453 | fn napi_create_buffer_copy( |
454 | env: napi_env, |
455 | length: usize, |
456 | data: *const c_void, |
457 | result_data: *mut *mut c_void, |
458 | result: *mut napi_value, |
459 | ) -> napi_status; |
460 | fn napi_is_buffer(env: napi_env, value: napi_value, result: *mut bool) -> napi_status; |
461 | fn napi_get_buffer_info( |
462 | env: napi_env, |
463 | value: napi_value, |
464 | data: *mut *mut c_void, |
465 | length: *mut usize, |
466 | ) -> napi_status; |
467 | fn napi_create_async_work( |
468 | env: napi_env, |
469 | async_resource: napi_value, |
470 | async_resource_name: napi_value, |
471 | execute: napi_async_execute_callback, |
472 | complete: napi_async_complete_callback, |
473 | data: *mut c_void, |
474 | result: *mut napi_async_work, |
475 | ) -> napi_status; |
476 | fn napi_delete_async_work(env: napi_env, work: napi_async_work) -> napi_status; |
477 | fn napi_queue_async_work(env: napi_env, work: napi_async_work) -> napi_status; |
478 | fn napi_cancel_async_work(env: napi_env, work: napi_async_work) -> napi_status; |
479 | fn napi_get_node_version( |
480 | env: napi_env, |
481 | version: *mut *const napi_node_version, |
482 | ) -> napi_status; |
483 | } |
484 | ); |
485 | } |
486 | |
487 | #[cfg (feature = "napi2" )] |
488 | mod napi2 { |
489 | use super::super::types::*; |
490 | use std::os::raw::c_int; |
491 | |
492 | generate!( |
493 | extern "C" { |
494 | fn napi_get_uv_event_loop(env: napi_env, loop_: *mut *mut uv_loop_s) -> napi_status; |
495 | |
496 | fn uv_run(loop_: *mut uv_loop_s, mode: uv_run_mode) -> c_int; |
497 | } |
498 | ); |
499 | } |
500 | |
501 | #[cfg (feature = "napi3" )] |
502 | mod napi3 { |
503 | use std::os::raw::c_void; |
504 | |
505 | use super::super::types::*; |
506 | |
507 | generate!( |
508 | extern "C" { |
509 | fn napi_fatal_exception(env: napi_env, err: napi_value) -> napi_status; |
510 | fn napi_add_env_cleanup_hook( |
511 | env: napi_env, |
512 | fun: Option<unsafe extern "C" fn(arg: *mut c_void)>, |
513 | arg: *mut c_void, |
514 | ) -> napi_status; |
515 | fn napi_remove_env_cleanup_hook( |
516 | env: napi_env, |
517 | fun: Option<unsafe extern "C" fn(arg: *mut c_void)>, |
518 | arg: *mut c_void, |
519 | ) -> napi_status; |
520 | fn napi_open_callback_scope( |
521 | env: napi_env, |
522 | resource_object: napi_value, |
523 | context: napi_async_context, |
524 | result: *mut napi_callback_scope, |
525 | ) -> napi_status; |
526 | fn napi_close_callback_scope(env: napi_env, scope: napi_callback_scope) -> napi_status; |
527 | } |
528 | ); |
529 | } |
530 | |
531 | #[cfg (feature = "napi4" )] |
532 | mod napi4 { |
533 | use super::super::types::*; |
534 | use std::os::raw::c_void; |
535 | |
536 | generate!( |
537 | extern "C" { |
538 | fn napi_create_threadsafe_function( |
539 | env: napi_env, |
540 | func: napi_value, |
541 | async_resource: napi_value, |
542 | async_resource_name: napi_value, |
543 | max_queue_size: usize, |
544 | initial_thread_count: usize, |
545 | thread_finalize_data: *mut c_void, |
546 | thread_finalize_cb: napi_finalize, |
547 | context: *mut c_void, |
548 | call_js_cb: napi_threadsafe_function_call_js, |
549 | result: *mut napi_threadsafe_function, |
550 | ) -> napi_status; |
551 | fn napi_get_threadsafe_function_context( |
552 | func: napi_threadsafe_function, |
553 | result: *mut *mut c_void, |
554 | ) -> napi_status; |
555 | fn napi_call_threadsafe_function( |
556 | func: napi_threadsafe_function, |
557 | data: *mut c_void, |
558 | is_blocking: napi_threadsafe_function_call_mode, |
559 | ) -> napi_status; |
560 | fn napi_acquire_threadsafe_function(func: napi_threadsafe_function) -> napi_status; |
561 | fn napi_release_threadsafe_function( |
562 | func: napi_threadsafe_function, |
563 | mode: napi_threadsafe_function_release_mode, |
564 | ) -> napi_status; |
565 | fn napi_unref_threadsafe_function( |
566 | env: napi_env, |
567 | func: napi_threadsafe_function, |
568 | ) -> napi_status; |
569 | fn napi_ref_threadsafe_function(env: napi_env, func: napi_threadsafe_function) |
570 | -> napi_status; |
571 | } |
572 | ); |
573 | } |
574 | |
575 | #[cfg (feature = "napi5" )] |
576 | mod napi5 { |
577 | use super::super::types::*; |
578 | use std::ffi::c_void; |
579 | |
580 | generate!( |
581 | extern "C" { |
582 | fn napi_create_date(env: napi_env, time: f64, result: *mut napi_value) -> napi_status; |
583 | fn napi_is_date(env: napi_env, value: napi_value, is_date: *mut bool) -> napi_status; |
584 | fn napi_get_date_value(env: napi_env, value: napi_value, result: *mut f64) -> napi_status; |
585 | fn napi_add_finalizer( |
586 | env: napi_env, |
587 | js_object: napi_value, |
588 | native_object: *mut c_void, |
589 | finalize_cb: napi_finalize, |
590 | finalize_hint: *mut c_void, |
591 | result: *mut napi_ref, |
592 | ) -> napi_status; |
593 | } |
594 | ); |
595 | } |
596 | |
597 | #[cfg (feature = "napi6" )] |
598 | mod napi6 { |
599 | use super::super::types::*; |
600 | use std::os::raw::{c_int, c_void}; |
601 | |
602 | generate!( |
603 | extern "C" { |
604 | fn napi_create_bigint_int64( |
605 | env: napi_env, |
606 | value: i64, |
607 | result: *mut napi_value, |
608 | ) -> napi_status; |
609 | fn napi_create_bigint_uint64( |
610 | env: napi_env, |
611 | value: u64, |
612 | result: *mut napi_value, |
613 | ) -> napi_status; |
614 | fn napi_create_bigint_words( |
615 | env: napi_env, |
616 | sign_bit: c_int, |
617 | word_count: usize, |
618 | words: *const u64, |
619 | result: *mut napi_value, |
620 | ) -> napi_status; |
621 | fn napi_get_value_bigint_int64( |
622 | env: napi_env, |
623 | value: napi_value, |
624 | result: *mut i64, |
625 | lossless: *mut bool, |
626 | ) -> napi_status; |
627 | fn napi_get_value_bigint_uint64( |
628 | env: napi_env, |
629 | value: napi_value, |
630 | result: *mut u64, |
631 | lossless: *mut bool, |
632 | ) -> napi_status; |
633 | fn napi_get_value_bigint_words( |
634 | env: napi_env, |
635 | value: napi_value, |
636 | sign_bit: *mut c_int, |
637 | word_count: *mut usize, |
638 | words: *mut u64, |
639 | ) -> napi_status; |
640 | fn napi_get_all_property_names( |
641 | env: napi_env, |
642 | object: napi_value, |
643 | key_mode: napi_key_collection_mode, |
644 | key_filter: napi_key_filter, |
645 | key_conversion: napi_key_conversion, |
646 | result: *mut napi_value, |
647 | ) -> napi_status; |
648 | fn napi_set_instance_data( |
649 | env: napi_env, |
650 | data: *mut c_void, |
651 | finalize_cb: napi_finalize, |
652 | finalize_hint: *mut c_void, |
653 | ) -> napi_status; |
654 | fn napi_get_instance_data(env: napi_env, data: *mut *mut c_void) -> napi_status; |
655 | } |
656 | ); |
657 | } |
658 | |
659 | #[cfg (feature = "napi7" )] |
660 | mod napi7 { |
661 | use super::super::types::*; |
662 | |
663 | generate!( |
664 | extern "C" { |
665 | fn napi_detach_arraybuffer(env: napi_env, arraybuffer: napi_value) -> napi_status; |
666 | fn napi_is_detached_arraybuffer( |
667 | env: napi_env, |
668 | value: napi_value, |
669 | result: *mut bool, |
670 | ) -> napi_status; |
671 | } |
672 | ); |
673 | } |
674 | |
675 | #[cfg (feature = "napi8" )] |
676 | mod napi8 { |
677 | use std::os::raw::c_void; |
678 | |
679 | use super::super::types::*; |
680 | |
681 | generate!( |
682 | extern "C" { |
683 | fn napi_add_async_cleanup_hook( |
684 | env: napi_env, |
685 | hook: napi_async_cleanup_hook, |
686 | arg: *mut c_void, |
687 | remove_handle: *mut napi_async_cleanup_hook_handle, |
688 | ) -> napi_status; |
689 | |
690 | fn napi_remove_async_cleanup_hook( |
691 | remove_handle: napi_async_cleanup_hook_handle, |
692 | ) -> napi_status; |
693 | |
694 | fn napi_object_freeze(env: napi_env, object: napi_value) -> napi_status; |
695 | |
696 | fn napi_object_seal(env: napi_env, object: napi_value) -> napi_status; |
697 | } |
698 | ); |
699 | } |
700 | |
701 | #[cfg (feature = "napi9" )] |
702 | mod napi9 { |
703 | use std::os::raw::c_char; |
704 | |
705 | use super::super::types::*; |
706 | |
707 | generate!( |
708 | extern "C" { |
709 | fn node_api_symbol_for( |
710 | env: napi_env, |
711 | utf8name: *const c_char, |
712 | length: usize, |
713 | result: *mut napi_value, |
714 | ) -> napi_status; |
715 | fn node_api_get_module_file_name(env: napi_env, result: *mut *const c_char) -> napi_status; |
716 | fn node_api_create_syntax_error( |
717 | env: napi_env, |
718 | code: napi_value, |
719 | msg: napi_value, |
720 | result: *mut napi_value, |
721 | ) -> napi_status; |
722 | fn node_api_throw_syntax_error( |
723 | env: napi_env, |
724 | code: *const c_char, |
725 | msg: *const c_char, |
726 | ) -> napi_status; |
727 | } |
728 | ); |
729 | } |
730 | |
731 | #[cfg (feature = "experimental" )] |
732 | mod experimental { |
733 | use std::os::raw::{c_char, c_void}; |
734 | |
735 | use super::super::types::*; |
736 | |
737 | generate!( |
738 | extern "C" { |
739 | fn node_api_create_external_string_latin1( |
740 | env: napi_env, |
741 | str_: *const c_char, |
742 | length: usize, |
743 | napi_finalize: napi_finalize, |
744 | finalize_hint: *mut c_void, |
745 | result: *mut napi_value, |
746 | copied: *mut bool, |
747 | ) -> napi_status; |
748 | |
749 | fn node_api_create_external_string_utf16( |
750 | env: napi_env, |
751 | str_: *const u16, |
752 | length: usize, |
753 | napi_finalize: napi_finalize, |
754 | finalize_hint: *mut c_void, |
755 | result: *mut napi_value, |
756 | copied: *mut bool, |
757 | ) -> napi_status; |
758 | } |
759 | ); |
760 | } |
761 | |
762 | #[cfg (feature = "experimental" )] |
763 | pub use experimental::*; |
764 | |
765 | pub use napi1::*; |
766 | #[cfg (feature = "napi2" )] |
767 | pub use napi2::*; |
768 | #[cfg (feature = "napi3" )] |
769 | pub use napi3::*; |
770 | #[cfg (feature = "napi4" )] |
771 | pub use napi4::*; |
772 | #[cfg (feature = "napi5" )] |
773 | pub use napi5::*; |
774 | #[cfg (feature = "napi6" )] |
775 | pub use napi6::*; |
776 | #[cfg (feature = "napi7" )] |
777 | pub use napi7::*; |
778 | #[cfg (feature = "napi8" )] |
779 | pub use napi8::*; |
780 | #[cfg (feature = "napi9" )] |
781 | pub use napi9::*; |
782 | |
783 | #[cfg (windows)] |
784 | pub(super) unsafe fn load_all() -> Result<libloading::Library, libloading::Error> { |
785 | let host = match libloading::os::windows::Library::this() { |
786 | Ok(lib) => lib.into(), |
787 | Err(err) => { |
788 | eprintln!("Initialize libloading failed {}" , err); |
789 | return Err(err); |
790 | } |
791 | }; |
792 | |
793 | napi1::load(&host)?; |
794 | #[cfg (feature = "napi2" )] |
795 | napi2::load(&host)?; |
796 | #[cfg (feature = "napi3" )] |
797 | napi3::load(&host)?; |
798 | #[cfg (feature = "napi4" )] |
799 | napi4::load(&host)?; |
800 | #[cfg (feature = "napi5" )] |
801 | napi5::load(&host)?; |
802 | #[cfg (feature = "napi6" )] |
803 | napi6::load(&host)?; |
804 | #[cfg (feature = "napi7" )] |
805 | napi7::load(&host)?; |
806 | #[cfg (feature = "napi8" )] |
807 | napi8::load(&host)?; |
808 | #[cfg (feature = "napi9" )] |
809 | napi9::load(&host)?; |
810 | #[cfg (feature = "experimental" )] |
811 | experimental::load(&host)?; |
812 | Ok(host) |
813 | } |
814 | |