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

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]

[src]

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

[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::Other error.

[src]

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

Important traits for &'a mut W
[src]

Returns a reference to the inner encoder or decoder.

Important traits for &'a mut W
[src]

Returns a mutable reference to the inner encoder or decoder.

[src]

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

Trait Implementations

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

[src]

Formats the value using the given formatter. Read more

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

[src]

Returns the "default value" for a type. Read more

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

The type of items to be decoded.

[src]

Consumes the given buffer (a part of a byte sequence), and decodes an item from it. Read more

[src]

Returns the lower bound of the number of bytes needed to decode the next item. Read more

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

The type of items to be encoded.

[src]

Encodes the items in the encoder and writes the encoded bytes to the given buffer. Read more

[src]

Tries to start encoding the given item. Read more

[src]

Returns the number of bytes required to encode all the items in the encoder. Read more

[src]

Returns true if there are no items to be encoded in the encoder, otherwise false.

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

[src]

Returns the exact number of bytes required to encode all the items remaining in the encoder.

Auto Trait Implementations

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

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