Struct bytecodec::DecodedValue
[−]
[src]
pub struct DecodedValue<T>(_);
DecodedValue represents a decoded item.
It does not consume any bytes, and returns the given item when decode() was first called.
Examples
use bytecodec::{Decode, DecodeBuf, DecodedValue}; let mut decoder = DecodedValue::new(10); let mut input = DecodeBuf::new(b"foo"); let item = decoder.decode(&mut input).unwrap(); assert_eq!(item, Some(10)); assert_eq!(input.len(), 3);
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: &mut DecodeBuf) -> Result<Option<Self::Item>>[src]
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 is_idle(&self) -> bool[src]
Returns true if the decoder does not have an item that being decoded, otherwise false.
fn requiring_bytes_hint(&self) -> Option<u64>[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,