Skip to main content

write_varint

Function write_varint 

Source
pub fn write_varint(value: u64, out: &mut [u8]) -> Result<usize, VarintError>
Expand description

Writes value into the front of out in its shortest QUIC varint form, and reports how many bytes it took.

The Vec-appending form below delegates to this one. A caller with a fixed buffer โ€” a send path building a preamble it will right-align against an already-encoded header โ€” allocates nothing (B-250).

ยงErrors

VarintError::OutOfRange above 2^62 โˆ’ 1, and when out is shorter than the form value needs.