Struct rstb::ResourceSizeTable[][src]

pub struct ResourceSizeTable { /* fields omitted */ }
Expand description

A representation of a Breath of the Wild Resource Size Table (RSTB) file

Implementations

impl ResourceSizeTable[src]

pub fn new() -> ResourceSizeTable[src]

Creates a new, blank RSTB. Probably not very useful, to be honest.

pub fn new_from_stock(endian: Endian) -> ResourceSizeTable[src]

Creates a new copy of a stock BOTW RSTB. Passing Endian::Big will return the RSTB from the 1.5.0 Wii U version, and passing Endian::Little will return the RSTB from the 1.6.0 Switch version.

pub fn to_text(&self) -> Result<String, Error>[src]

Creates a text representation of an RSTB as a JSON string.

pub fn from_text(text: &str) -> Result<ResourceSizeTable, Error>[src]

Reads an RSTB from a JSON representation.

impl ResourceSizeTable[src]

pub fn from_binary<B: AsRef<[u8]>>(
    data: B,
    endian: Endian
) -> Result<ResourceSizeTable, Error>
[src]

Parses an RSTB file from a buffer implementing Into<Vec<u8>> using the specified endianness. If the data is yaz0 compressed, it will be decompressed automatically.

pub fn write_binary<W: Write>(
    &self,
    writer: &mut W,
    endian: Endian
) -> Result<(), Error>
[src]

Writes the contents of an RSTB to a binary writer implementing Write. Does not yaz0 compress, this is left to the user.

pub fn to_binary(
    &self,
    endian: Endian,
    compress: bool
) -> Result<Vec<u8>, Error>
[src]

Writes the binary content of an RSTB as Vec<u8>, optionally with yaz0 compression.

pub fn name_entries(&self) -> Iter<'_, String, u32>[src]

Iterates entries in the RSTB’s name table.

pub fn hash_entries(&self) -> Iter<'_, u32, u32>[src]

Iterates entries in the RSTB’s CRC table.

pub fn get_size(&self, file: &str) -> Option<u32>[src]

Attempts to retrieve the resource size of a file in the RSTB, returning None if there is no entry for the file. Checks the CRC table first and then the name table.

pub fn is_in_table(&self, file: &str) -> bool[src]

Checks whether a file has an entry in the RSTB. Checks the CRC table first and then the name table.

pub fn set_size<I: Into<u32>>(&mut self, file: &str, size: I)[src]

Sets the resource size of a file in the RSTB, adding an entry if one is not already present. Uses the CRC table only.

pub fn delete_entry(&mut self, file: &str)[src]

Deletes an entry from the RSTB. Does nothing if the entry does not exist. Checks the CRC table first and then the name table.

Trait Implementations

impl BinRead for ResourceSizeTable[src]

type Args = (usize,)

The type of arguments needed to be supplied in order to read this type, usually a tuple. Read more

fn read_options<R: Read + Seek>(
    __binread_generated_var_reader: &mut R,
    __binread_generated_var_options: &ReadOptions,
    __binread_generated_var_arguments: Self::Args
) -> BinResult<Self>
[src]

Read the type from the reader

fn read<R>(reader: &mut R) -> Result<Self, Error> where
    R: Read + Seek
[src]

Read the type from the reader while assuming no arguments have been passed Read more

fn read_args<R>(reader: &mut R, args: Self::Args) -> Result<Self, Error> where
    R: Read + Seek
[src]

Read the type from the reader using the specified arguments

fn after_parse<R>(
    &mut self,
    &mut R,
    &ReadOptions,
    Self::Args
) -> Result<(), Error> where
    R: Read + Seek
[src]

fn args_default() -> Option<Self::Args>[src]

The default arguments to be used when using the read shortcut method. Override this for any type that optionally requries arguments Read more

impl Clone for ResourceSizeTable[src]

fn clone(&self) -> ResourceSizeTable[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for ResourceSizeTable[src]

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

Formats the value using the given formatter. Read more

impl Default for ResourceSizeTable[src]

fn default() -> ResourceSizeTable[src]

Returns the “default value” for a type. Read more

impl PartialEq<ResourceSizeTable> for ResourceSizeTable[src]

fn eq(&self, other: &ResourceSizeTable) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &ResourceSizeTable) -> bool[src]

This method tests for !=.

impl StructuralPartialEq for ResourceSizeTable[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.