Struct bytecodec::StartEncoderChain [] [src]

pub struct StartEncoderChain;

An object for starting a chain of encoders.

Examples

use bytecodec::{Encode, EncodeExt, StartEncoderChain};
use bytecodec::bytes::Utf8Encoder;
use bytecodec::fixnum::U8Encoder;
use bytecodec::io::IoEncodeExt;

let mut output = Vec::new();
let mut encoder = StartEncoderChain
    .chain(U8Encoder::new())
    .chain(Utf8Encoder::new())
    .map_from(|s: String| (s.len() as u8, s));
encoder.start_encoding("foo".to_owned()).unwrap();
encoder.encode_all(&mut output).unwrap();
assert_eq!(output, b"\x03foo");

Methods

impl StartEncoderChain
[src]

[src]

Starts encoders chain.

Trait Implementations

impl Debug for StartEncoderChain
[src]

[src]

Formats the value using the given formatter. Read more

impl Encode for StartEncoderChain
[src]

The type of items to be encoded.

[src]

Encodes the items in the encoder and writes the encoded bytes to the given buffer. Read more

[src]

Tries to start encoding the given item. Read more

[src]

Returns true if there are no items to be encoded in the encoder, otherwise false.

[src]

Returns the number of bytes required to encode all the items in the encoder. Read more

impl ExactBytesEncode for StartEncoderChain
[src]

[src]

Returns the exact number of bytes required to encode all the items remaining in the encoder.

Auto Trait Implementations