Pak

Struct Pak 

Source
pub struct Pak { /* private fields */ }
Expand description

Represents a Pak file. This struct provides access to the metadata and data stored within the Pak file.

Implementations§

Source§

impl Pak

Source

pub fn new<S>(source: S) -> PakResult<Self>
where S: PakSource + Send + Sync + 'static,

Creates a new Pak instance from a PakSource.

Source

pub fn new_from_file<P>(path: P) -> PakResult<Self>
where P: AsRef<Path>,

Loads a Pak from the specified file path. This will not load the entire pak file into memory, just the header.

Source

pub fn query<T>( &self, query: impl PakQueryExpression<T>, ) -> PakResult<T::ReturnType>

Loads an object from the pak file via queried indices. This will only load the necessary data into memory.

Source

pub fn query_pql<T>(&self, pql: &str) -> PakResult<T::ReturnType>
where T: DeserializeGroup + 'static,

Loads an object from the pak file via queried indices. This will only load the necessary data into memory.

Source

pub fn size(&self) -> u64

Returns the size of the pak file in bytes.

Source

pub fn name(&self) -> &str

Returns the name given to the pak file.

Source

pub fn version(&self) -> &str

Returns the version of the pak file.

Source

pub fn author(&self) -> &str

Returns the author of the pak file.

Source

pub fn description(&self) -> &str

Returns the description of the pak file.

Source

pub fn get_extra<T>(&self) -> PakResult<T>
where T: for<'de> Deserialize<'de>,

This returns the extra data that can be saved in the metadata. This can throw an error if the wrong type is asked for.

Source

pub fn read_err<T>(&self, pointer: &PakPointer) -> PakResult<T>
where T: for<'de> Deserialize<'de>,

Read Data directly with a pointer.

Source

pub fn read<T>(&self, pointer: &PakPointer) -> Option<T>
where T: for<'de> Deserialize<'de>,

Source

pub fn identifier(&self) -> &str

Source

pub fn check_identifier(&self, id: &str) -> PakResult<()>

Auto Trait Implementations§

§

impl Freeze for Pak

§

impl RefUnwindSafe for Pak

§

impl Send for Pak

§

impl Sync for Pak

§

impl Unpin for Pak

§

impl UnwindSafe for Pak

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.