ttmp-rs/src/model/manifest_kind.rs

27 lines
576 B
Rust
Raw Normal View History

2022-11-02 19:43:25 +00:00
use crate::model::{ModPack, SimpleMod};
#[derive(Debug)]
pub enum ManifestKind {
V1(Vec<SimpleMod>),
V2(ModPack),
}
impl ManifestKind {
pub fn simple_mods_list(&self) -> &[SimpleMod] {
match self {
Self::V1(mods) => mods,
Self::V2(pack) => match &pack.simple_mods_list {
Some(list) => list,
None => &[],
},
}
}
2022-11-02 20:37:44 +00:00
pub fn into_mod_pack(self) -> ModPack {
match self {
Self::V1(mods) => mods.into(),
Self::V2(pack) => pack,
}
}
2022-11-02 19:43:25 +00:00
}