vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit f3e6cc6ffd85a62004020268c6e78bab785c7600
parent b94f4db52a2baa6010f7baa4181dd582c2ff5f6b
Author: Miroslav Prasil <miroslav@prasil.info>
Date:   Tue, 13 Nov 2018 16:34:21 +0000

Set PartialOrd to consider invalid i32 UserOrgType lower than anything

Diffstat:
Msrc/db/models/organization.rs | 30++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs @@ -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 {