[][src]Struct rstb::ResourceSizeTable

pub struct ResourceSizeTable { /* fields omitted */ }

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, Box<dyn Error>>[src]

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

pub fn from_text(text: &str) -> Result<ResourceSizeTable, Box<dyn 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, Box<dyn 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<(), Box<dyn 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>, Box<dyn Error>>
[src]

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

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

impl Debug for ResourceSizeTable[src]

impl Default for ResourceSizeTable[src]

impl PartialEq<ResourceSizeTable> for ResourceSizeTable[src]

impl StructuralPartialEq for ResourceSizeTable[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.

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.