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