Struct bytecodec::combinator::Buffered
[−]
[src]
pub struct Buffered<D: Decode> { /* fields omitted */ }
Combinator that gives a buffer to the decoder.
Thsi is created by calling DecodeExt::buffer
method.
Methods
impl<D: Decode> Buffered<D>
[src]
pub fn has_item(&self) -> bool
[src]
Returns true
if the decoder has a decoded item, other false
.
Note that the decoder cannot decode new items if this method returns true
.
pub fn get_item(&self) -> Option<&D::Item>
[src]
Returns a reference to the item decoded by the decoder in the last decode
call.
pub fn take_item(&mut self) -> Option<D::Item>
[src]
Takes the item decoded by the decoder in the last decode
call.
Trait Implementations
impl<D: Decode + Debug> Debug for Buffered<D>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<D: Decode + Default> Default for Buffered<D>
[src]
impl<D: Decode> Decode for Buffered<D>
[src]
type Item = D::Item
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