Skip to main content

encode_record

Function encode_record 

Source
pub fn encode_record(record: &Record<'_>, out: &mut Vec<u8>) -> Result<()>
Available on crate feature alloc only.
Expand description

Encode record into a length-prefixed frame appended to out.

Writes 4 + body_len bytes. The 4-byte prefix is the body length as a big-endian u32; the body follows the layout documented in the module rustdoc.

§Errors

  • Error::InvalidFormat — any string field’s UTF-8 byte length, or the resulting body length, would not fit in a u32. In practice audit fields are tiny; the check is here so that absurd inputs produce a typed error rather than silent truncation.