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]

[src]

Makes a new DecodedValue instance.

Trait Implementations

impl<T: Debug> Debug for DecodedValue<T>
[src]

[src]

Formats the value using the given formatter. Read more

impl<T> Decode for DecodedValue<T>
[src]

The type of items to be decoded.

[src]

Consumes the given buffer (a part of a byte sequence), and decodes an item from it. Read more

[src]

Returns true if the decoder cannot decode items anymore, otherwise false. Read more

[src]

Returns true if the decoder does not have an item that being decoded, otherwise false.

[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

impl<T> Sync for DecodedValue<T> where
    T: Sync