pak_db/
meta.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{error::PakResult};
4
5/// The metadata for a Pak file. Each pak file has this data embedded within the header.
6#[derive(Serialize, Deserialize)]
7pub struct PakMeta {
8    pub name: String,
9    pub version: String,
10    pub pak_version : String,
11    pub description: String,
12    pub author: String,
13    pub identifier : String,
14    pub(crate) extra : Vec<u8>,
15}
16
17impl PakMeta {
18    /// This returns the extra data that can be saved in the metadata. This can throw an error if the
19    /// wrong type is asked for.
20    pub fn get_extra<T>(&self) -> PakResult<T> where T : for<'de> Deserialize<'de> {
21        Ok(bincode::deserialize(&self.extra)?)
22    }
23}
24
25/// This carries the size information of each part of the Pak file. this is always the first 32 bytes of the file.
26#[derive(Serialize, Deserialize, Debug)]
27pub struct PakSizing {
28    pub meta_size: u64,
29    pub indices_size: u64,
30    pub vault_size: u64,
31    pub list_size: u64,
32}