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