1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 18:24:05 +02:00

more tick comparison

This commit is contained in:
Robin Appelman 2022-10-23 16:01:50 +02:00
commit 88314634cb

View file

@ -4,7 +4,7 @@ use bitbuffer::{BitRead, BitReadStream, BitWrite, BitWriteStream, Endianness};
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::cmp::Ordering; use std::cmp::Ordering;
use std::fmt::{Debug, Display, Formatter}; use std::fmt::{Debug, Display, Formatter};
use std::ops::{Add, Range, RangeInclusive, Sub}; use std::ops::{Add, Sub};
pub use userinfo::UserInfo; pub use userinfo::UserInfo;
@ -166,6 +166,18 @@ impl PartialOrd<u32> for ServerTick {
} }
} }
impl PartialEq<ServerTick> for u32 {
fn eq(&self, other: &ServerTick) -> bool {
self.eq(&other.0)
}
}
impl PartialOrd<ServerTick> for u32 {
fn partial_cmp(&self, other: &ServerTick) -> Option<Ordering> {
self.partial_cmp(&other.0)
}
}
impl From<u32> for ServerTick { impl From<u32> for ServerTick {
fn from(tick: u32) -> Self { fn from(tick: u32) -> Self {
ServerTick(tick) ServerTick(tick)
@ -246,6 +258,18 @@ impl PartialOrd<u32> for DemoTick {
} }
} }
impl PartialEq<DemoTick> for u32 {
fn eq(&self, other: &DemoTick) -> bool {
self.eq(&other.0)
}
}
impl PartialOrd<DemoTick> for u32 {
fn partial_cmp(&self, other: &DemoTick) -> Option<Ordering> {
self.partial_cmp(&other.0)
}
}
impl From<u32> for DemoTick { impl From<u32> for DemoTick {
fn from(tick: u32) -> Self { fn from(tick: u32) -> Self {
DemoTick(tick) DemoTick(tick)