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
use crate::{
library::RootModule,
sabi_types::VersionStrings,
std_types::{ROption, RStr, RString},
StableAbi,
};
#[repr(C)]
#[derive(StableAbi)]
#[sabi(kind(Prefix(prefix_ref = "Module_Ref", prefix_fields = "Module_Prefix")))]
pub struct Module {
pub first: ROption<usize>,
#[sabi(last_prefix_field)]
pub second: RStr<'static>,
pub third: usize,
}
impl RootModule for Module_Ref {
crate::declare_root_module_statics! {Module_Ref}
const BASE_NAME: &'static str = "example_root_module";
const NAME: &'static str = "example_root_module";
const VERSION_STRINGS: VersionStrings = crate::package_version_strings!();
}
#[repr(C)]
#[derive(StableAbi)]
#[sabi(kind(Prefix(prefix_ref = "PhantModule_Ref", prefix_fields = "PhantModule_Prefix")))]
pub struct PhantModule<T: Copy> {
pub first: ROption<usize>,
#[sabi(last_prefix_field)]
pub second: RStr<'static>,
pub third: usize,
pub phantom: std::marker::PhantomData<T>,
}
#[repr(u8)]
#[derive(StableAbi, Debug, Clone, PartialEq)]
#[sabi(kind(WithNonExhaustive(size = "[usize;10]", traits(Debug, Clone, PartialEq),)))]
#[sabi(with_constructor)]
#[non_exhaustive]
pub enum ValidTag {
Foo,
Bar,
Tag { name: RString, tag: RString },
}