#[derive(Debug, Clone)]
pub struct MemoryRegion {
pub base: usize,
pub size: usize,
pub protection: Protection,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Protection {
pub read: bool,
pub write: bool,
pub execute: bool,
}
impl std::fmt::Display for Protection {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}{}{}",
if self.read { "r" } else { "-" },
if self.write { "w" } else { "-" },
if self.execute { "x" } else { "-" },
)
}
}