1#[derive(Debug, Clone)]
3pub struct MemoryRegion {
4 pub base: usize,
6
7 pub size: usize,
9
10 pub protection: Protection,
12}
13
14#[derive(Debug, Clone, Copy, PartialEq, Eq)]
16pub struct Protection {
17 pub read: bool,
18 pub write: bool,
19 pub execute: bool,
20}
21
22impl std::fmt::Display for Protection {
23 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24 write!(
25 f,
26 "{}{}{}",
27 if self.read { "r" } else { "-" },
28 if self.write { "w" } else { "-" },
29 if self.execute { "x" } else { "-" },
30 )
31 }
32}