rpkg_rs/resource/legacy/
mod.rs1use std::path::Path;
2use crate::resource::resource_package::{ResourcePackage, ResourcePackageError};
3
4mod cl534170;
5
6pub enum Format {
7 CL482338, CL534170, CL535848, }
11
12pub fn read_package_from_file<P: AsRef<Path> >(format: Format, path: P) -> Result<ResourcePackage, ResourcePackageError>{
13 match format{
14 Format::CL482338 | Format::CL534170 | Format::CL535848 => {
15 cl534170::ResourcePackage::from_file(&path).map(|res| res.into())
16 }
17 }
18}
19
20pub fn read_package_from_memory(format: Format, memory: Vec<u8>) -> Result<ResourcePackage, ResourcePackageError>{
21 match format{
22 Format::CL482338 | Format::CL534170 | Format::CL535848 => {
23 cl534170::ResourcePackage::from_memory(memory).map(|res| res.into())
24 }
25 }
26}