Struct binary_stream::BinaryReader
source · pub struct BinaryReader<'a> { /* private fields */ }
Expand description
Read from a stream.
Implementations§
source§impl<'a> BinaryReader<'a>
impl<'a> BinaryReader<'a>
sourcepub fn new(stream: &'a mut dyn ReadStream, endian: Endian) -> Self
pub fn new(stream: &'a mut dyn ReadStream, endian: Endian) -> Self
Create a binary reader with the given endianness.
sourcepub fn read_string(&mut self) -> BinaryResult<String>
pub fn read_string(&mut self) -> BinaryResult<String>
Read a length-prefixed String
from the stream.
sourcepub fn read_char(&mut self) -> BinaryResult<char>
pub fn read_char(&mut self) -> BinaryResult<char>
Read a character from the stream.
sourcepub fn read_bool(&mut self) -> BinaryResult<bool>
pub fn read_bool(&mut self) -> BinaryResult<bool>
Read a bool
from the stream.
sourcepub fn read_f32(&mut self) -> BinaryResult<f32>
pub fn read_f32(&mut self) -> BinaryResult<f32>
Read a f32
from the stream.
sourcepub fn read_f64(&mut self) -> BinaryResult<f64>
pub fn read_f64(&mut self) -> BinaryResult<f64>
Read a f64
from the stream.
sourcepub fn read_isize(&mut self) -> BinaryResult<isize>
pub fn read_isize(&mut self) -> BinaryResult<isize>
Read an isize
from the stream.
sourcepub fn read_usize(&mut self) -> BinaryResult<usize>
pub fn read_usize(&mut self) -> BinaryResult<usize>
Read a usize
from the stream.
sourcepub fn read_u64(&mut self) -> BinaryResult<u64>
pub fn read_u64(&mut self) -> BinaryResult<u64>
Read a u64
from the stream.
sourcepub fn read_i64(&mut self) -> BinaryResult<i64>
pub fn read_i64(&mut self) -> BinaryResult<i64>
Read an i64
from the stream.
sourcepub fn read_u128(&mut self) -> BinaryResult<u128>
pub fn read_u128(&mut self) -> BinaryResult<u128>
Read a u128
from the stream.
sourcepub fn read_i128(&mut self) -> BinaryResult<i128>
pub fn read_i128(&mut self) -> BinaryResult<i128>
Read an i128
from the stream.
sourcepub fn read_u32(&mut self) -> BinaryResult<u32>
pub fn read_u32(&mut self) -> BinaryResult<u32>
Read a u32
from the stream.
sourcepub fn read_i32(&mut self) -> BinaryResult<i32>
pub fn read_i32(&mut self) -> BinaryResult<i32>
Read an i32
from the stream.
sourcepub fn read_u16(&mut self) -> BinaryResult<u16>
pub fn read_u16(&mut self) -> BinaryResult<u16>
Read a u16
from the stream.
sourcepub fn read_i16(&mut self) -> BinaryResult<i16>
pub fn read_i16(&mut self) -> BinaryResult<i16>
Read an i16
from the stream.
sourcepub fn read_u8(&mut self) -> BinaryResult<u8>
pub fn read_u8(&mut self) -> BinaryResult<u8>
Read a u8
from the stream.
sourcepub fn read_i8(&mut self) -> BinaryResult<i8>
pub fn read_i8(&mut self) -> BinaryResult<i8>
Read an i8
from the stream.
sourcepub fn read_bytes(&mut self, length: usize) -> BinaryResult<Vec<u8>>
pub fn read_bytes(&mut self, length: usize) -> BinaryResult<Vec<u8>>
Read bytes from the stream into a buffer.