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
#![no_std]
#![forbid(clippy::expect_used, clippy::panic)]
#![deny(
rust_2018_idioms,
unused_lifetimes,
unused_qualifications,
clippy::all,
missing_docs
)]
#[cfg(feature = "alloc")]
extern crate alloc;
mod address;
mod offset;
mod page;
mod pages;
mod register;
pub use address::Address;
pub use offset::Offset;
pub use page::Page;
pub use pages::Pages;
pub use register::Register;
pub trait Zero: Copy {
const ZERO: Self;
}
pub trait One: Copy {
const ONE: Self;
}
macro_rules! impltraits {
($($num:ty)+) => {
$(
impl Zero for $num {
const ZERO: Self = 0;
}
impl One for $num {
const ONE: Self = 1;
}
)+
};
}
impltraits! {
u8 u16 u32 u64 u128 usize
i8 i16 i32 i64 i128 isize
}