read_varint_le

Function read_varint_le 

Source
pub fn read_varint_le<R: Read>(reader: &mut R) -> Result<(u64, usize)>
Expand description

Reads a variable-length integer (VarInt) encoded in little-endian format from a source implementing the Read trait.

The VarInt encoding uses the most significant bit (MSB) of each byte as a continuation bit. The continuation bit being 1 indicates that there are following bytes. The actual integer value is encoded in the remaining 7 bits of each byte.

§Parameters

  • reader: A source implementing the Read trait (e.g., file, network stream).

§Returns

Returns a Result containing either:

  • A tuple of the decoded u64 value and the number of bytes read (offset).
  • An io::Error in case of any reading error or if the VarInt is too long.