68 lines
1.3 KiB
Rust
68 lines
1.3 KiB
Rust
use std::fmt::{Display, Formatter, LowerHex};
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, Ord, PartialOrd, Eq, PartialEq)]
|
|
pub struct ObjectId(u32);
|
|
|
|
impl ObjectId {
|
|
pub const NONE: Self = ObjectId(0);
|
|
|
|
pub fn from_raw(raw: u32) -> Self {
|
|
Self(raw)
|
|
}
|
|
|
|
pub fn raw(self) -> u32 {
|
|
self.0
|
|
}
|
|
}
|
|
|
|
impl Display for ObjectId {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
Display::fmt(&self.0, f)
|
|
}
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
pub struct GlobalName(u32);
|
|
|
|
impl GlobalName {
|
|
pub fn from_raw(id: u32) -> Self {
|
|
Self(id)
|
|
}
|
|
|
|
pub fn raw(self) -> u32 {
|
|
self.0
|
|
}
|
|
}
|
|
|
|
impl Display for GlobalName {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
Display::fmt(&self.0, f)
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, Ord, PartialOrd, Eq, PartialEq)]
|
|
pub struct EiObjectId(u64);
|
|
|
|
impl EiObjectId {
|
|
pub const NONE: Self = EiObjectId(0);
|
|
|
|
pub fn from_raw(raw: u64) -> Self {
|
|
Self(raw)
|
|
}
|
|
|
|
pub fn raw(self) -> u64 {
|
|
self.0
|
|
}
|
|
}
|
|
|
|
impl Display for EiObjectId {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
Display::fmt(&self.0, f)
|
|
}
|
|
}
|
|
|
|
impl LowerHex for EiObjectId {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
LowerHex::fmt(&self.0, f)
|
|
}
|
|
}
|