use core::fmt;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum Mode {
None,
Constant,
Private,
Public,
}
impl Mode {
pub fn eq_user(&self, other: &Mode) -> bool {
match (self, other) {
(Self::None | Self::Private, Self::None | Self::Private) => true,
(a, b) => a == b,
}
}
}
impl fmt::Display for Mode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use Mode::*;
match self {
None => write!(f, ""),
Constant => write!(f, "constant"),
Private => write!(f, "private"),
Public => write!(f, "public"),
}
}
}