Skip to main content

xen/core/
domain_id.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2pub struct XenDomainId(pub u32);
3
4impl From<u32> for XenDomainId {
5    fn from(value: u32) -> Self {
6        Self(value)
7    }
8}
9
10impl From<XenDomainId> for u32 {
11    fn from(value: XenDomainId) -> Self {
12        value.0
13    }
14}
15
16impl std::fmt::Display for XenDomainId {
17    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
18        write!(f, "{}", self.0)
19    }
20}