[][src]Crate futures_codec

Utilities for encoding and decoding frames using async/await.

Contains adapters to go from streams of bytes, AsyncRead and AsyncWrite, to framed streams implementing Sink and Stream. Framed streams are also known as transports.

use futures_codec::{LinesCodec, Framed};

async move {
    // let stream = ...
    let mut framed = Framed::new(stream, LinesCodec {});

    while let Some(line) = await!(framed.try_next()).unwrap() {
        println!("{:?}", line);
    }
};

Structs

BytesCodec

A simple codec that ships bytes around

Framed

A unified Stream and Sink interface to an underlying I/O object, using the Encoder and Decoder traits to encode and decode frames.

FramedRead

A Stream of messages decoded from an AsyncRead.

FramedWrite

A Sink of frames encoded to an AsyncWrite.

LinesCodec

A simple Codec implementation that splits up data into lines.

Traits

Decoder

Decoding of frames via buffers, for use with FramedRead.

Encoder

Encoding of messages as bytes, for use with FramedWrite.