1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone)]
4pub struct PPtr {
5 pub m_FileID: i64,
6 pub m_PathID: i64,
7}
8
9impl PPtr {
10 fn get_object_handler<'a, R: std::io::Read + std::io::Seek>(
11 &'a self,
12 asset: &'a crate::files::SerializedFile,
13 reader: &'a mut R,
14 ) -> std::io::Result<crate::files::ObjectHandler<R>> {
15 match asset.m_Objects.iter().find(|x| x.m_PathID == self.m_PathID) {
16 Some(objectinfo) => Ok(asset.get_object_handler(objectinfo, reader)),
17 None => Err(std::io::Error::new(
18 std::io::ErrorKind::NotFound,
19 "Object not found",
20 )),
21 }
22 }
23}