[−][src]Trait savefile::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.
Rules to implement this trait:
- The type must be copy
- The type must not contain any padding
- The type must have a strictly deterministic memory layout (no field order randomization). This typically means repr(C)
- All the constituent types of the type must also implement
ReprC
(correctly).
Required methods
fn repr_c_optimization_safe(version: u32) -> bool
This method returns true if the optimization is allowed for the protocol version given as an argument. This may return true if and only if the given protocol version has a serialized format identical to the given protocol version.