Struct savefile::Deserializer[][src]

pub struct Deserializer<'a> {
    pub file_version: u32,
    pub memory_version: u32,
    // some fields omitted
}
Expand description

Object from which bytes to be deserialized are read. This is basically just a wrapped std::io::Read object, the version number of the file being read, and the current version number of the data structures in memory.

Fields

file_version: u32

The version of the input file

memory_version: u32

The version of the data structures in memory

Implementations

This function constructs a temporary state object of type R, and returns a mutable reference to it. This object can be used to store data that needs to live for the entire deserialization session. An example is de-duplicating Arc and other reference counted objects. Out of the box, Arc has this deduplication done for it. The type T must be set to the type being deserialized, and is used as a key in a hashmap separating the state for different types.

Reads a u8 and return true if equal to 1

Reads an u8

Reads a little endian u16

Reads a little endian u32

Reads a little endian u64

Reads an i8

Reads a little endian i16

Reads a little endian i32

Reads a little endian i64

Reads a little endian f32

Reads a little endian f64

Reads an i64 into an isize. For 32 bit architectures, the function fails on overflow.

Reads an u64 into an usize. For 32 bit architectures, the function fails on overflow.

Reads a 64 bit length followed by an utf8 encoded string. Fails if data is not valid utf8

Reads ‘len’ raw u8 bytes as a Vec

Reads raw u8 bytes into the given buffer. The buffer size must be equal to the number of bytes desired to be read.

Deserialize an object of type T from the given reader. Don’t use this method directly, use the crate::load function instead.

Deserialize an object of type T from the given reader. Don’t use this method directly, use the crate::load_noschema function instead.

Create a Deserializer. Don’t use this method directly, use the crate::load function instead.

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.