Trait integer_encoding::VarInt [−][src]
Varint (variable length integer) encoding, as described in https://developers.google.com/protocol-buffers/docs/encoding. Uses zigzag encoding (also described there) for signed integer representation.
Required methods
fn required_space(self) -> usize
[src]
Returns the number of bytes this number needs in its encoded form. Note: This varies depending on the actual number you want to encode.
fn decode_var(src: &[u8]) -> (Self, usize)
[src]
Decode a value from the slice. Returns the value and the number of bytes read from the slice (can be used to read several consecutive values from a big slice)
fn encode_var(self, src: &mut [u8]) -> usize
[src]
Encode a value into the slice. The slice must be at least required_space()
bytes long.
The number of bytes taken by the encoded integer is returned.
Provided methods
fn encode_var_vec(self) -> Vec<u8>
[src]
Helper: Encode a value and return the encoded form as Vec. The Vec must be at least
required_space()
bytes long.