1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
/// The category of a resource.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ResourceCategory {
/// Resources located in the `assets/` directory.
Assets,
/// Resource located in the `data/` directory.
Data,
}
impl ResourceCategory {
/// Returns the name of the top-level directory containing this category of
/// resource.
///
/// # Example
///
/// ```
/// # use minecraft_assets::api::*;
/// let category = ResourceCategory::Assets;
/// assert_eq!(category.directory(), "assets");
///
/// let category = ResourceCategory::Data;
/// assert_eq!(category.directory(), "data");
/// ```
pub fn directory(&self) -> &'static str {
match self {
Self::Assets => "assets",
Self::Data => "data",
}
}
}