1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
use crateFFIResult;
use CheckedBitPattern;
use NoUninit;
// Types used in the return position must implement `Default` when calling the
// generated safe methods, as they are created on the module side before passing
// a mutable pointer to them for the host to actually fill in.
//
// Note that you'll still need to derive `NoUninit` and `CheckedBitPattern` manually
// on structs. The reason for this is that you may also want to derive `Pod` and `Zeroable`
// instead, and there's currently no way of figuring out which to derive automatically.
// The ark_bindgen macro automatically synthesizes proper FFI bindings from
// more idiomatic Rust function signatures.
// The module name, in this case `example` is the "namespace" for the FFI
// functions. This name will be used to prefix each function in the
// `extern "C"` block that **must** be inside the module.
/// Due to some limitations on how attribute macro currently work, our proc
/// macro needs to be placed on an inner module. This means that other code
/// using us has to have an unnecessary level of indirection to use the types/
/// functions in that module, so instead we just re-export everything so they
/// only need to access the single top level module to get everything
pub use *;