Struct gma::GMAFile[][src]

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

GMA File

Implementations

Get the gma archive versiom

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

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

The seconds since UNIX epoch from when the file was created

The name of the addon

The description of the addon

The type of the addon

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

Helper function to check if this addon contains a certain tag

The name of the addon’s author

Returns true if the input file was compressed, false otherwise

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, 

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.