Skip to main content

PakFile

Struct PakFile 

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

Represents a PAK file by filepath and PakManifest Provides methods to iterate over file contents.

Implementations§

Source§

impl PakFile

Source

pub fn new(filepath: PathBuf, manifest: PakManifest) -> Self

Source

pub async fn from_file<P>(filepath: P) -> Result<Self>
where P: AsRef<Path>,

Constructs from a PAK file. Throws Error::OpenPak, Error::ReadPak

Source

pub fn from_file_sync<P>(filepath: P) -> Result<Self>
where P: AsRef<Path>,

Constructs from a PAK file. Throws Error::OpenPak, Error::ReadPak

Source

pub async fn create_from_dir<P>( input_dir: P, manifest: PakManifest, output_filepath: P, ) -> Result<Self>
where P: AsRef<Path>,

Creates a PAK file by copying files from a directory. The manifest for the directory must already have been generated using PakManifest::from_dir.

Source

pub fn create_from_dir_sync<P>( input_dir: P, manifest: PakManifest, output_filepath: P, ) -> Result<Self>
where P: AsRef<Path>,

Creates (writes) a PAK file by copying files from a directory. The manifest for the directory must already have been generated using PakManifest::from_dir_sync.

Source

pub fn extract_sync<P: AsRef<Path>>(&self, dest_dir: P) -> Result<()>

Extracts the contents of the PAK file to the specified directory. Throws Error::CreateDirectory, Error::OpenPak, Error::WritePak

Source

pub async fn extract<P: AsRef<Path>>(&self, dest_dir: P) -> Result<()>

Extracts the contents of the PAK file to the specified directory. Throws Error::CreateDirectory, Error::OpenPak, Error::WritePak

Source

pub fn read_items<'p>(&'p self) -> impl Stream<Item = Result<PakItem<'p>>>

Returns an iterator over each file item in the PAK, including data. Throws Error::OpenPak, Error::ReadPak

Source

pub fn read_items_sync<'p>( &'p self, ) -> Result<impl Iterator<Item = Result<PakItem<'p>>>>

Returns an iterator over each file item in the PAK, including data. Throws Error::OpenPak, Error::ReadPak

Source

pub fn manifest(&self) -> &PakManifest

Trait Implementations§

Source§

impl Debug for PakFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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.