1
0
Fork 0
forked from wry/wry

wayland: make object versions type safe

This commit is contained in:
Julian Orth 2024-04-08 14:47:50 +02:00
parent 0d7b45d149
commit e3a1a0b30f
50 changed files with 198 additions and 173 deletions

View file

@ -2,6 +2,7 @@ use {
crate::{client::ClientError, utils::buffd::MsgParser, wire::WlDisplayId},
std::{
any::Any,
cmp::Ordering,
fmt::{Display, Formatter},
rc::Rc,
},
@ -54,3 +55,22 @@ impl Interface {
self.0
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
pub struct Version(pub u32);
impl Version {
pub const ALL: Version = Version(0);
}
impl PartialEq<u32> for Version {
fn eq(&self, other: &u32) -> bool {
self.0 == *other
}
}
impl PartialOrd<u32> for Version {
fn partial_cmp(&self, other: &u32) -> Option<Ordering> {
self.0.partial_cmp(other)
}
}