TeamMemberRole comes from an external API and said API does not guarantee that there will not be new variants, therefore I have to define it as so: ```rs
#[derive(serde::Deserialize)]
#[non_exhaustive]
pub enum TeamMemberRole {
Admin,
Developer,
ReadOnly,
#[serde(untagged)]
Other(String),
}
I would like to implement ordering on this, so users can use it to check permissions, and make sure that all `Other` values are the same ordering value to prevent weirdness where a new role is added and the checks start to act eratically, so just checking that ```rs
impl TeamMemberRole {
fn discriminant(&self) -> u8 {
match self {
Self::Admin => 3,
Self::Developer => 2,
Self::ReadOnly => 1,
Self::Other(_) => 0,
}
}
}
impl PartialEq for TeamMemberRole {
fn eq(&self, other: &Self) -> bool {
self.discriminant() == other.discriminant()
}
}
impl Eq for TeamMemberRole {}
impl PartialOrd for TeamMemberRole {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for TeamMemberRole {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.discriminant().cmp(&other.discriminant())
}
}
``` does not break the contract of Ord/Eq.