use crate::{
common::{
file::{File as File_, FileArchived},
pack::{Pack as Pack_, PackArchived},
},
file::File,
};
pub trait Pack {
type File: File;
fn get_file_by_path(
&self,
path: &str,
) -> Option<&Self::File>;
}
impl Pack for Pack_ {
type File = File_;
fn get_file_by_path(
&self,
path: &str,
) -> Option<&Self::File> {
let file = self.files_by_path.get(path)?;
Some(file)
}
}
impl Pack for PackArchived {
type File = FileArchived;
fn get_file_by_path(
&self,
path: &str,
) -> Option<&Self::File> {
let file = self.files_by_path.get(path)?;
Some(file)
}
}