use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub struct TeksiloWindowId(u64);
impl TeksiloWindowId {
pub fn new(id: u64) -> Self {
Self(id)
}
pub fn raw(&self) -> u64 {
self.0
}
}
impl fmt::Display for TeksiloWindowId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Window({})", self.0)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn equality_is_by_value() {
let a = TeksiloWindowId::new(1);
let b = TeksiloWindowId::new(1);
let c = TeksiloWindowId::new(2);
assert_eq!(a, b);
assert_ne!(a, c);
}
#[test]
fn display_format() {
assert_eq!(format!("{}", TeksiloWindowId::new(7)), "Window(7)");
}
}