Module infinite_rs::common::extensions
source · Expand description
Extensions to BufReader.
Implements read_cstring and read_fixed_string that are not present in the regular BufReader.
read_cstring:Given a buffer, reads a character until0x00is encountered (null termination), returns theStringcollected. Errors when given invalid UTF-8.read_fixed_string:Given a buffer and size, reads characters and collects them into aStringabd returns it. Ignores unknown UTF-8 encoding, errors out when encountering end-of-file or other IO related errors.read_enumerable:Reads a type that implements the “Readable” trait, which reads the typecounttimes, accumulating the results into a Vec of the type. The type of which to read must be specified as a generic.
These functions are implemented as traits in generics. Requires <Read + Seek> to be satisfied.
Traits§
- Extension trait for BufReader to add custom reading methods.
- “Readable” trait that makes sure a “read” method is declared.