Struct bytecodec::bytes::Utf8Decoder [] [src]

pub struct Utf8Decoder<D = RemainingBytesDecoder>(_);

Utf8Decoder decodes Rust strings from a input byte sequence.

Examples

use bytecodec::{Decode, Eos};
use bytecodec::bytes::Utf8Decoder;

let mut decoder = Utf8Decoder::new();

let (_, item) = decoder.decode(b"foo", Eos::new(true)).unwrap();
assert_eq!(item, Some("foo".to_owned()));

Methods

impl Utf8Decoder<RemainingBytesDecoder>
[src]

[src]

Makes a new Utf8Decoder that uses RemainingBytesDecoder as the internal bytes decoder.

impl<D> Utf8Decoder<D> where
    D: Decode<Item = Vec<u8>>, 
[src]

[src]

Makes a new Utf8Decoder with the given bytes decoder.

Important traits for &'a mut W
[src]

Returns a reference to the inner bytes decoder.

Important traits for &'a mut W
[src]

Returns a mutable reference to the inner bytes decoder.

[src]

Takes ownership of this instance and returns the inner bytes decoder.

Trait Implementations

impl<D: Debug> Debug for Utf8Decoder<D>
[src]

[src]

Formats the value using the given formatter. Read more

impl<D: Default> Default for Utf8Decoder<D>
[src]

[src]

Returns the "default value" for a type. Read more

impl<D> Decode for Utf8Decoder<D> where
    D: Decode<Item = Vec<u8>>, 
[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 the lower bound of the number of bytes needed to decode the next item. Read more

Auto Trait Implementations

impl<D> Send for Utf8Decoder<D> where
    D: Send

impl<D> Sync for Utf8Decoder<D> where
    D: Sync