[][src]Struct gma::GMAFile

pub struct GMAFile<ReaderType> where
    ReaderType: BufRead + Seek
{ /* fields omitted */ }

Implementations

impl<ReaderType> GMAFile<ReaderType> where
    ReaderType: BufRead + Seek
[src]

pub fn version(&self) -> u8[src]

Get the gma archive versiom

pub fn appid(&self) -> u32[src]

The appid. This is always '4000', the appid of garry's mod

pub fn author_steamid(&self) -> u64[src]

The author's steamid. This is currently unused by the game and is usually hardcoded to 0

pub fn timestamp(&self) -> u64[src]

The seconds since UNIX epoch from when the file was created

pub fn name(&self) -> &str[src]

The name of the addon

pub fn description(&self) -> &str[src]

The description of the addon

pub fn addon_type(&self) -> Option<AddonType>[src]

The type of the addon

pub fn addon_tags(&self) -> &[AddonTag][src]

The tags of the item. This should be at most 2 but this implementation supports reading more

pub fn contains_tag(&self, tag: AddonTag) -> bool[src]

Helper function to check if this addon contains a certain tag

pub fn author(&self) -> &str[src]

The name of the addon's author

pub fn compressed(&self) -> bool[src]

Returns true if the input file was compressed, false otherwise

pub fn entries(&self) -> impl Iterator<Item = &FileEntry>[src]

An iterator of the file entries of this archive

pub fn read_entry<F, R>(&self, entry: &FileEntry, func: F) -> Result<R> where
    F: FnOnce(&FileEntry, &mut dyn Read) -> R, 
[src]

Function to read the contents of a given entry.

The callback function takes as parameter a reference to the entry and a mutable reference to a type that implements Read.

use std::io::Read;
let archive = gma::load_from_memory(&dummy_buffer).unwrap();
for entry in archive.entries() {
    let contents = archive.read_entry(entry, |entry_ref, reader|{
        let mut c = String::new();
        reader.read_to_string(&mut c).unwrap();
        c
    }).unwrap();
    // do something with contents
}

Trait Implementations

impl<ReaderType: Debug> Debug for GMAFile<ReaderType> where
    ReaderType: BufRead + Seek
[src]

Auto Trait Implementations

impl<ReaderType> !RefUnwindSafe for GMAFile<ReaderType>

impl<ReaderType> Send for GMAFile<ReaderType> where
    ReaderType: Send

impl<ReaderType> !Sync for GMAFile<ReaderType>

impl<ReaderType> Unpin for GMAFile<ReaderType> where
    ReaderType: Unpin

impl<ReaderType> UnwindSafe for GMAFile<ReaderType> where
    ReaderType: UnwindSafe

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.