Module savefile::prelude
[−]
[src]
Structs
Deserializer |
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. |
Field | |
Removed | |
SchemaEnum | |
SchemaStruct | |
Serializer |
Object to which serialized data is to be written. This is basically just a wrapped [std::io::Write] object and a file protocol version number. |
Variant |
Enums
SavefileError | |
Schema |
The schema represents the save file format of your data. |
SchemaPrimitive |
Traits
Deserialize |
This trait must be implemented for all data structures you wish to be able to deserialize. |
ReprC |
This is a marker trait for types which have an in-memory layout that is packed and therefore identical to the layout that savefile will use on disk. This means that types for which this trait is implemented can be serialized very quickly by just writing their raw bits to disc. |
Serialize |
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. |
WithSchema |
This trait must be implemented by all data structures you wish to be able to save. It must encode the schema for the datastructure when saved using the given version number. When files are saved, the schema is encoded into the file. when loading, the schema is inspected to make sure that the load will safely succeed. This is only for increased safety, the file format does not in fact use the schema for any other purpose, the design is schema-less at the core, the schema is just an added layer of safety (which can be disabled). |
Functions
load | |
load_file | |
load_file_noschema | |
load_noschema | |
save | |
save_file | |
save_file_noschema | |
save_noschema |