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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*! Descriptions of integer types
This module describes the integer types used to hold bare data. This module
governs the way the processor manipulates integer regions of memory, without
concern for interaction with specifics of register or bus behavior.
!*/
use mem;
use IsUnsigned;
/** Description of an integer type.
This trait provides information used to describe integer-typed regions of memory
and enables other parts of the crate to adequately describe the memory bus. This
trait has **no** bearing on the processor instructions or registers used to
interact with memory.
This trait cannot be implemented outside this crate.
**/
memory!;
/** Computes the number of elements required to store some number of bits.
# Parameters
- `bits`: The number of bits to store in a `[T]` array.
# Returns
The number of elements `T` required to store `bits`.
As this is a const function, when `bits` is a constant expression, this can be
used to compute the size of an array type `[T; elts(bits)]`.
**/
pub const
/** Tests that a type is aligned to its size.
This property is not necessarily true for all integers; for instance, `u64` on
32-bit x86 is permitted to be 4-byte-aligned. `bitvec` requires this property to
hold for the pointer representation to correctly function.
# Type Parameters
- `T`: A type whose alignment and size are to be compared
# Returns
`0` if the alignment matches the size; `1` if they differ
**/
pub const
/** Tests whether two types have compatible layouts.
# Type Parameters
- `A`
- `B`
# Returns
Zero if `A` and `B` have equal alignments and sizes, non-zero if they do not.
# Uses
This function is designed to be used in the expression
`const CHECK: [(): 0] = [(); cmp_layout::<A, B>()];`. It will cause a compiler
error if the conditions do not hold.
**/
pub const