use core::fmt;
#[allow(clippy::module_name_repetitions)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SchedulerId(usize);
impl SchedulerId {
#[must_use]
pub const fn new(id: usize) -> Self {
Self(id)
}
#[must_use]
pub const fn get(&self) -> usize {
self.0
}
}
impl fmt::Display for SchedulerId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Scheduler({})", self.0)
}
}
#[cfg(test)]
mod tests {
use super::SchedulerId;
#[test]
fn scheduler_id_round_trips_and_displays() {
let id = SchedulerId::new(42);
assert_eq!(id.get(), 42);
assert_eq!(format!("{id}"), "Scheduler(42)");
}
}