pub struct MessageDecoder<A: Attribute> { /* private fields */ }
Expand description

Message decoder.

Implementations§

source§

impl<A: Attribute> MessageDecoder<A>

source

pub fn new() -> Self

Makes a new MessageDecoder instance.

Trait Implementations§

source§

impl<A: Debug + Attribute> Debug for MessageDecoder<A>

source§

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

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

impl<A: Attribute> Decode for MessageDecoder<A>

§

type Item = Result<Message<A>, BrokenMessage>

The type of items to be decoded.
source§

fn decode(&mut self, buf: &[u8], eos: Eos) -> Result<usize>

Consumes the given buffer (a part of a byte sequence), and proceeds the decoding process. Read more
source§

fn finish_decoding(&mut self) -> Result<Self::Item>

Finishes the current decoding process and returns the decoded item. Read more
source§

fn requiring_bytes(&self) -> ByteCount

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

fn is_idle(&self) -> bool

Returns true if there are no items to be decoded by the decoder at the next invocation of decode method, otherwise false. Read more
source§

impl<A: Attribute> Default for MessageDecoder<A>

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<A> Freeze for MessageDecoder<A>
where A: Clone, <A as Attribute>::Decoder: Freeze,

§

impl<A> !RefUnwindSafe for MessageDecoder<A>

§

impl<A> Send for MessageDecoder<A>
where A: Clone + Send, <A as Attribute>::Decoder: Send,

§

impl<A> Sync for MessageDecoder<A>
where A: Clone + Sync, <A as Attribute>::Decoder: Sync,

§

impl<A> Unpin for MessageDecoder<A>
where A: Clone + Unpin, <A as Attribute>::Decoder: Unpin,

§

impl<A> !UnwindSafe for MessageDecoder<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> DecodeExt for T
where T: Decode,

source§

fn map<T, F>(self, f: F) -> Map<Self, T, F>
where F: Fn(Self::Item) -> T,

Creates a decoder that converts decoded values by calling the given function. Read more
source§

fn try_map<T, E, F>(self, f: F) -> TryMap<Self, T, E, F>
where F: Fn(Self::Item) -> Result<T, E>, Error: From<E>,

Creates a decoder that tries to convert decoded values by calling the given function. Read more
source§

fn map_err<E, F>(self, f: F) -> MapErr<Self, E, F>
where F: Fn(Error) -> E, Error: From<E>,

Creates a decoder for modifying decoding errors produced by self. Read more
source§

fn and_then<D, F>(self, f: F) -> AndThen<Self, D, F>
where F: Fn(Self::Item) -> D, D: Decode,

Creates a decoder that enables conditional decoding. Read more
source§

fn collect<T>(self) -> Collect<Self, T>
where T: Extend<Self::Item> + Default,

Creates a decoder for collecting decoded items. Read more
source§

fn collectn<T>(self, n: usize) -> CollectN<Self, T>
where T: Extend<Self::Item> + Default,

Creates a decoder that decodes n items by using self and collecting the result. Read more
source§

fn length(self, expected_bytes: u64) -> Length<Self>

Creates a decoder that consumes the specified number of bytes exactly. Read more
source§

fn omit(self, do_omit: bool) -> Omittable<Self>

Creates a decoder that will omit decoding items if do_omit = true is specified. Read more
source§

fn max_bytes(self, bytes: u64) -> MaxBytes<Self>

Creates a decoder that will fail if the number of consumed bytes exceeds bytes. Read more
source§

fn chain<T>(self, other: T) -> TupleDecoder<(Self, T)>
where T: Decode,

Takes two decoders and creates a new decoder that decodes both items in sequence. Read more
source§

fn slice(self) -> Slice<Self>

Creates a decoder that makes it possible to slice the input byte sequence in arbitrary units. Read more
source§

fn peekable(self) -> Peekable<Self>

Creates a decoder that enables to peek decoded items before calling finish_decoding method. Read more
source§

fn maybe_eos(self) -> MaybeEos<Self>

Creates a decoder that ignores EOS if there is no item being decoded. Read more
source§

fn decode_from_bytes(&mut self, buf: &[u8]) -> Result<Self::Item, Error>

Decodes an item by consuming the whole part of the given bytes. 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> IoDecodeExt for T
where T: Decode,

source§

fn decode_from_read_buf<B>(&mut self, buf: &mut ReadBuf<B>) -> Result<(), Error>
where B: AsRef<[u8]>,

Consumes bytes from the given read buffer and proceeds the decoding process.
source§

fn decode_exact<R>(&mut self, reader: R) -> Result<Self::Item, Error>
where R: Read,

Decodes an item from the given reader. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.