Struct PakBuilder

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

When it is time to create the pak file, this struct is used to build it. Remember that this struct doen’t have the ability to read data that has been paked or delete data that has been paked.

Implementations§

Source§

impl PakBuilder

Source

pub fn new() -> Self

Creates a new instance of PakBuilder.

Adds an item to the pak file that does not support searching. Takes anything that implements PakItemSerialize.

Source

pub fn pak<T: PakItemSerialize + PakItemSearchable>( &mut self, item: T, ) -> PakResult<PakPointer>

Adds an item to the pak file that supports searching. Takes anything that implements PakItemSerialize and PakItemSearchable.

Source

pub fn size(&self) -> u64

The current size of the pak file in bytes.

Source

pub fn len(&self) -> usize

The number of items in the pak file.

Source

pub fn with_name(self, name: &str) -> Self

Adds a name to the pak file’s metadata.

Source

pub fn with_description(self, description: &str) -> Self

Adds a description to the pak file’s metadata.

Source

pub fn with_author(self, author: &str) -> Self

Adds an author to the pak file’s metadata.

Source

pub fn set_name(&mut self, name: &str)

Sets the name of the pak file’s metadata.

Source

pub fn set_description(&mut self, description: &str)

Sets the description of the pak file’s metadata.

Source

pub fn set_author(&mut self, author: &str)

Sets the author of the pak file’s metadata.

Source

pub fn build_file(self, path: impl AsRef<Path>) -> PakResult<Pak>

Builds the pak file and writes it to the specified path. This also returns a Pak object that is attached to that file.

Source

pub fn build_in_memory(self) -> PakResult<Pak>

Builds the pak file and writes it to the specified path. This also returns a Pak object that is attached to that slice of memory.

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.