Expand description
Minecraft VarInt encoding and decoding.
VarInts are variable-length 32-bit integers used throughout the Minecraft
protocol. Each byte uses 7 bits for data and 1 bit (MSB) as a continuation
flag. Values are encoded in little-endian order.
Functionsยง
- peek_
var_ int - Try to read a
VarIntfrom a byte slice without consuming it. ReturnsOk(Some((value, bytes_read)))on success,Ok(None)if not enough data is available, orErrif theVarIntis malformed. - read_
var_ int - Read a
VarIntfrom aBuf, returning the decoded i32. - var_
int_ bytes - Returns the number of bytes needed to encode a
VarIntvalue. - write_
var_ int - Write a
VarIntto aBufMut.