-
Notifications
You must be signed in to change notification settings - Fork 13.3k
/
Copy pathrepr.rs
76 lines (62 loc) · 1.23 KB
/
repr.rs
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
#![feature(repr_simd)]
#[repr(Rust)]
pub struct ReprRust;
#[repr(C, align(8))] // public
pub struct ReprC {
pub field: u8,
}
#[repr(C)] // private
pub struct ReprCPrivField {
private: u8,
pub public: i8,
}
#[repr(align(4))] // private
pub struct ReprAlignHiddenField {
#[doc(hidden)]
pub hidden: i16,
}
#[repr(simd, packed(2))] // public
pub struct ReprSimd {
pub field: u8,
}
#[repr(transparent)] // public
pub struct ReprTransparent {
pub field: u8, // non-1-ZST field
}
#[repr(isize)] // public
pub enum ReprIsize {
Bla,
}
#[repr(u8)] // public
pub enum ReprU8 {
Bla,
}
#[repr(u32)] // public
pub enum ReprU32 {
#[doc(hidden)]
Hidden,
Public,
}
#[repr(u64)] // private
pub enum ReprU64HiddenVariants {
#[doc(hidden)]
A,
#[doc(hidden)]
B,
}
#[repr(transparent)] // private
pub struct ReprTransparentPrivField {
field: u32, // non-1-ZST field
}
#[repr(transparent)] // public
pub struct ReprTransparentPriv1ZstFields {
marker0: Marker,
pub main: u64, // non-1-ZST field
marker1: Marker,
}
#[repr(transparent)] // private
pub struct ReprTransparentPrivFieldPub1ZstFields {
main: [u16; 0], // non-1-ZST field
pub marker: Marker,
}
pub struct Marker; // 1-ZST