1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use de_types::objects::{ActiveObjectType, BuildingType, InactiveObjectType, ObjectType, UnitType};

pub(crate) trait FileStem: Copy {
    fn stem(self) -> &'static str;
}

impl FileStem for ObjectType {
    fn stem(self) -> &'static str {
        match self {
            Self::Active(ActiveObjectType::Building(BuildingType::Base)) => "base",
            Self::Active(ActiveObjectType::Building(BuildingType::PowerHub)) => "powerhub",
            Self::Active(ActiveObjectType::Unit(UnitType::Attacker)) => "attacker",
            Self::Inactive(InactiveObjectType::Tree) => "tree",
        }
    }
}