[][src]Trait savefile::ReprC

pub unsafe trait ReprC: Copy {
    fn repr_c_optimization_safe(version: u32) -> bool;
}

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.

Loading content...

Implementations on Foreign Types

impl ReprC for bool[src]

impl ReprC for u8[src]

impl ReprC for i8[src]

impl ReprC for u16[src]

impl ReprC for i16[src]

impl ReprC for u32[src]

impl ReprC for i32[src]

impl ReprC for u64[src]

impl ReprC for i64[src]

impl ReprC for usize[src]

impl ReprC for isize[src]

Loading content...

Implementors

Loading content...