Skip to main content

encode_with_header

Function encode_with_header 

Source
pub fn encode_with_header<S>(
    magic: &[u8; 8],
    widths: [u8; 2],
    value: &S,
) -> Result<Vec<u8>, SparseErrors>
where S: Serialize,
Expand description

Encode a value behind a header.

§Params

  • magic - Magic bytes naming the structure
  • widths - Element widths of the value’s data layers, in bytes
  • value - The value to encode

§Returns

The header followed by the bincode payload.