byte_transcoder::reader

Struct ByteReader

source
pub struct ByteReader<'a> { /* private fields */ }

Implementations§

source§

impl<'a> ByteReader<'a>

source

pub fn new(data: &'a [u8]) -> Self

source

pub fn read_u8(&mut self) -> ByteReaderResult<u8>

§Errors

Will return an error if there are not enough bytes to read.

source

pub fn read_u16(&mut self) -> ByteReaderResult<u16>

§Errors

Will return an error if there are not enough bytes to read.

source

pub fn read_u32(&mut self) -> ByteReaderResult<u32>

§Errors

Will return an error if there are not enough bytes to read.

source

pub fn read_u64(&mut self) -> ByteReaderResult<u64>

§Errors

Will return an error if there are not enough bytes to read.

source

pub fn read_string(&mut self) -> ByteReaderResult<String>

§Errors

Will return an error if there are not enough bytes to read or if the UTF-8 bytes are invalid.

source

pub fn read_uuid(&mut self) -> ByteReaderResult<Uuid>

§Errors

Will return an error if there are not enough bytes to read or if the UUID bytes are invalid.

source

pub fn read_remaining_bytes(&mut self) -> Vec<u8>

source

pub fn is_empty(&self) -> bool

source

pub fn remaining(&self) -> usize

Auto Trait Implementations§

§

impl<'a> Freeze for ByteReader<'a>

§

impl<'a> RefUnwindSafe for ByteReader<'a>

§

impl<'a> Send for ByteReader<'a>

§

impl<'a> Sync for ByteReader<'a>

§

impl<'a> Unpin for ByteReader<'a>

§

impl<'a> UnwindSafe for ByteReader<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.