pub fn encode_frame<T: Serialize>(
value: &T,
max_frame_bytes: usize,
) -> Result<Vec<u8>, Violation>Expand description
Serialise a value into one length-prefixed frame.
Pass a serde_json::value::RawValue when the exact body bytes matter;
anything else is encoded by serde.
ยงErrors
Returns a Violation when the value is not JSON-encodable or the encoded
body exceeds max_frame_bytes.