use crate::Archive;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Group {
Cs,
Econ,
Eess,
Math,
Physics,
QBio,
QFin,
Stat,
}
impl From<Archive> for Group {
fn from(archive: Archive) -> Self {
match archive {
Archive::Cs => Self::Cs,
Archive::Econ => Self::Econ,
Archive::Eess => Self::Eess,
Archive::Math => Self::Math,
Archive::AstroPh
| Archive::CondMat
| Archive::GrQc
| Archive::HepEx
| Archive::HepLat
| Archive::HepPh
| Archive::HepTh
| Archive::MathPh
| Archive::Nlin
| Archive::NuclEx
| Archive::NuclTh
| Archive::Physics
| Archive::QuantPh => Self::Physics,
Archive::QBio => Self::QBio,
Archive::QFin => Self::QFin,
Archive::Stat => Self::Stat,
}
}
}
#[cfg(test)]
mod tests {
use crate::{Archive, Group};
#[test]
fn group_from_archive() {
let cat_id = Group::from(Archive::AstroPh);
assert_eq!(cat_id, Group::Physics);
}
}