pub struct DecodeExact<D> { /* private fields */ }
Expand description
Wraps a decoder and emits an error if it does not stop encoding at exactly the specified byte count.
Implementations§
Source§impl<D> DecodeExact<D>
impl<D> DecodeExact<D>
Sourcepub fn new(dec: D, target: usize) -> DecodeExact<D>
pub fn new(dec: D, target: usize) -> DecodeExact<D>
Create a new DecodeExact
, delegating to the given dec
and checking that it decodes
exactly target
bytes.
Trait Implementations§
Source§impl<D> AsyncDecode for DecodeExact<D>where
D: AsyncDecode,
impl<D> AsyncDecode for DecodeExact<D>where
D: AsyncDecode,
Source§type Item = <D as AsyncDecode>::Item
type Item = <D as AsyncDecode>::Item
The type of the value to decode.
Source§type Error = DecodeExactError<<D as AsyncDecode>::Error, <D as AsyncDecode>::Item>
type Error = DecodeExactError<<D as AsyncDecode>::Error, <D as AsyncDecode>::Item>
An error indicating how decoding can fail.
Auto Trait Implementations§
impl<D> Freeze for DecodeExact<D>where
D: Freeze,
impl<D> RefUnwindSafe for DecodeExact<D>where
D: RefUnwindSafe,
impl<D> Send for DecodeExact<D>where
D: Send,
impl<D> Sync for DecodeExact<D>where
D: Sync,
impl<D> Unpin for DecodeExact<D>where
D: Unpin,
impl<D> UnwindSafe for DecodeExact<D>where
D: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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