[−][src]Function terminus_store::structure::vbyte::decode
pub fn decode(buf: &[u8]) -> Result<(u64, usize), DecodeError>
Decodes a u64
from a variable-byte-encoded slice.
On success, this function returns Ok
with the decoded value and encoding length. Otherwise,
the slice data is invalid, and the function returns Err
with the corresponding DecodeError
giving the reason.
This function expects the encoded value to start at the beginning of the slice; and the slice must be large enough to include all of the encoded bytes of one value. Decoding stops at the end of the encoded value, so it doesn't matter if the slice is longer.