Skip to main content

VarIntReader

Trait VarIntReader 

Source
pub trait VarIntReader {
    // Required method
    fn read_varint<VI: VarInt>(&mut self) -> Result<VI>;
}
Expand description

A trait for reading VarInts from any other Reader.

It’s recommended to use a buffered reader, as many small reads will happen.

Required Methods§

Source

fn read_varint<VI: VarInt>(&mut self) -> Result<VI>

Returns either the decoded integer, or an error.

In general, this always reads a whole varint. If the encoded varint’s value is bigger than the valid value range of VI, then the value is truncated.

On EOF, an io::Error with io::ErrorKind::UnexpectedEof is returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<R: Read> VarIntReader for R