Struct infinite_rs::TagFile

source ·
pub struct TagFile {
    pub header: TagHeader,
    pub dependencies: Vec<TagDependency>,
    pub datablock: Vec<TagDataBlock>,
    pub structs: Vec<TagStruct>,
    pub data_references: Vec<TagDataReference>,
    pub tag_references: Vec<TagReference>,
    pub zoneset_header: TagZonesetHeader,
    pub zonesets: Vec<TagZoneset>,
    pub structure: Option<Box<dyn Any>>,
}
Expand description

Tag structure containing structure of entire tag file.

Fields§

§header: TagHeader

Header containing info on how to read other parts of the file.

§dependencies: Vec<TagDependency>

Tags that are referenced by this tag and that need to be lazy loaded.

§datablock: Vec<TagDataBlock>

Blocks making up the entire tag (Internal and External)

§structs: Vec<TagStruct>

Internal structure units of the tag.

§data_references: Vec<TagDataReference>

References to external data from the tag.

§tag_references: Vec<TagReference>

Tags that are referenced by this tag inside the module.

§zoneset_header: TagZonesetHeader

Zoneset header for reading the other zonesets.

§zonesets: Vec<TagZoneset>

Zonesets, unknown what these are.

§structure: Option<Box<dyn Any>>

Actual structure depending on their tag group. Access this using get_struct.

Implementations§

source§

impl TagFile

source

pub fn new() -> Self

Allocate new TagFile and set it to default values.

source

pub fn read<R: BufRead + BufReaderExt + Seek>( &mut self, reader: &mut R, ) -> Result<()>

Reads the tag fike from the given readers implementing BufRead, BufReaderExt and Seek.

§Arguments
  • reader - A mutable reference to a reader that implements BufRead + BufReaderExt + Seek from which to read the data.
§Returns

Returns Ok(()) if the header is successfully read, or an (anyhow) Error if an I/O error occurs or if the header data is invalid.

source

pub fn read_struct<R: BufRead + BufReaderExt + Seek>( &mut self, tag_group: &str, reader: &mut R, ) -> Result<()>

Reads the “structure” according to a tag’s group.

This function creates a Box<> smart pointer depending on the type of the tag. The structure can later be obtained using get_struct.

§Arguments
  • reader - A mutable reference to a reader that implements BufRead, BufReaderExt and Seek from which to read the data.
§Returns

Returns Ok(()) if the header is successfully read, or an Err if an I/O error occurs or if the header data is invalid.

source

pub fn get_struct<T: 'static>(&self) -> Option<&T>

Get the “structure” according to a tag’s group.

This function returns an Option<&T> where T is the type specified when calling the function.

§Type Parameters
  • T: The type to cast the structure to.
§Returns

Returns Some(&T) if the structure exists and can be cast to type T, or None otherwise.

Trait Implementations§

source§

impl Debug for TagFile

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for TagFile

source§

fn default() -> TagFile

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

Auto Trait Implementations§

§

impl Freeze for TagFile

§

impl !RefUnwindSafe for TagFile

§

impl !Send for TagFile

§

impl !Sync for TagFile

§

impl Unpin for TagFile

§

impl !UnwindSafe for TagFile

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.