Struct async_codec_util::decoder::DecodeExact
[−]
[src]
pub struct DecodeExact<D> { /* fields omitted */ }
Wraps a decoder and emits an error if it does not stop encoding at exactly the specified byte count.
Methods
impl<D> DecodeExact<D>
[src]
pub fn new(dec: D, target: usize) -> DecodeExact<D>
[src]
Create a new DecodeExact
, delegating to the given dec
and checking that it decodes
exactly target
bytes.
Trait Implementations
impl<D> AsyncDecode for DecodeExact<D> where
D: AsyncDecode,
[src]
D: AsyncDecode,
type Item = D::Item
The type of the value to decode.
type Error = DecodeExactError<D::Error, D::Item>
An error indicating how decoding can fail.
fn poll_decode<R: AsyncRead>(
self,
cx: &mut Context,
reader: &mut R
) -> PollDec<Self::Item, Self, Self::Error>
[src]
self,
cx: &mut Context,
reader: &mut R
) -> PollDec<Self::Item, Self, Self::Error>
Call reader.poll_read
exactly once, propgating any Err
and Pending
, and return how many bytes have been read, as well as the decoded value, once decoding is done. Read more
Auto Trait Implementations
impl<D> Send for DecodeExact<D> where
D: Send,
D: Send,
impl<D> Sync for DecodeExact<D> where
D: Sync,
D: Sync,