mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
io: move into tokio
crate (#1691)
A step towards collapsing Tokio sub crates into a single `tokio` crate (#1318). The `io` implementation is now provided by the main `tokio` crate. Functionality can be opted out of by using the various net related feature flags.
This commit is contained in:
parent
227533d456
commit
987ba7373c
@ -3,7 +3,6 @@
|
||||
members = [
|
||||
"tokio",
|
||||
"tokio-executor",
|
||||
"tokio-io",
|
||||
"tokio-macros",
|
||||
"tokio-sync",
|
||||
"tokio-test",
|
||||
|
@ -28,6 +28,7 @@ jobs:
|
||||
tokio:
|
||||
- fs
|
||||
- io
|
||||
- io-util
|
||||
- net-driver
|
||||
- process
|
||||
- rt-full
|
||||
@ -49,8 +50,6 @@ jobs:
|
||||
tokio-executor:
|
||||
- current-thread
|
||||
- thread-pool
|
||||
tokio-io:
|
||||
- util
|
||||
tokio-sync:
|
||||
- async-traits
|
||||
tokio-macros: []
|
||||
|
@ -3,7 +3,6 @@
|
||||
[patch.crates-io]
|
||||
tokio = { path = "tokio" }
|
||||
tokio-executor = { path = "tokio-executor" }
|
||||
tokio-io = { path = "tokio-io" }
|
||||
tokio-macros = { path = "tokio-macros" }
|
||||
tokio-sync = { path = "tokio-sync" }
|
||||
tokio-tls = { path = "tokio-tls" }
|
||||
|
@ -1,97 +0,0 @@
|
||||
# 0.2.0-alpha.6 (September 30, 2019)
|
||||
|
||||
- Move to `futures-*-preview 0.3.0-alpha.19`
|
||||
- Move to `pin-project 0.4`
|
||||
|
||||
# 0.2.0-alpha.5 (September 19, 2019)
|
||||
|
||||
### Added
|
||||
- bring back generic `split` utility (#1521).
|
||||
- enable buffering both reads and writes (#1558).
|
||||
|
||||
# 0.2.0-alpha.4 (August 29, 2019)
|
||||
|
||||
- Track tokio release.
|
||||
|
||||
# 0.2.0-alpha.3 (August 28, 2019)
|
||||
|
||||
### Added
|
||||
- `AsyncReadExt::chain` and `AsyncReadExt::take` (#1484).
|
||||
|
||||
# 0.2.0-alpha.2 (August 17, 2019)
|
||||
|
||||
### Changed
|
||||
- Update `futures` dependency to 0.3.0-alpha.18.
|
||||
|
||||
### Added
|
||||
- Implement `AsyncWrite` for `Vec<u8>` (#1409).
|
||||
- Add `BufReader`, `BufWriter` (#1438).
|
||||
|
||||
# 0.2.0-alpha.1 (August 8, 2019)
|
||||
|
||||
### Changed
|
||||
- Switch to `async`, `await`, and `std::future`.
|
||||
|
||||
# 0.1.12 (March 1, 2019)
|
||||
|
||||
### Added
|
||||
- Add `unsplit` to join previously split `AsyncRead + AsyncWrite` (#807).
|
||||
|
||||
# 0.1.11 (January 6, 2019)
|
||||
|
||||
* Fix minor error in Decoder::decode API documentation (#797).
|
||||
|
||||
# 0.1.10 (October 23, 2018)
|
||||
|
||||
* Expose inner codec from `Framed` (#686).
|
||||
* Implement AsyncRead::prepare_uninitialized_buffer for Take and Chain (#678).
|
||||
|
||||
# 0.1.9 (September 27, 2018)
|
||||
|
||||
* Fix bug in `AsyncRead::split()` (#655).
|
||||
* Fix non-terminating loop in `length_delimited::FramedWrite` (#576).
|
||||
|
||||
# 0.1.8 (August 23, 2018)
|
||||
|
||||
* Documentation improvements
|
||||
|
||||
# 0.1.7 (June 13, 2018)
|
||||
|
||||
* Move `codec::{Encode, Decode, Framed*}` into `tokio-codec` (#353)
|
||||
|
||||
# 0.1.6 (March 09, 2018)
|
||||
|
||||
* Add native endian builder fn to length_delimited (#144)
|
||||
* Add AsyncRead::poll_read, AsyncWrite::poll_write (#170)
|
||||
|
||||
# 0.1.5 (February 07, 2018)
|
||||
|
||||
* Fix bug in `BytesCodec` and `LinesCodec`.
|
||||
* Performance improvement to `split`.
|
||||
|
||||
# 0.1.4 (November 10, 2017)
|
||||
|
||||
* Use `FrameTooBig` as length delimited error type (#70).
|
||||
* Provide `Bytes` and `Lines` codecs (#78).
|
||||
* Provide `AllowStdIo` wrapper (#76).
|
||||
|
||||
# 0.1.3 (August 14, 2017)
|
||||
|
||||
* Fix bug involving zero sized writes in copy helper (#57).
|
||||
* Add get / set accessors for length delimited max frame length setting. (#65).
|
||||
* Add `Framed::into_parts_and_codec` (#59).
|
||||
|
||||
# 0.1.2 (May 23, 2017)
|
||||
|
||||
* Add `from_parts` and `into_parts` to the framing combinators.
|
||||
* Support passing an initialized buffer to the framing combinators.
|
||||
* Add `length_adjustment` support to length delimited encoding (#48).
|
||||
|
||||
# 0.1.1 (March 22, 2017)
|
||||
|
||||
* Add some omitted `Self: Sized` bounds.
|
||||
* Add missing "inner" fns.
|
||||
|
||||
# 0.1.0 (March 15, 2017)
|
||||
|
||||
* Initial release
|
@ -1,39 +0,0 @@
|
||||
[package]
|
||||
name = "tokio-io"
|
||||
# When releasing to crates.io:
|
||||
# - Remove path dependencies
|
||||
# - Update html_root_url.
|
||||
# - Update doc url
|
||||
# - Cargo.toml
|
||||
# - Update CHANGELOG.md.
|
||||
# - Create "v0.1.x" git tag.
|
||||
version = "0.2.0-alpha.6"
|
||||
edition = "2018"
|
||||
authors = ["Tokio Contributors <team@tokio.rs>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tokio-rs/tokio"
|
||||
homepage = "https://tokio.rs"
|
||||
documentation = "https://docs.rs/tokio-io/0.2.0-alpha.6/tokio_io"
|
||||
description = """
|
||||
Core I/O primitives for asynchronous I/O in Rust.
|
||||
"""
|
||||
categories = ["asynchronous"]
|
||||
|
||||
[features]
|
||||
util = ["memchr", "pin-project"]
|
||||
|
||||
[dependencies]
|
||||
bytes = "0.4.7"
|
||||
log = "0.4"
|
||||
futures-core-preview = "=0.3.0-alpha.19"
|
||||
memchr = { version = "2.2", optional = true }
|
||||
pin-project = { version = "0.4", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "=0.2.0-alpha.6", path = "../tokio" }
|
||||
tokio-test = { version = "=0.2.0-alpha.6", path = "../tokio-test" }
|
||||
|
||||
futures-util-preview = "=0.3.0-alpha.19"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
@ -1,25 +0,0 @@
|
||||
Copyright (c) 2019 Tokio Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
@ -1,13 +0,0 @@
|
||||
# tokio-io
|
||||
|
||||
Core I/O abstractions for the Tokio stack.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the [MIT license](LICENSE).
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in Tokio by you, shall be licensed as MIT, without any additional
|
||||
terms or conditions.
|
@ -1,47 +0,0 @@
|
||||
#![doc(html_root_url = "https://docs.rs/tokio-io/0.2.0-alpha.6")]
|
||||
#![warn(
|
||||
missing_debug_implementations,
|
||||
missing_docs,
|
||||
rust_2018_idioms,
|
||||
unreachable_pub
|
||||
)]
|
||||
#![deny(intra_doc_link_resolution_failure)]
|
||||
#![doc(test(
|
||||
no_crate_inject,
|
||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
||||
))]
|
||||
|
||||
//! Core I/O traits and combinators when working with Tokio.
|
||||
//!
|
||||
//! A description of the high-level I/O combinators can be [found online] in
|
||||
//! addition to a description of the [low level details].
|
||||
//!
|
||||
//! [found online]: https://tokio.rs/docs/
|
||||
//! [low level details]: https://tokio.rs/docs/going-deeper-tokio/core-low-level/
|
||||
|
||||
mod async_buf_read;
|
||||
mod async_read;
|
||||
mod async_write;
|
||||
|
||||
#[cfg(feature = "util")]
|
||||
mod io;
|
||||
|
||||
#[cfg(feature = "util")]
|
||||
pub mod split;
|
||||
|
||||
pub use self::async_buf_read::AsyncBufRead;
|
||||
pub use self::async_read::AsyncRead;
|
||||
pub use self::async_write::AsyncWrite;
|
||||
|
||||
#[cfg(feature = "util")]
|
||||
pub use self::io::{
|
||||
copy, empty, repeat, sink, AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader, BufStream,
|
||||
BufWriter, Copy, Empty, Repeat, Sink, Take,
|
||||
};
|
||||
|
||||
// Re-export `Buf` and `BufMut` since they are part of the API
|
||||
pub use bytes::{Buf, BufMut};
|
||||
|
||||
#[cfg(feature = "util")]
|
||||
#[cfg(test)]
|
||||
fn is_unpin<T: Unpin>() {}
|
@ -22,9 +22,9 @@ categories = ["asynchronous", "testing"]
|
||||
[dependencies]
|
||||
tokio = { version = "=0.2.0-alpha.6", path = "../tokio" }
|
||||
tokio-executor = { version = "=0.2.0-alpha.6", path = "../tokio-executor" }
|
||||
tokio-io = { version = "=0.2.0-alpha.6", path = "../tokio-io" }
|
||||
tokio-sync = { version = "=0.2.0-alpha.6", path = "../tokio-sync" }
|
||||
|
||||
bytes = "0.4"
|
||||
futures-core-preview = "=0.3.0-alpha.19"
|
||||
pin-convert = "0.1.0"
|
||||
|
||||
|
@ -16,10 +16,11 @@
|
||||
//! [`AsyncRead`]: tokio_io::AsyncRead
|
||||
//! [`AsyncWrite`]: tokio_io::AsyncWrite
|
||||
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::timer::{clock, timer, Delay};
|
||||
use tokio_io::{AsyncRead, AsyncWrite, Buf};
|
||||
use tokio_sync::mpsc;
|
||||
|
||||
use bytes::Buf;
|
||||
use futures_core::ready;
|
||||
use std::collections::VecDeque;
|
||||
use std::future::Future;
|
||||
|
@ -26,7 +26,7 @@ travis-ci = { repository = "tokio-rs/tokio-tls" }
|
||||
|
||||
[dependencies]
|
||||
native-tls = "0.2"
|
||||
tokio-io = { version = "=0.2.0-alpha.6", path = "../tokio-io" }
|
||||
tokio = { version = "=0.2.0-alpha.6", path = "../tokio", features = ["io-traits"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "=0.2.0-alpha.6", path = "../tokio" }
|
||||
|
@ -28,6 +28,8 @@
|
||||
//! built. Configuration of TLS parameters is still primarily done through the
|
||||
//! `native-tls` crate.
|
||||
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use native_tls::{Error, HandshakeError, MidHandshakeTlsStream};
|
||||
use std::fmt;
|
||||
use std::future::Future;
|
||||
@ -36,7 +38,6 @@ use std::marker::Unpin;
|
||||
use std::pin::Pin;
|
||||
use std::ptr::null_mut;
|
||||
use std::task::{Context, Poll};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct AllowStd<S> {
|
||||
|
@ -20,7 +20,6 @@ Additional utilities for working with Tokio.
|
||||
categories = ["asynchronous"]
|
||||
|
||||
[dependencies]
|
||||
tokio-io = { version = "=0.2.0-alpha.6", path = "../tokio-io" }
|
||||
tokio = { version = "=0.2.0-alpha.6", path = "../tokio" }
|
||||
|
||||
bytes = "0.4.7"
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::codec::encoder::Encoder;
|
||||
use crate::codec::Framed;
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use bytes::BytesMut;
|
||||
use std::io;
|
||||
|
@ -3,7 +3,7 @@ use crate::codec::encoder::Encoder;
|
||||
use crate::codec::framed_read::{framed_read2, framed_read2_with_buffer, FramedRead2};
|
||||
use crate::codec::framed_write::{framed_write2, framed_write2_with_buffer, FramedWrite2};
|
||||
|
||||
use tokio_io::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
use tokio::io::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
|
||||
use bytes::BytesMut;
|
||||
use futures_core::Stream;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::codec::framed::Fuse;
|
||||
use crate::codec::Decoder;
|
||||
|
||||
use tokio_io::AsyncRead;
|
||||
use tokio::io::AsyncRead;
|
||||
|
||||
use bytes::BytesMut;
|
||||
use futures_core::Stream;
|
||||
|
@ -2,7 +2,7 @@ use crate::codec::decoder::Decoder;
|
||||
use crate::codec::encoder::Encoder;
|
||||
use crate::codec::framed::Fuse;
|
||||
|
||||
use tokio_io::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
use tokio::io::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
|
||||
use bytes::BytesMut;
|
||||
use futures_core::{ready, Stream};
|
||||
|
@ -15,7 +15,7 @@
|
||||
//! byte stream into a stream of frames.
|
||||
//!
|
||||
//! ```
|
||||
//! use tokio_io::{AsyncRead, AsyncWrite};
|
||||
//! use tokio::io::{AsyncRead, AsyncWrite};
|
||||
//! use tokio_util::codec::{Framed, LengthDelimitedCodec};
|
||||
//!
|
||||
//! fn bind_transport<T: AsyncRead + AsyncWrite>(io: T)
|
||||
@ -78,7 +78,7 @@
|
||||
//! frame head in the yielded `BytesMut`.
|
||||
//!
|
||||
//! ```
|
||||
//! # use tokio_io::AsyncRead;
|
||||
//! # use tokio::io::AsyncRead;
|
||||
//! # use tokio_util::codec::LengthDelimitedCodec;
|
||||
//! # fn bind_read<T: AsyncRead>(io: T) {
|
||||
//! LengthDelimitedCodec::builder()
|
||||
@ -112,7 +112,7 @@
|
||||
//! frame head in the yielded `BytesMut`.
|
||||
//!
|
||||
//! ```
|
||||
//! # use tokio_io::AsyncRead;
|
||||
//! # use tokio::io::AsyncRead;
|
||||
//! # use tokio_util::codec::LengthDelimitedCodec;
|
||||
//! # fn bind_read<T: AsyncRead>(io: T) {
|
||||
//! LengthDelimitedCodec::builder()
|
||||
@ -144,7 +144,7 @@
|
||||
//! **includes** the frame head length.
|
||||
//!
|
||||
//! ```
|
||||
//! # use tokio_io::AsyncRead;
|
||||
//! # use tokio::io::AsyncRead;
|
||||
//! # use tokio_util::codec::LengthDelimitedCodec;
|
||||
//! # fn bind_read<T: AsyncRead>(io: T) {
|
||||
//! LengthDelimitedCodec::builder()
|
||||
@ -178,7 +178,7 @@
|
||||
//! frame head, including the frame head in the yielded `BytesMut`.
|
||||
//!
|
||||
//! ```
|
||||
//! # use tokio_io::AsyncRead;
|
||||
//! # use tokio::io::AsyncRead;
|
||||
//! # use tokio_util::codec::LengthDelimitedCodec;
|
||||
//! # fn bind_read<T: AsyncRead>(io: T) {
|
||||
//! LengthDelimitedCodec::builder()
|
||||
@ -222,7 +222,7 @@
|
||||
//! included.
|
||||
//!
|
||||
//! ```
|
||||
//! # use tokio_io::AsyncRead;
|
||||
//! # use tokio::io::AsyncRead;
|
||||
//! # use tokio_util::codec::LengthDelimitedCodec;
|
||||
//! # fn bind_read<T: AsyncRead>(io: T) {
|
||||
//! LengthDelimitedCodec::builder()
|
||||
@ -268,7 +268,7 @@
|
||||
//! length.
|
||||
//!
|
||||
//! ```
|
||||
//! # use tokio_io::AsyncRead;
|
||||
//! # use tokio::io::AsyncRead;
|
||||
//! # use tokio_util::codec::LengthDelimitedCodec;
|
||||
//! # fn bind_read<T: AsyncRead>(io: T) {
|
||||
//! LengthDelimitedCodec::builder()
|
||||
@ -313,7 +313,7 @@
|
||||
//! configuration:
|
||||
//!
|
||||
//! ```
|
||||
//! # use tokio_io::AsyncWrite;
|
||||
//! # use tokio::io::AsyncWrite;
|
||||
//! # use tokio_util::codec::LengthDelimitedCodec;
|
||||
//! # fn write_frame<T: AsyncWrite>(io: T) {
|
||||
//! # let _ =
|
||||
@ -342,7 +342,7 @@
|
||||
|
||||
use crate::codec::{Decoder, Encoder, Framed, FramedRead, FramedWrite};
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use bytes::{Buf, BufMut, Bytes, BytesMut, IntoBuf};
|
||||
use std::error::Error as StdError;
|
||||
@ -605,7 +605,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -649,7 +649,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -673,7 +673,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -697,7 +697,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -731,7 +731,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -755,7 +755,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -778,7 +778,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -799,7 +799,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -823,7 +823,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -865,7 +865,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncRead;
|
||||
/// # use tokio::io::AsyncRead;
|
||||
/// use tokio_util::codec::LengthDelimitedCodec;
|
||||
///
|
||||
/// # fn bind_read<T: AsyncRead>(io: T) {
|
||||
@ -890,7 +890,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::AsyncWrite;
|
||||
/// # use tokio::io::AsyncWrite;
|
||||
/// # use tokio_util::codec::LengthDelimitedCodec;
|
||||
/// # fn write_frame<T: AsyncWrite>(io: T) {
|
||||
/// LengthDelimitedCodec::builder()
|
||||
@ -911,7 +911,7 @@ impl Builder {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::{AsyncRead, AsyncWrite};
|
||||
/// # use tokio::io::{AsyncRead, AsyncWrite};
|
||||
/// # use tokio_util::codec::LengthDelimitedCodec;
|
||||
/// # fn write_frame<T: AsyncRead + AsyncWrite>(io: T) {
|
||||
/// # let _ =
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::AsyncWrite;
|
||||
use tokio::io::AsyncWrite;
|
||||
use tokio_test::assert_ready;
|
||||
use tokio_test::task::MockTask;
|
||||
use tokio_util::codec::{Encoder, FramedWrite};
|
||||
|
@ -36,7 +36,9 @@ default = [
|
||||
]
|
||||
|
||||
fs = ["tokio-executor/blocking"]
|
||||
io = ["tokio-io", "bytes", "iovec"]
|
||||
io-traits = ["bytes", "iovec"]
|
||||
io-util = ["io-traits", "pin-project", "memchr"]
|
||||
io = ["io-traits", "io-util"]
|
||||
macros = ["tokio-macros"]
|
||||
net-full = ["tcp", "udp", "uds"]
|
||||
net-driver = ["mio", "tokio-executor/blocking"]
|
||||
@ -87,11 +89,12 @@ bytes = { version = "0.4", optional = true }
|
||||
crossbeam-utils = { version = "0.6.0", optional = true }
|
||||
iovec = { version = "0.1", optional = true }
|
||||
lazy_static = { version = "1.0.2", optional = true }
|
||||
memchr = { version = "2.2", optional = true }
|
||||
mio = { version = "0.6.14", optional = true }
|
||||
num_cpus = { version = "1.8.0", optional = true }
|
||||
pin-project = { version = "0.4", optional = true }
|
||||
# Backs `DelayQueue`
|
||||
slab = { version = "0.4.1", optional = true }
|
||||
tokio-io = { version = "=0.2.0-alpha.6", optional = true, features = ["util"], path = "../tokio-io" }
|
||||
tokio-executor = { version = "=0.2.0-alpha.6", optional = true, path = "../tokio-executor" }
|
||||
tokio-macros = { version = "=0.2.0-alpha.6", optional = true, path = "../tokio-macros" }
|
||||
tokio-sync = { version = "=0.2.0-alpha.6", optional = true, path = "../tokio-sync", features = ["async-traits"] }
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::fs::sys;
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use futures_core::ready;
|
||||
use std::cmp;
|
||||
|
@ -5,8 +5,7 @@
|
||||
use self::State::*;
|
||||
use crate::fs::blocking::Buf;
|
||||
use crate::fs::{asyncify, sys};
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use futures_core::ready;
|
||||
use std::fmt;
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncRead;
|
||||
use crate::io::AsyncRead;
|
||||
|
||||
use std::io;
|
||||
use std::ops::DerefMut;
|
||||
use std::pin::Pin;
|
@ -1,5 +1,3 @@
|
||||
//use crate::split::{ReadHalf, WriteHalf};
|
||||
//use crate::{framed, split, AsyncWrite};
|
||||
use bytes::BufMut;
|
||||
use futures_core::ready;
|
||||
use std::io;
|
@ -1,8 +1,8 @@
|
||||
use crate::io::lines::{lines, Lines};
|
||||
use crate::io::read_line::{read_line, ReadLine};
|
||||
use crate::io::read_until::{read_until, ReadUntil};
|
||||
use crate::io::split::{split, Split};
|
||||
use crate::AsyncBufRead;
|
||||
use crate::io::io::lines::{lines, Lines};
|
||||
use crate::io::io::read_line::{read_line, ReadLine};
|
||||
use crate::io::io::read_until::{read_until, ReadUntil};
|
||||
use crate::io::io::split::{split, Split};
|
||||
use crate::io::AsyncBufRead;
|
||||
|
||||
/// An extension trait which adds utility methods to `AsyncBufRead` types.
|
||||
pub trait AsyncBufReadExt: AsyncBufRead {
|
@ -1,11 +1,11 @@
|
||||
use crate::io::chain::{chain, Chain};
|
||||
use crate::io::copy::{copy, Copy};
|
||||
use crate::io::read::{read, Read};
|
||||
use crate::io::read_exact::{read_exact, ReadExact};
|
||||
use crate::io::read_to_end::{read_to_end, ReadToEnd};
|
||||
use crate::io::read_to_string::{read_to_string, ReadToString};
|
||||
use crate::io::take::{take, Take};
|
||||
use crate::{AsyncRead, AsyncWrite};
|
||||
use crate::io::io::chain::{chain, Chain};
|
||||
use crate::io::io::copy::{copy, Copy};
|
||||
use crate::io::io::read::{read, Read};
|
||||
use crate::io::io::read_exact::{read_exact, ReadExact};
|
||||
use crate::io::io::read_to_end::{read_to_end, ReadToEnd};
|
||||
use crate::io::io::read_to_string::{read_to_string, ReadToString};
|
||||
use crate::io::io::take::{take, Take};
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
/// An extension trait which adds utility methods to `AsyncRead` types.
|
||||
pub trait AsyncReadExt: AsyncRead {
|
@ -1,8 +1,8 @@
|
||||
use crate::io::flush::{flush, Flush};
|
||||
use crate::io::shutdown::{shutdown, Shutdown};
|
||||
use crate::io::write::{write, Write};
|
||||
use crate::io::write_all::{write_all, WriteAll};
|
||||
use crate::AsyncWrite;
|
||||
use crate::io::io::flush::{flush, Flush};
|
||||
use crate::io::io::shutdown::{shutdown, Shutdown};
|
||||
use crate::io::io::write::{write, Write};
|
||||
use crate::io::io::write_all::{write_all, WriteAll};
|
||||
use crate::io::AsyncWrite;
|
||||
|
||||
/// An extension trait which adds utility methods to `AsyncWrite` types.
|
||||
pub trait AsyncWriteExt: AsyncWrite {
|
@ -1,5 +1,6 @@
|
||||
use super::DEFAULT_BUF_SIZE;
|
||||
use crate::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
use crate::io::io::DEFAULT_BUF_SIZE;
|
||||
use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
|
||||
use futures_core::ready;
|
||||
use pin_project::{pin_project, project};
|
||||
use std::io::{self, Read};
|
@ -1,5 +1,6 @@
|
||||
use crate::io::{BufReader, BufWriter};
|
||||
use crate::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
use crate::io::io::{BufReader, BufWriter};
|
||||
use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
|
||||
use pin_project::pin_project;
|
||||
use std::io::{self};
|
||||
use std::{
|
@ -1,5 +1,6 @@
|
||||
use super::DEFAULT_BUF_SIZE;
|
||||
use crate::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
use crate::io::io::DEFAULT_BUF_SIZE;
|
||||
use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
|
||||
use futures_core::ready;
|
||||
use pin_project::{pin_project, project};
|
||||
use std::fmt;
|
@ -1,4 +1,5 @@
|
||||
use crate::{AsyncBufRead, AsyncRead};
|
||||
use crate::io::{AsyncBufRead, AsyncRead};
|
||||
|
||||
use futures_core::ready;
|
||||
use pin_project::{pin_project, project};
|
||||
use std::fmt;
|
@ -1,4 +1,5 @@
|
||||
use crate::{AsyncRead, AsyncWrite};
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use futures_core::ready;
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
@ -43,7 +44,7 @@ pub struct Copy<'a, R: ?Sized, W: ?Sized> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use tokio_io as io;
|
||||
/// use tokio::io;
|
||||
///
|
||||
/// # async fn dox() -> std::io::Result<()> {
|
||||
/// let mut reader: &[u8] = b"hello";
|
@ -1,4 +1,5 @@
|
||||
use crate::{AsyncBufRead, AsyncRead};
|
||||
use crate::io::{AsyncBufRead, AsyncRead};
|
||||
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
@ -28,7 +29,7 @@ pub struct Empty {
|
||||
/// A slightly sad example of not reading anything into a buffer:
|
||||
///
|
||||
/// ```rust
|
||||
/// # use tokio_io::{self as io, AsyncReadExt};
|
||||
/// # use tokio::io::{self, AsyncReadExt};
|
||||
/// # async fn dox() {
|
||||
/// let mut buffer = String::new();
|
||||
/// io::empty().read_to_string(&mut buffer).await.unwrap();
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncWrite;
|
||||
use crate::io::AsyncWrite;
|
||||
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
@ -1,5 +1,5 @@
|
||||
use super::read_line::read_line_internal;
|
||||
use crate::AsyncBufRead;
|
||||
use crate::io::io::read_line::read_line_internal;
|
||||
use crate::io::AsyncBufRead;
|
||||
|
||||
use futures_core::{ready, Stream};
|
||||
use pin_project::{pin_project, project};
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncRead;
|
||||
use crate::io::AsyncRead;
|
||||
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
use std::marker::Unpin;
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncRead;
|
||||
use crate::io::AsyncRead;
|
||||
|
||||
use futures_core::ready;
|
||||
use std::future::Future;
|
||||
use std::io;
|
@ -1,5 +1,6 @@
|
||||
use super::read_until::read_until_internal;
|
||||
use crate::AsyncBufRead;
|
||||
use crate::io::io::read_until::read_until_internal;
|
||||
use crate::io::AsyncBufRead;
|
||||
|
||||
use futures_core::ready;
|
||||
use std::future::Future;
|
||||
use std::io;
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncRead;
|
||||
use crate::io::AsyncRead;
|
||||
|
||||
use futures_core::ready;
|
||||
use std::future::Future;
|
||||
use std::io;
|
@ -1,5 +1,6 @@
|
||||
use super::read_to_end::read_to_end_internal;
|
||||
use crate::AsyncRead;
|
||||
use crate::io::io::read_to_end::read_to_end_internal;
|
||||
use crate::io::AsyncRead;
|
||||
|
||||
use futures_core::ready;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncBufRead;
|
||||
use crate::io::AsyncBufRead;
|
||||
|
||||
use futures_core::ready;
|
||||
use std::future::Future;
|
||||
use std::io;
|
@ -1,4 +1,4 @@
|
||||
use crate::AsyncRead;
|
||||
use crate::io::AsyncRead;
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
@ -29,7 +29,7 @@ pub struct Repeat {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use tokio_io::{self as io, AsyncReadExt};
|
||||
/// # use tokio::io::{self, AsyncReadExt};
|
||||
/// # async fn dox() {
|
||||
/// let mut buffer = [0; 3];
|
||||
/// io::repeat(0b101).read_exact(&mut buffer).await.unwrap();
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncWrite;
|
||||
use crate::io::AsyncWrite;
|
||||
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncWrite;
|
||||
use crate::io::AsyncWrite;
|
||||
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
@ -28,7 +29,7 @@ pub struct Sink {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// # use tokio_io::{self as io, AsyncWriteExt};
|
||||
/// # use tokio::io::{self, AsyncWriteExt};
|
||||
/// # async fn dox() {
|
||||
/// let buffer = vec![1, 2, 3, 5, 8];
|
||||
/// let num_bytes = io::sink().write(&buffer).await.unwrap();
|
@ -1,5 +1,5 @@
|
||||
use super::read_until::read_until_internal;
|
||||
use crate::AsyncBufRead;
|
||||
use crate::io::io::read_until::read_until_internal;
|
||||
use crate::io::AsyncBufRead;
|
||||
|
||||
use futures_core::{ready, Stream};
|
||||
use pin_project::{pin_project, project};
|
@ -1,4 +1,5 @@
|
||||
use crate::{AsyncBufRead, AsyncRead};
|
||||
use crate::io::{AsyncBufRead, AsyncRead};
|
||||
|
||||
use futures_core::ready;
|
||||
use pin_project::{pin_project, project};
|
||||
use std::pin::Pin;
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncWrite;
|
||||
use crate::io::AsyncWrite;
|
||||
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
@ -1,4 +1,5 @@
|
||||
use crate::AsyncWrite;
|
||||
use crate::io::AsyncWrite;
|
||||
|
||||
use futures_core::ready;
|
||||
use std::future::Future;
|
||||
use std::io;
|
@ -36,6 +36,29 @@
|
||||
//! [`ErrorKind`]: enum.ErrorKind.html
|
||||
//! [`Result`]: type.Result.html
|
||||
|
||||
mod async_buf_read;
|
||||
pub use self::async_buf_read::AsyncBufRead;
|
||||
|
||||
mod async_read;
|
||||
pub use self::async_read::AsyncRead;
|
||||
|
||||
mod async_write;
|
||||
pub use self::async_write::AsyncWrite;
|
||||
|
||||
#[allow(clippy::module_inception)] // TODO: remove
|
||||
#[cfg(feature = "io-util")]
|
||||
mod io;
|
||||
#[cfg(feature = "io-util")]
|
||||
pub use self::io::{
|
||||
copy, empty, repeat, sink, AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader, BufStream,
|
||||
BufWriter, Copy, Empty, Repeat, Sink, Take,
|
||||
};
|
||||
|
||||
#[cfg(feature = "io-util")]
|
||||
pub mod split;
|
||||
#[cfg(feature = "io-util")]
|
||||
pub use self::split::split;
|
||||
|
||||
// TODO: These should not be guarded by `fs`
|
||||
|
||||
#[cfg(feature = "fs")]
|
||||
@ -53,12 +76,7 @@ mod stdout;
|
||||
#[cfg(feature = "fs")]
|
||||
pub use self::stdout::{stdout, Stdout};
|
||||
|
||||
pub use tokio_io::split::split;
|
||||
pub use tokio_io::{
|
||||
empty, repeat, sink, AsyncBufRead, AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncWrite,
|
||||
AsyncWriteExt, BufReader, BufWriter, Empty, Repeat, Sink, Take,
|
||||
};
|
||||
|
||||
// Re-export io::Error so that users don't have to deal
|
||||
// with conflicts when `use`ing `tokio::io` and `std::io`.
|
||||
#[cfg(feature = "io-util")]
|
||||
pub use std::io::{Error, ErrorKind, Result};
|
||||
|
@ -4,7 +4,7 @@
|
||||
//! To restore this read/write object from its `split::ReadHalf` and
|
||||
//! `split::WriteHalf` use `unsplit`.
|
||||
|
||||
use crate::{AsyncRead, AsyncWrite};
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use bytes::{Buf, BufMut};
|
||||
use futures_core::ready;
|
@ -1,6 +1,5 @@
|
||||
use crate::fs::blocking::Blocking;
|
||||
|
||||
use tokio_io::AsyncWrite;
|
||||
use crate::io::AsyncWrite;
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::fs::blocking::Blocking;
|
||||
|
||||
use tokio_io::AsyncRead;
|
||||
use crate::io::AsyncRead;
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::fs::blocking::Blocking;
|
||||
|
||||
use tokio_io::AsyncWrite;
|
||||
use crate::io::AsyncWrite;
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
|
@ -129,3 +129,7 @@ if_runtime! {
|
||||
#[doc(inline)]
|
||||
pub use tokio_macros::test;
|
||||
}
|
||||
|
||||
#[cfg(feature = "io-util")]
|
||||
#[cfg(test)]
|
||||
fn is_unpin<T: Unpin>() {}
|
||||
|
@ -8,9 +8,8 @@
|
||||
//! split has no associated overhead and enforces all invariants at the type
|
||||
//! level.
|
||||
|
||||
use super::TcpStream;
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
use crate::net::TcpStream;
|
||||
|
||||
use bytes::{Buf, BufMut};
|
||||
use std::io;
|
||||
|
@ -1,9 +1,8 @@
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
use crate::net::tcp::split::{split, ReadHalf, WriteHalf};
|
||||
use crate::net::util::PollEvented;
|
||||
use crate::net::ToSocketAddrs;
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use bytes::{Buf, BufMut};
|
||||
use futures_core::ready;
|
||||
use futures_util::future::poll_fn;
|
||||
|
@ -8,9 +8,8 @@
|
||||
//! split has no associated overhead and enforces all invariants at the type
|
||||
//! level.
|
||||
|
||||
use super::UnixStream;
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
use crate::net::UnixStream;
|
||||
|
||||
use bytes::{Buf, BufMut};
|
||||
use std::io;
|
||||
|
@ -1,9 +1,8 @@
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
use crate::net::unix::split::{split, ReadHalf, WriteHalf};
|
||||
use crate::net::unix::ucred::{self, UCred};
|
||||
use crate::net::util::PollEvented;
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use bytes::{Buf, BufMut};
|
||||
use futures_core::ready;
|
||||
use futures_util::future::poll_fn;
|
||||
|
@ -1,9 +1,7 @@
|
||||
use crate::io::{AsyncRead, AsyncWrite};
|
||||
use crate::net::driver::{platform, Registration};
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use futures_core::ready;
|
||||
use mio;
|
||||
use mio::event::Evented;
|
||||
use std::fmt;
|
||||
use std::io::{self, Read, Write};
|
||||
|
@ -27,7 +27,7 @@ pub use futures_util::sink::SinkExt as _;
|
||||
pub use futures_util::stream::StreamExt as _;
|
||||
|
||||
#[cfg(feature = "io")]
|
||||
pub use tokio_io::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
pub use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite};
|
||||
#[cfg(feature = "io")]
|
||||
#[doc(no_inline)]
|
||||
pub use tokio_io::{AsyncBufReadExt as _, AsyncReadExt as _, AsyncWriteExt as _};
|
||||
pub use crate::io::{AsyncBufReadExt as _, AsyncReadExt as _, AsyncWriteExt as _};
|
||||
|
@ -107,6 +107,21 @@
|
||||
//! `tokio::process::Child` is dropped. The behavior of the standard library can
|
||||
//! be regained with the [`Child::forget`](crate::process::Child::forget) method.
|
||||
|
||||
#[path = "unix/mod.rs"]
|
||||
#[cfg(unix)]
|
||||
mod imp;
|
||||
|
||||
#[path = "windows.rs"]
|
||||
#[cfg(windows)]
|
||||
mod imp;
|
||||
|
||||
mod kill;
|
||||
|
||||
use crate::io::{AsyncRead, AsyncReadExt, AsyncWrite};
|
||||
use crate::process::kill::Kill;
|
||||
|
||||
use futures_core::TryFuture;
|
||||
use futures_util::try_future::try_join3;
|
||||
use std::ffi::OsStr;
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
@ -120,21 +135,6 @@ use std::process::{Command as StdCommand, ExitStatus, Output, Stdio};
|
||||
use std::task::Context;
|
||||
use std::task::Poll;
|
||||
|
||||
use self::kill::Kill;
|
||||
use futures_core::TryFuture;
|
||||
use futures_util::try_future::try_join3;
|
||||
use tokio_io::{AsyncRead, AsyncReadExt, AsyncWrite};
|
||||
|
||||
#[path = "unix/mod.rs"]
|
||||
#[cfg(unix)]
|
||||
mod imp;
|
||||
|
||||
#[path = "windows.rs"]
|
||||
#[cfg(windows)]
|
||||
mod imp;
|
||||
|
||||
mod kill;
|
||||
|
||||
/// This structure mimics the API of [`std::process::Command`] found in the standard library, but
|
||||
/// replaces functions that create a process with an asynchronous variant. The main provided
|
||||
/// asynchronous functions are [spawn](Command::spawn), [status](Command::status), and
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
#![cfg(unix)]
|
||||
|
||||
use super::registry::{globals, EventId, EventInfo, Globals, Init, Storage};
|
||||
use crate::io::AsyncRead;
|
||||
use crate::net::util::PollEvented;
|
||||
use crate::signal::registry::{globals, EventId, EventInfo, Globals, Init, Storage};
|
||||
|
||||
use tokio_io::AsyncRead;
|
||||
use tokio_sync::mpsc::{channel, Receiver};
|
||||
|
||||
use futures_core::stream::Stream;
|
||||
|
@ -30,6 +30,7 @@ pub(crate) mod fs {
|
||||
}
|
||||
use fs::sys;
|
||||
|
||||
use tokio::io;
|
||||
use tokio::prelude::*;
|
||||
use tokio_test::{assert_pending, assert_ready, assert_ready_err, assert_ready_ok, task};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use tokio_io::AsyncRead;
|
||||
use tokio::io::AsyncRead;
|
||||
use tokio_test::task::MockTask;
|
||||
use tokio_test::{assert_ready_err, assert_ready_ok};
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::AsyncReadExt;
|
||||
use tokio::io::AsyncReadExt;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
#[tokio::test]
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncReadExt};
|
||||
use tokio::io::{AsyncRead, AsyncReadExt};
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use std::io;
|
@ -1,9 +1,10 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use futures_util::StreamExt;
|
||||
use tokio_io::AsyncBufReadExt;
|
||||
use tokio::io::AsyncBufReadExt;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use futures_util::StreamExt;
|
||||
|
||||
#[tokio::test]
|
||||
async fn lines() {
|
||||
let rd: &[u8] = b"hello\r\nworld\n\n";
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::{AsyncRead, AsyncReadExt};
|
||||
use tokio::io::{AsyncRead, AsyncReadExt};
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use std::io;
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::AsyncReadExt;
|
||||
use tokio::io::AsyncReadExt;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
#[tokio::test]
|
@ -1,9 +1,10 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use std::io::Cursor;
|
||||
use tokio_io::AsyncBufReadExt;
|
||||
use tokio::io::AsyncBufReadExt;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use std::io::Cursor;
|
||||
|
||||
#[tokio::test]
|
||||
async fn read_line() {
|
||||
let mut buf = String::new();
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::AsyncReadExt;
|
||||
use tokio::io::AsyncReadExt;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
#[tokio::test]
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::AsyncReadExt;
|
||||
use tokio::io::AsyncReadExt;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
#[tokio::test]
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::AsyncBufReadExt;
|
||||
use tokio::io::AsyncBufReadExt;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
#[tokio::test]
|
@ -1,5 +1,5 @@
|
||||
use tokio::io::split::{ReadHalf, WriteHalf};
|
||||
use tokio::io::{split, AsyncRead, AsyncWrite};
|
||||
use tokio_io::split::{ReadHalf, WriteHalf};
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::AsyncReadExt;
|
||||
use tokio::io::AsyncReadExt;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
#[tokio::test]
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::{AsyncWrite, AsyncWriteExt};
|
||||
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use bytes::BytesMut;
|
@ -1,6 +1,6 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use tokio_io::{AsyncWrite, AsyncWriteExt};
|
||||
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use bytes::BytesMut;
|
Loading…
x
Reference in New Issue
Block a user