0
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden synced 2024-06-01 19:48:55 +02:00

Set PartialOrd to consider invalid i32 UserOrgType lower than anything

This commit is contained in:
Miroslav Prasil 2018-11-13 16:34:21 +00:00
parent b94f4db52a
commit f3e6cc6ffd

View file

@ -83,6 +83,21 @@ impl PartialOrd<i32> for UserOrgType {
}
return None
}
fn gt(&self, other: &i32) -> bool {
match self.partial_cmp(other) {
Some(Ordering::Less) => false,
_ => true,
}
}
fn ge(&self, other: &i32) -> bool {
match self.partial_cmp(other) {
Some(Ordering::Less) => false,
_ => true,
}
}
}
impl PartialEq<UserOrgType> for i32 {
@ -98,6 +113,21 @@ impl PartialOrd<UserOrgType> for i32 {
}
return None
}
fn lt(&self, other: &UserOrgType) -> bool {
match self.partial_cmp(other) {
Some(Ordering::Less) | None => true,
_ => false,
}
}
fn le(&self, other: &UserOrgType) -> bool {
match self.partial_cmp(other) {
Some(Ordering::Less) | Some(Ordering::Equal) | None => true,
_ => false,
}
}
}
impl UserOrgType {