[][src]Struct savefile::Deserializer

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

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

Methods

impl<'a> Deserializer<'a>[src]

pub fn read_bool(&mut self) -> Result<bool, SavefileError>[src]

Reads a u8 and return true if equal to 1

pub fn read_u8(&mut self) -> Result<u8, SavefileError>[src]

Reads an u8

pub fn read_u16(&mut self) -> Result<u16, SavefileError>[src]

Reads a little endian u16

pub fn read_u32(&mut self) -> Result<u32, SavefileError>[src]

Reads a little endian u32

pub fn read_u64(&mut self) -> Result<u64, SavefileError>[src]

Reads a little endian u64

pub fn read_i8(&mut self) -> Result<i8, SavefileError>[src]

Reads an i8

pub fn read_i16(&mut self) -> Result<i16, SavefileError>[src]

Reads a little endian i16

pub fn read_i32(&mut self) -> Result<i32, SavefileError>[src]

Reads a little endian i32

pub fn read_i64(&mut self) -> Result<i64, SavefileError>[src]

Reads a little endian i64

pub fn read_f32(&mut self) -> Result<f32, SavefileError>[src]

Reads a little endian f32

pub fn read_f64(&mut self) -> Result<f64, SavefileError>[src]

Reads a little endian f64

pub fn read_isize(&mut self) -> Result<isize, SavefileError>[src]

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

pub fn read_usize(&mut self) -> Result<usize, SavefileError>[src]

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

pub fn read_string(&mut self) -> Result<String, SavefileError>[src]

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

pub fn read_bytes(&mut self, len: usize) -> Result<Vec<u8>, SavefileError>[src]

Reads 'len' raw u8 bytes as a Vec

pub fn read_bytes_to_buf(&mut self, buf: &mut [u8]) -> Result<(), SavefileError>[src]

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

pub fn load<T: WithSchema + Deserialize>(
    reader: &mut dyn Read,
    version: u32
) -> Result<T, SavefileError>
[src]

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

pub fn load_noschema<T: WithSchema + Deserialize>(
    reader: &mut dyn Read,
    version: u32
) -> Result<T, SavefileError>
[src]

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

pub fn new_raw(reader: &mut dyn Read) -> Deserializer[src]

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

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Deserializer<'a>

impl<'a> !Send for Deserializer<'a>

impl<'a> !Sync for Deserializer<'a>

impl<'a> Unpin for Deserializer<'a>

impl<'a> !UnwindSafe for Deserializer<'a>

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> Erased for T

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,