logo
pub async fn read_varint(
    socket: &'_ mut impl AsyncRead + Unpin
) -> Result<usize, Error>
Expand description

Reads a variable-length integer from the socket.

As a special exception, if the socket is empty and EOFs right at the beginning, then we return Ok(0).

Note: This function reads bytes one by one from the socket. It is therefore encouraged to use some sort of buffering mechanism.