TurboBincodeReader

Struct TurboBincodeReader 

Source
pub struct TurboBincodeReader<'a> {
    pub buffer: &'a [u8],
}
Expand description

This is equivalent to bincode::de::read::SliceReader, but with a little unsafe code to avoid some redundant bounds checks, and pub access to the underlying buffer.

Fields§

§buffer: &'a [u8]

Implementations§

Source§

impl<'a> TurboBincodeReader<'a>

Source

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

Trait Implementations§

Source§

impl Reader for TurboBincodeReader<'_>

Source§

fn read(&mut self, target_buffer: &mut [u8]) -> Result<(), DecodeError>

Fill the given bytes argument with values. Exactly the length of the given slice must be filled, or else an error must be returned.
Source§

fn peek_read(&mut self, n: usize) -> Option<&[u8]>

If this reader wraps a buffer of any kind, this function lets callers access contents of the buffer without passing data through a buffer first.
Source§

fn consume(&mut self, n: usize)

If an implementation of peek_read is provided, an implementation of this function must be provided so that subsequent reads or peek-reads do not return the same bytes

Auto Trait Implementations§

§

impl<'a> Freeze for TurboBincodeReader<'a>

§

impl<'a> RefUnwindSafe for TurboBincodeReader<'a>

§

impl<'a> Send for TurboBincodeReader<'a>

§

impl<'a> Sync for TurboBincodeReader<'a>

§

impl<'a> Unpin for TurboBincodeReader<'a>

§

impl<'a> UnwindSafe for TurboBincodeReader<'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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.