Skip to main content

encode_header_le

Function encode_header_le 

Source
pub fn encode_header_le(h: &HeaderV1) -> Result<[u8; 80], HeaderError>
Expand description

Serialize a HeaderV1 into an 80‑byte buffer in little‑endian order.

§Returns

  • Ok([u8; HEADER_LEN_V1]) containing the encoded header bytes.
  • Err(HeaderError) if validation fails (bad magic, zero salt, invalid enums, etc.).

§Notes

  • Field order must match the struct layout in types.rs.
  • Uses helper functions for compact little‑endian writes.
  • Debug assertion ensures exactly 80 bytes are written.