use super::*;
#[derive(Eq, PartialEq, Hash)]
pub struct Mapping {
pub memory_start: u64,
pub memory_limit: u64,
pub file_offset: u64,
pub filename: StringId,
pub build_id: StringId,
}
impl Item for Mapping {
type Id = MappingId;
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord)]
#[repr(C)]
pub struct MappingId(NonZeroU32);
impl Id for MappingId {
type RawId = u64;
fn from_offset(offset: usize) -> Self {
#[allow(clippy::expect_used)]
Self(small_non_zero_pprof_id(offset).expect("MappingId to fit into a u32"))
}
fn to_raw_id(&self) -> Self::RawId {
self.0.get().into()
}
}