Skip to main content

encode

Function encode 

Source
pub fn encode<T: Document>(doc: &T, collection_id: u32) -> Result<Vec<u8>>
Expand description

Encode doc into the on-disk record format.

Layout: DocumentHeader (16 bytes) followed by postcard::to_allocvec(doc). Returns the assembled bytes in a fresh Vec<u8>; allocation is unavoidable here because the payload length is not known until postcard runs.

§Errors