Struct binary_reader::BinaryReader
source · [−]pub struct BinaryReader {
pub data: Vec<u8>,
pub pos: usize,
pub length: usize,
pub endian: Endian,
}Expand description
Binary reader.
Fields
data: Vec<u8>The buffer data.
pos: usizeThe current position.
length: usizeThe length of the buffer.
endian: EndianThe endian of the buffer.
Implementations
sourceimpl BinaryReader
impl BinaryReader
sourcepub fn from_file(file: &mut File) -> BinaryReader
pub fn from_file(file: &mut File) -> BinaryReader
Initialize BinaryReader from std::fs::File.
sourcepub fn set_endian(&mut self, endian: Endian)
pub fn set_endian(&mut self, endian: Endian)
Set endian for read method.
pub fn adv(&mut self, size: usize)
pub fn align(&mut self, size: usize)
sourcepub fn read_bytes(&mut self, bytes: usize) -> Result<&[u8]>
pub fn read_bytes(&mut self, bytes: usize) -> Result<&[u8]>
Read provided length size bytes.
Similar to BinaryReader::read but this returns std::io::Result instead of Option.
Trait Implementations
sourceimpl Clone for BinaryReader
impl Clone for BinaryReader
sourcefn clone(&self) -> BinaryReader
fn clone(&self) -> BinaryReader
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl RefUnwindSafe for BinaryReader
impl Send for BinaryReader
impl Sync for BinaryReader
impl Unpin for BinaryReader
impl UnwindSafe for BinaryReader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more