summaryrefslogtreecommitdiffstats
path: root/tokio-io/src/codec/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio-io/src/codec/mod.rs')
-rw-r--r--tokio-io/src/codec/mod.rs55
1 files changed, 26 insertions, 29 deletions
diff --git a/tokio-io/src/codec/mod.rs b/tokio-io/src/codec/mod.rs
index 66368217..20bac082 100644
--- a/tokio-io/src/codec/mod.rs
+++ b/tokio-io/src/codec/mod.rs
@@ -27,10 +27,9 @@ pub use self::bytes_codec::BytesCodec;
pub use self::decoder::Decoder;
pub use self::encoder::Encoder;
pub use self::lines_codec::LinesCodec;
-
-pub use framed::{Framed, FramedParts};
-pub use framed_read::FramedRead;
-pub use framed_write::FramedWrite;
+pub use crate::framed::{Framed, FramedParts};
+pub use crate::framed_read::FramedRead;
+pub use crate::framed_write::FramedWrite;
#[deprecated(since = "0.1.8", note = "Moved to tokio-codec")]
#[doc(hidden)]
@@ -74,10 +73,6 @@ pub mod length_delimited {
//! Specifically, given the following:
//!
//! ```
- //! # extern crate tokio_io;
- //! # extern crate bytes;
- //! # extern crate futures;
- //! #
//! use tokio_io::{AsyncRead, AsyncWrite};
//! use tokio_io::codec::length_delimited;
//! use bytes::BytesMut;
@@ -89,8 +84,6 @@ pub mod length_delimited {
//!
//! transport.send(frame).wait().unwrap();
//! }
- //! #
- //! # pub fn main() {}
//! ```
//!
//! The encoded frame will look like this:
@@ -115,8 +108,9 @@ pub mod length_delimited {
//! frame head in the yielded `BytesMut`.
//!
//! ```
- //! # use tokio_io::AsyncRead;
- //! # use tokio_io::codec::length_delimited;
+ //! use tokio_io::AsyncRead;
+ //! use tokio_io::codec::length_delimited;
+ //!
//! # fn bind_read<T: AsyncRead>(io: T) {
//! length_delimited::Builder::new()
//! .length_field_offset(0) // default value
@@ -148,8 +142,9 @@ pub mod length_delimited {
//! frame head in the yielded `BytesMut`.
//!
//! ```
- //! # use tokio_io::AsyncRead;
- //! # use tokio_io::codec::length_delimited;
+ //! use tokio_io::AsyncRead;
+ //! use tokio_io::codec::length_delimited;
+ //!
//! # fn bind_read<T: AsyncRead>(io: T) {
//! length_delimited::Builder::new()
//! .length_field_offset(0) // default value
@@ -179,8 +174,9 @@ pub mod length_delimited {
//! **includes** the frame head length.
//!
//! ```
- //! # use tokio_io::AsyncRead;
- //! # use tokio_io::codec::length_delimited;
+ //! use tokio_io::AsyncRead;
+ //! use tokio_io::codec::length_delimited;
+ //!
//! # fn bind_read<T: AsyncRead>(io: T) {
//! length_delimited::Builder::new()
//! .length_field_offset(0) // default value
@@ -212,8 +208,9 @@ pub mod length_delimited {
//! frame head, including the frame head in the yielded `BytesMut`.
//!
//! ```
- //! # use tokio_io::AsyncRead;
- //! # use tokio_io::codec::length_delimited;
+ //! use tokio_io::AsyncRead;
+ //! use tokio_io::codec::length_delimited;
+ //!
//! # fn bind_read<T: AsyncRead>(io: T) {
//! length_delimited::Builder::new()
//! .length_field_offset(0) // default value
@@ -255,8 +252,9 @@ pub mod length_delimited {
//! included.
//!
//! ```
- //! # use tokio_io::AsyncRead;
- //! # use tokio_io::codec::length_delimited;
+ //! use tokio_io::AsyncRead;
+ //! use tokio_io::codec::length_delimited;
+ //!
//! # fn bind_read<T: AsyncRead>(io: T) {
//! length_delimited::Builder::new()
//! .length_field_offset(1) // length of hdr1
@@ -300,8 +298,9 @@ pub mod length_delimited {
//! length.
//!
//! ```
- //! # use tokio_io::AsyncRead;
- //! # use tokio_io::codec::length_delimited;
+ //! use tokio_io::AsyncRead;
+ //! use tokio_io::codec::length_delimited;
+ //!
//! # fn bind_read<T: AsyncRead>(io: T) {
//! length_delimited::Builder::new()
//! .length_field_offset(1) // length of hdr1
@@ -345,18 +344,16 @@ pub mod length_delimited {
//! configuration:
//!
//! ```
- //! # extern crate tokio_io;
- //! # extern crate bytes;
- //! # use tokio_io::AsyncWrite;
- //! # use tokio_io::codec::length_delimited;
- //! # use bytes::BytesMut;
+ //! use tokio_io::AsyncWrite;
+ //! use tokio_io::codec::length_delimited;
+ //! use bytes::BytesMut;
+ //!
//! # fn write_frame<T: AsyncWrite>(io: T) {
//! # let _: length_delimited::FramedWrite<T, BytesMut> =
//! length_delimited::Builder::new()
//! .length_field_length(2)
//! .new_write(io);
//! # }
- //! # pub fn main() {}
//! ```
//!
//! A payload of `hello world` will be encoded as:
@@ -374,5 +371,5 @@ pub mod length_delimited {
//! [`Encoder`]: ../trait.Encoder.html
//! [`BytesMut`]: https://docs.rs/bytes/0.4/bytes/struct.BytesMut.html
- pub use length_delimited::*;
+ pub use crate::length_delimited::*;
}