[][src]Struct bytecodec::combinator::Length

pub struct Length<C> { /* fields omitted */ }

Combinator for consuming the specified number of bytes exactly.

This is created by calling {DecodeExt, EncodeExt}::length method.

Methods

impl<C> Length<C>[src]

pub fn expected_bytes(&self) -> u64[src]

Returns the number of bytes expected to be consumed for decoding an item.

pub fn set_expected_bytes(&mut self, bytes: u64) -> Result<()>[src]

Sets the number of bytes expected to be consumed for decoding an item.

Errors

If it is in the middle of decoding an item, it willl return an ErrorKind::IncompleteDecoding error.

pub fn remaining_bytes(&self) -> u64[src]

Returns the number of remaining bytes required to decode the next item.

pub fn inner_ref(&self) -> &C[src]

Returns a reference to the inner encoder or decoder.

pub fn inner_mut(&mut self) -> &mut C[src]

Returns a mutable reference to the inner encoder or decoder.

pub fn into_inner(self) -> C[src]

Takes ownership of this instance and returns the inner encoder or decoder.

Trait Implementations

impl<C: Debug> Debug for Length<C>[src]

impl<D: Decode> Decode for Length<D>[src]

type Item = D::Item

The type of items to be decoded.

impl<C: Default> Default for Length<C>[src]

impl<E: Encode> Encode for Length<E>[src]

type Item = E::Item

The type of items to be encoded.

impl<E: Encode> SizedEncode for Length<E>[src]

Auto Trait Implementations

impl<C> RefUnwindSafe for Length<C> where
    C: RefUnwindSafe

impl<C> Send for Length<C> where
    C: Send

impl<C> Sync for Length<C> where
    C: Sync

impl<C> Unpin for Length<C> where
    C: Unpin

impl<C> UnwindSafe for Length<C> where
    C: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IoDecodeExt for T where
    T: Decode
[src]

impl<T> IoEncodeExt for T where
    T: Encode
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.