Skip to main content

serialize

Function serialize 

Source
pub fn serialize<'a, W, T>(out: &'a mut W, val: T) -> Result<&'a [u8]>
where W: Write + AsRef<[u8]> + 'a, T: Serialize,
Expand description

Serializes a value into a caller-provided output buffer.

Encoding is written through the writer without resetting it, and the returned slice covers the full buffer exposed through AsRef<[u8]>. The compact codec supports its database-oriented subset of the Serde data model.

ยงPanics

Panics if T requests a Serde data-model operation unsupported by this codec. Debug builds also panic when record-layout invariants are violated or when a directly wrapped Json<Box<serde_json::value::RawValue>> is serialized.