use newtype_derive::newtype_fmt;
use serde::Deserialize;
use serde::Serialize;
pub type CPUIdType = u32;
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
#[repr(transparent)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct PhysicalCoreId(CPUIdType);
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
#[repr(transparent)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct LogicalCoreId(CPUIdType);
newtype_derive::NewtypeFrom! { () pub struct PhysicalCoreId(CPUIdType); }
newtype_derive::NewtypeDisplay! { () pub struct PhysicalCoreId(CPUIdType); }
newtype_derive::NewtypeFrom! { () pub struct LogicalCoreId(CPUIdType); }
newtype_derive::NewtypeDisplay! { () pub struct LogicalCoreId(CPUIdType); }
impl PhysicalCoreId {
pub const fn new(core_id: CPUIdType) -> Self {
Self(core_id)
}
}
impl LogicalCoreId {
#[inline]
pub const fn new(core_id: CPUIdType) -> Self {
Self(core_id)
}
}
impl From<PhysicalCoreId> for usize {
fn from(value: PhysicalCoreId) -> usize {
value.0 as usize
}
}
impl From<LogicalCoreId> for usize {
fn from(value: LogicalCoreId) -> usize {
value.0 as usize
}
}