1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#![deny(missing_docs)] //! Utilities for encoding and decoding frames using `async/await`. //! //! Contains adapters to go from streams of bytes, [`AsyncRead`](futures::io::AsyncRead) //! and [`AsyncWrite`](futures::io::AsyncWrite), to framed streams implementing [`Sink`](futures::Sink) and [`Stream`](futures::Stream). //! Framed streams are also known as `transports`. //! //! ``` //! # #![feature(async_await)] //! # use futures::{executor, SinkExt, TryStreamExt}; //! # use futures::io::Cursor; //! use futures_codec::{LinesCodec, Framed}; //! //! async move { //! # let mut buf = vec![]; //! # let stream = Cursor::new(&mut buf); //! // let stream = ... //! let mut framed = Framed::new(stream, LinesCodec {}); //! //! while let Some(line) = framed.try_next().await.unwrap() { //! println!("{:?}", line); //! } //! }; //! ``` mod codec; pub use codec::{BytesCodec, LengthCodec, LinesCodec}; mod decoder; pub use decoder::Decoder; mod encoder; pub use encoder::Encoder; mod framed; pub use framed::Framed; mod framed_read; pub use framed_read::FramedRead; mod framed_write; pub use framed_write::FramedWrite; mod fuse;