#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum EncodingRules {
Ber,
Cer,
Der,
}
impl EncodingRules {
pub fn codec(self) -> crate::Codec {
match self {
Self::Ber => crate::Codec::Ber,
Self::Cer => crate::Codec::Cer,
Self::Der => crate::Codec::Der,
}
}
pub fn is_ber(self) -> bool {
matches!(self, Self::Ber)
}
pub fn is_cer(self) -> bool {
matches!(self, Self::Cer)
}
pub fn allows_constructed_strings(self) -> bool {
matches!(self, Self::Ber | Self::Cer)
}
pub fn allows_indefinite(self) -> bool {
matches!(self, Self::Ber | Self::Cer)
}
pub fn max_string_length(self) -> usize {
match self {
Self::Cer => 1000,
_ => usize::MAX,
}
}
}