pub trait Serialize: WithSchema {
fn serialize(
&self,
serializer: &mut Serializer<'_>
) -> Result<(), SavefileError>;
}Expand description
This trait must be implemented for all data structures you wish to be able to serialize. To actually serialize data: create a Serializer, then call serialize on your data to save, giving the Serializer as an argument.
The most convenient way to implement this is to use
#[macro_use] extern crate savefile-derive;
and the use #[derive(Serialize)]
Required methods
fn serialize(
&self,
serializer: &mut Serializer<'_>
) -> Result<(), SavefileError>
fn serialize(
&self,
serializer: &mut Serializer<'_>
) -> Result<(), SavefileError>
Serialize self into the given serializer.