Struct bytecodec::value::DecodedValue
[−]
[src]
pub struct DecodedValue<T>(_);
DecodedValue
represents an already decoded item.
It does not consume any bytes, and returns the given item when decode()
was first called.
Examples
use bytecodec::{Decode, Eos}; use bytecodec::value::DecodedValue; let mut decoder = DecodedValue::new(10); let (size, item) = decoder.decode(b"foo", Eos::new(false)).unwrap(); assert_eq!(item, Some(10)); assert_eq!(size, 0);
Methods
impl<T> DecodedValue<T>
[src]
Trait Implementations
impl<T: Debug> Debug for DecodedValue<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T> Decode for DecodedValue<T>
[src]
type Item = T
The type of items to be decoded.
fn decode(
&mut self,
_buf: &[u8],
_eos: Eos
) -> Result<(usize, Option<Self::Item>)>
[src]
&mut self,
_buf: &[u8],
_eos: Eos
) -> Result<(usize, Option<Self::Item>)>
Consumes the given buffer (a part of a byte sequence), and decodes an item from it. Read more
fn has_terminated(&self) -> bool
[src]
Returns true
if the decoder cannot decode items anymore, otherwise false
. Read more
fn requiring_bytes(&self) -> ByteCount
[src]
Returns the lower bound of the number of bytes needed to decode the next item. Read more
Auto Trait Implementations
impl<T> Send for DecodedValue<T> where
T: Send,
T: Send,
impl<T> Sync for DecodedValue<T> where
T: Sync,
T: Sync,