commonlibsse_ng\rel\id/
mod.rs1mod id_database;
2mod offset_to_id;
3mod relocation_id;
4mod variant_id;
5
6use std::num::NonZeroUsize;
7
8pub use self::id_database::{DataBaseError, IDDatabase};
9pub use self::offset_to_id::OffsetToID;
10pub use self::relocation_id::RelocationID;
11pub use self::variant_id::VariantID;
12
13use self::id_database::ID_DATABASE;
14use super::ResolvableAddress;
15
16#[repr(C)]
20#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
21pub struct Mapping {
22 pub id: u64,
24 pub offset: u64,
26}
27
28#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
30pub enum Format {
31 SSEv1,
32 SSEv2,
33 VR,
34}
35
36#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
50#[repr(transparent)]
51pub struct ID(u64);
52
53impl ID {
54 #[inline]
56 pub const fn new(id: u64) -> Self {
57 Self(id)
58 }
59}
60
61impl ResolvableAddress for ID {
62 #[inline]
67 fn offset(&self) -> Result<NonZeroUsize, DataBaseError> {
68 ID_DATABASE.id_to_offset(self.0)
69 }
70}