Struct ByteArrayDecoder

Source
pub struct ByteArrayDecoder<const N: usize> { /* private fields */ }

Implementations§

Source§

impl<const N: usize> ByteArrayDecoder<N>

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl<const N: usize> Debug for ByteArrayDecoder<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Decoder for ByteArrayDecoder<N>

Source§

type Value = [u8; N]

The type of value produced by this decoder.
Source§

type Error = UnexpectedEnd

Decoding error.
Source§

fn decode_chunk(&mut self, bytes: &mut &[u8]) -> Result<(), Self::Error>

Processes nex chunk of bytes and updates the cursor. Read more
Source§

fn end(self) -> Result<Self::Value, Self::Error>

Called when decoding has ended or there are no more bytes. Read more
Source§

fn bytes_received(&mut self, bytes: &[u8]) -> Result<usize, Self::Error>

Processes nex chunk of bytes without updating the cursor. Read more
Source§

fn then<R: Decoder, F: FnOnce(Self::Value) -> R>( self, fun: F, ) -> Then<Self, R, F>

Chains another decoder after this one finishes such that the value of this one is used to initialize the next one.
Source§

fn then_try<E, R: Decoder, F: FnOnce(Self::Value) -> Result<R, E>>( self, fun: F, ) -> ThenTry<E, Self, R, F>
where E: From<Self::Error> + From<R::Error>,

Chains another decoder after this one finishes such that the value of this one is used to initialize the next one. Read more
Source§

fn chain<D: Decoder>(self, following: D) -> Chain<Self, D>

Chains another decoder after this one to decode two values.
Source§

fn take(&mut self) -> Result<Self::Value, Self::Error>
where Self: Default,

Resets the decoder returning the decoded value.
Source§

fn sub_decode<E, F: FnMut(Self::Error) -> E>( &mut self, bytes: &mut &[u8], map_err: F, ) -> ControlFlow<Result<(), E>, Self::Value>
where Self: Default,

Decodes a value from lower-level decoder. Read more
Source§

fn wrap_sub_decode<F: FnOnce() -> ControlFlow<Result<(), Self::Error>, Infallible>>( f: F, ) -> Result<(), Self::Error>

Helper for using sub_decode. Read more
Source§

impl<const N: usize> Default for ByteArrayDecoder<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<const N: usize> Freeze for ByteArrayDecoder<N>

§

impl<const N: usize> RefUnwindSafe for ByteArrayDecoder<N>

§

impl<const N: usize> Send for ByteArrayDecoder<N>

§

impl<const N: usize> Sync for ByteArrayDecoder<N>

§

impl<const N: usize> Unpin for ByteArrayDecoder<N>

§

impl<const N: usize> UnwindSafe for ByteArrayDecoder<N>

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.