pub struct RawReader<'a> { /* private fields */ }
Expand description
Helper to easily read binary values from an u8-slice, triggering EncodingError on out-of-bounds errors.
Implementations
sourceimpl<'a> RawReader<'a>
impl<'a> RawReader<'a>
pub fn with(data: &'a [u8]) -> Self
pub fn read_u8(&mut self) -> Result<u8, EncodingError>
pub fn read_i64(&mut self, len: usize) -> Result<i64, EncodingError>
pub fn read_var_u64(&mut self) -> Result<u64, EncodingError>
pub fn read_var_i64(&mut self) -> Result<i64, EncodingError>
pub fn read_bytes(&mut self, len: usize) -> Result<&'a [u8], EncodingError>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn read_f32(&mut self) -> Result<f32, EncodingError>
pub fn read_f64(&mut self) -> Result<f64, EncodingError>
pub fn read_var_string(&mut self) -> Result<&'a [u8], EncodingError>
pub fn skip(&mut self, length: usize) -> Result<(), EncodingError>
pub fn data(&self) -> &'a [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn truncate(&mut self, max: usize)
Trait Implementations
impl<'a> Copy for RawReader<'a>
impl<'a> Eq for RawReader<'a>
impl<'a> StructuralEq for RawReader<'a>
impl<'a> StructuralPartialEq for RawReader<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for RawReader<'a>
impl<'a> Send for RawReader<'a>
impl<'a> Sync for RawReader<'a>
impl<'a> Unpin for RawReader<'a>
impl<'a> UnwindSafe for RawReader<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
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.
sourcefn clone_into(&self, target: &mut T)
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