mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
chore: remove tokio-futures facade crate (#1327)
This switches from using the tokio-futures facade to referencing futures-* crates directly.
This commit is contained in:
@@ -7,7 +7,6 @@ members = [
|
|||||||
"tokio-current-thread",
|
"tokio-current-thread",
|
||||||
"tokio-executor",
|
"tokio-executor",
|
||||||
"tokio-fs",
|
"tokio-fs",
|
||||||
"tokio-futures",
|
|
||||||
"tokio-io",
|
"tokio-io",
|
||||||
"tokio-macros",
|
"tokio-macros",
|
||||||
"tokio-reactor",
|
"tokio-reactor",
|
||||||
|
|||||||
@@ -139,8 +139,6 @@ The crates included as part of Tokio are:
|
|||||||
|
|
||||||
* [`tokio-fs`]: Filesystem (and standard in / out) APIs.
|
* [`tokio-fs`]: Filesystem (and standard in / out) APIs.
|
||||||
|
|
||||||
* [`tokio-futures`]: Experimental `std::future::Future` and `async` / `await` support.
|
|
||||||
|
|
||||||
* [`tokio-codec`]: Utilities for encoding and decoding protocol frames.
|
* [`tokio-codec`]: Utilities for encoding and decoding protocol frames.
|
||||||
|
|
||||||
* [`tokio-io`]: Asynchronous I/O related traits and utilities.
|
* [`tokio-io`]: Asynchronous I/O related traits and utilities.
|
||||||
@@ -166,7 +164,6 @@ The crates included as part of Tokio are:
|
|||||||
[`tokio-current-thread`]: tokio-current-thread
|
[`tokio-current-thread`]: tokio-current-thread
|
||||||
[`tokio-executor`]: tokio-executor
|
[`tokio-executor`]: tokio-executor
|
||||||
[`tokio-fs`]: tokio-fs
|
[`tokio-fs`]: tokio-fs
|
||||||
[`tokio-futures`]: tokio-futures
|
|
||||||
[`tokio-io`]: tokio-io
|
[`tokio-io`]: tokio-io
|
||||||
[`tokio-macros`]: tokio-macros
|
[`tokio-macros`]: tokio-macros
|
||||||
[`tokio-reactor`]: tokio-reactor
|
[`tokio-reactor`]: tokio-reactor
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ tokio-codec = { path = "tokio-codec" }
|
|||||||
tokio-current-thread = { path = "tokio-current-thread" }
|
tokio-current-thread = { path = "tokio-current-thread" }
|
||||||
tokio-executor = { path = "tokio-executor" }
|
tokio-executor = { path = "tokio-executor" }
|
||||||
tokio-fs = { path = "tokio-fs" }
|
tokio-fs = { path = "tokio-fs" }
|
||||||
tokio-futures = { path = "tokio-futures" }
|
|
||||||
tokio-io = { path = "tokio-io" }
|
tokio-io = { path = "tokio-io" }
|
||||||
tokio-reactor = { path = "tokio-reactor" }
|
tokio-reactor = { path = "tokio-reactor" }
|
||||||
tokio-signal = { path = "tokio-signal" }
|
tokio-signal = { path = "tokio-signal" }
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ publish = false
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
tokio-io = { version = "0.2.0", path = "../tokio-io" }
|
tokio-io = { version = "0.2.0", path = "../tokio-io" }
|
||||||
bytes = "0.4.7"
|
bytes = "0.4.7"
|
||||||
tokio-futures = { version = "0.2.0", path = "../tokio-futures" }
|
futures-core-preview = "0.3.0-alpha.17"
|
||||||
|
futures-sink-preview = "0.3.0-alpha.17"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use std::fmt;
|
|
||||||
use std::io::{self, Read, Write};
|
|
||||||
use std::pin::Pin;
|
|
||||||
use std::task::{Context, Poll};
|
|
||||||
|
|
||||||
use crate::decoder::Decoder;
|
use crate::decoder::Decoder;
|
||||||
use crate::encoder::Encoder;
|
use crate::encoder::Encoder;
|
||||||
use crate::framed_read::{framed_read2, framed_read2_with_buffer, FramedRead2};
|
use crate::framed_read::{framed_read2, framed_read2_with_buffer, FramedRead2};
|
||||||
use crate::framed_write::{framed_write2, framed_write2_with_buffer, FramedWrite2};
|
use crate::framed_write::{framed_write2, framed_write2_with_buffer, FramedWrite2};
|
||||||
use tokio_futures::{Sink, Stream};
|
|
||||||
use tokio_io::{AsyncRead, AsyncWrite};
|
use tokio_io::{AsyncRead, AsyncWrite};
|
||||||
|
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
|
use futures_core::Stream;
|
||||||
|
use futures_sink::Sink;
|
||||||
|
use std::fmt;
|
||||||
|
use std::io::{self, Read, Write};
|
||||||
|
use std::pin::Pin;
|
||||||
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
/// A unified `Stream` and `Sink` interface to an underlying I/O object, using
|
/// A unified `Stream` and `Sink` interface to an underlying I/O object, using
|
||||||
/// the `Encoder` and `Decoder` traits to encode and decode frames.
|
/// the `Encoder` and `Decoder` traits to encode and decode frames.
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
use std::fmt;
|
|
||||||
use std::pin::Pin;
|
|
||||||
use std::task::{Context, Poll};
|
|
||||||
|
|
||||||
use super::framed::Fuse;
|
use super::framed::Fuse;
|
||||||
use super::Decoder;
|
use super::Decoder;
|
||||||
use tokio_futures::{Sink, Stream};
|
|
||||||
use tokio_io::AsyncRead;
|
use tokio_io::AsyncRead;
|
||||||
|
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
|
use futures_core::Stream;
|
||||||
|
use futures_sink::Sink;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
use std::fmt;
|
||||||
|
use std::pin::Pin;
|
||||||
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
/// A `Stream` of messages decoded from an `AsyncRead`.
|
/// A `Stream` of messages decoded from an `AsyncRead`.
|
||||||
pub struct FramedRead<T, D> {
|
pub struct FramedRead<T, D> {
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use log::trace;
|
|
||||||
use std::fmt;
|
|
||||||
use std::io::{self, Read};
|
|
||||||
|
|
||||||
use super::framed::Fuse;
|
use super::framed::Fuse;
|
||||||
use crate::decoder::Decoder;
|
use crate::decoder::Decoder;
|
||||||
use crate::encoder::Encoder;
|
use crate::encoder::Encoder;
|
||||||
use tokio_futures::{Sink, Stream};
|
|
||||||
use tokio_io::{AsyncRead, AsyncWrite};
|
use tokio_io::{AsyncRead, AsyncWrite};
|
||||||
|
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
|
use futures_core::{ready, Stream};
|
||||||
|
use futures_sink::Sink;
|
||||||
|
use log::trace;
|
||||||
|
use std::fmt;
|
||||||
|
use std::io::{self, Read};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
@@ -208,7 +209,7 @@ where
|
|||||||
trace!("writing; remaining={}", pinned.buffer.len());
|
trace!("writing; remaining={}", pinned.buffer.len());
|
||||||
|
|
||||||
let buf = &pinned.buffer;
|
let buf = &pinned.buffer;
|
||||||
let n = try_ready!(pin!(pinned.inner).poll_write(cx, &buf));
|
let n = ready!(pin!(pinned.inner).poll_write(cx, &buf))?;
|
||||||
|
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return Poll::Ready(Err(io::Error::new(
|
return Poll::Ready(Err(io::Error::new(
|
||||||
@@ -224,15 +225,16 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try flushing the underlying IO
|
// Try flushing the underlying IO
|
||||||
try_ready!(pin!(pinned.inner).poll_flush(cx));
|
ready!(pin!(pinned.inner).poll_flush(cx))?;
|
||||||
|
|
||||||
trace!("framed transport flushed");
|
trace!("framed transport flushed");
|
||||||
Poll::Ready(Ok(()))
|
Poll::Ready(Ok(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
let () = try_ready!(pin!(self).poll_flush(cx));
|
ready!(pin!(self).poll_flush(cx))?;
|
||||||
let () = try_ready!(pin!(self.inner).poll_shutdown(cx));
|
ready!(pin!(self.inner).poll_shutdown(cx))?;
|
||||||
|
|
||||||
Poll::Ready(Ok(()))
|
Poll::Ready(Ok(()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,3 @@
|
|||||||
// TODO this macro should probably be somewhere in tokio-futures
|
|
||||||
/// A macro for extracting the successful type of a `Poll<T, E>`.
|
|
||||||
///
|
|
||||||
/// This macro bakes propagation of both errors and `Pending` signals by
|
|
||||||
/// returning early.
|
|
||||||
macro_rules! try_ready {
|
|
||||||
($e:expr) => {
|
|
||||||
match $e {
|
|
||||||
std::task::Poll::Pending => return std::task::Poll::Pending,
|
|
||||||
std::task::Poll::Ready(Err(e)) => return std::task::Poll::Ready(Err(From::from(e))),
|
|
||||||
std::task::Poll::Ready(Ok(t)) => t,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A macro to reduce some of the boilerplate for projecting from
|
/// A macro to reduce some of the boilerplate for projecting from
|
||||||
/// `Pin<&mut T>` to `Pin<&mut T.field>`
|
/// `Pin<&mut T>` to `Pin<&mut T.field>`
|
||||||
macro_rules! pin {
|
macro_rules! pin {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#![deny(warnings, rust_2018_idioms)]
|
#![deny(warnings, rust_2018_idioms)]
|
||||||
|
|
||||||
use bytes::{BufMut, BytesMut};
|
|
||||||
use std::collections::VecDeque;
|
|
||||||
use tokio_codec::{Encoder, FramedWrite};
|
use tokio_codec::{Encoder, FramedWrite};
|
||||||
use tokio_futures::Sink;
|
|
||||||
use tokio_io::AsyncWrite;
|
use tokio_io::AsyncWrite;
|
||||||
use tokio_test::assert_ready;
|
use tokio_test::assert_ready;
|
||||||
use tokio_test::task::MockTask;
|
use tokio_test::task::MockTask;
|
||||||
|
|
||||||
|
use bytes::{BufMut, BytesMut};
|
||||||
|
use futures_sink::Sink;
|
||||||
|
use std::collections::VecDeque;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::Poll::{Pending, Ready};
|
use std::task::Poll::{Pending, Ready};
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ publish = false
|
|||||||
futures-core-preview = "0.3.0-alpha.17"
|
futures-core-preview = "0.3.0-alpha.17"
|
||||||
tokio-threadpool = { version = "0.2.0", path = "../tokio-threadpool" }
|
tokio-threadpool = { version = "0.2.0", path = "../tokio-threadpool" }
|
||||||
tokio-io = { version = "0.2.0", path = "../tokio-io" }
|
tokio-io = { version = "0.2.0", path = "../tokio-io" }
|
||||||
tokio-futures = { version = "0.2.0", path = "../tokio-futures" }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use super::File;
|
use super::File;
|
||||||
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
use super::File;
|
use super::File;
|
||||||
|
|
||||||
|
use futures_core::ready;
|
||||||
use std::fs::File as StdFile;
|
use std::fs::File as StdFile;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
use super::File;
|
use super::File;
|
||||||
|
|
||||||
|
use futures_core::ready;
|
||||||
use std::fs::File as StdFile;
|
use std::fs::File as StdFile;
|
||||||
use std::fs::Metadata;
|
use std::fs::Metadata;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
|
|||||||
@@ -16,13 +16,14 @@ pub use self::open::OpenFuture;
|
|||||||
pub use self::open_options::OpenOptions;
|
pub use self::open_options::OpenOptions;
|
||||||
pub use self::seek::SeekFuture;
|
pub use self::seek::SeekFuture;
|
||||||
|
|
||||||
|
use tokio_io::{AsyncRead, AsyncWrite};
|
||||||
|
|
||||||
use std::fs::{File as StdFile, Metadata, Permissions};
|
use std::fs::{File as StdFile, Metadata, Permissions};
|
||||||
use std::io::{self, Read, Seek, Write};
|
use std::io::{self, Read, Seek, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::Context;
|
use std::task::Context;
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
use tokio_io::{AsyncRead, AsyncWrite};
|
|
||||||
|
|
||||||
/// A reference to an open file on the filesystem.
|
/// A reference to an open file on the filesystem.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
use super::File;
|
use super::File;
|
||||||
|
|
||||||
|
use futures_core::ready;
|
||||||
use std::fs::OpenOptions as StdOpenOptions;
|
use std::fs::OpenOptions as StdOpenOptions;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use super::OpenFuture;
|
use super::OpenFuture;
|
||||||
|
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
use std::fs::OpenOptions as StdOpenOptions;
|
use std::fs::OpenOptions as StdOpenOptions;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
use super::File;
|
use super::File;
|
||||||
|
|
||||||
|
use futures_core::ready;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
|||||||
@@ -30,9 +30,6 @@
|
|||||||
//! [`AsyncRead`]: https://docs.rs/tokio-io/0.1/tokio_io/trait.AsyncRead.html
|
//! [`AsyncRead`]: https://docs.rs/tokio-io/0.1/tokio_io/trait.AsyncRead.html
|
||||||
//! [tokio-threadpool]: https://docs.rs/tokio-threadpool/0.1/tokio_threadpool
|
//! [tokio-threadpool]: https://docs.rs/tokio-threadpool/0.1/tokio_threadpool
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate tokio_futures;
|
|
||||||
|
|
||||||
mod create_dir;
|
mod create_dir;
|
||||||
mod create_dir_all;
|
mod create_dir_all;
|
||||||
pub mod file;
|
pub mod file;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use super::blocking_io;
|
use super::blocking_io;
|
||||||
|
|
||||||
use std::fs::{self, Metadata};
|
use std::fs::{self, Metadata};
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
use crate::{file, File};
|
use crate::{file, File};
|
||||||
|
|
||||||
|
use tokio_io::AsyncRead;
|
||||||
|
|
||||||
|
use futures_core::ready;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::Context;
|
use std::task::Context;
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
use std::{io, mem, path::Path};
|
use std::{io, mem, path::Path};
|
||||||
use tokio_io;
|
|
||||||
use tokio_io::AsyncRead;
|
|
||||||
|
|
||||||
/// Creates a future which will open a file for reading and read the entire
|
/// Creates a future which will open a file for reading and read the entire
|
||||||
/// contents into a buffer and return said buffer.
|
/// contents into a buffer and return said buffer.
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
use tokio_io::AsyncWrite;
|
||||||
|
|
||||||
use std::io::{self, Stderr as StdStderr, Write};
|
use std::io::{self, Stderr as StdStderr, Write};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::Context;
|
use std::task::Context;
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
use tokio_io::AsyncWrite;
|
|
||||||
|
|
||||||
/// A handle to the standard error stream of a process.
|
/// A handle to the standard error stream of a process.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
use tokio_io::AsyncRead;
|
||||||
|
|
||||||
use std::io::{self, Read, Stdin as StdStdin};
|
use std::io::{self, Read, Stdin as StdStdin};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::Context;
|
use std::task::Context;
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
use tokio_io::AsyncRead;
|
|
||||||
|
|
||||||
/// A handle to the standard input stream of a process.
|
/// A handle to the standard input stream of a process.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
use tokio_io::AsyncWrite;
|
||||||
|
|
||||||
use std::io::{self, Stdout as StdStdout, Write};
|
use std::io::{self, Stdout as StdStdout, Write};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::Context;
|
use std::task::Context;
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
use tokio_io::AsyncWrite;
|
|
||||||
|
|
||||||
/// A handle to the standard output stream of a process.
|
/// A handle to the standard output stream of a process.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use super::blocking_io;
|
use super::blocking_io;
|
||||||
|
|
||||||
use std::fs::{self, Metadata};
|
use std::fs::{self, Metadata};
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
use crate::{file, File};
|
use crate::{file, File};
|
||||||
|
|
||||||
|
use tokio_io::AsyncWrite;
|
||||||
|
|
||||||
|
use futures_core::ready;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::Context;
|
use std::task::Context;
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
use std::{fmt, io, mem, path::Path};
|
use std::{fmt, io, mem, path::Path};
|
||||||
use tokio_io;
|
|
||||||
use tokio_io::AsyncWrite;
|
|
||||||
|
|
||||||
/// Creates a future that will open a file for writing and write the entire
|
/// Creates a future that will open a file for writing and write the entire
|
||||||
/// contents of `contents` to it.
|
/// contents of `contents` to it.
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tokio-futures"
|
|
||||||
|
|
||||||
# When releasing to crates.io:
|
|
||||||
# - Update html_root_url.
|
|
||||||
version = "0.2.0"
|
|
||||||
edition = "2018"
|
|
||||||
authors = ["Carl Lerche <[email protected]>"]
|
|
||||||
license = "MIT"
|
|
||||||
repository = "https://github.com/tokio-rs/tokio"
|
|
||||||
homepage = "https://tokio.rs"
|
|
||||||
documentation = "https://docs.rs/tokio-futures/0.1.0"
|
|
||||||
description = """
|
|
||||||
Utilities for working with futures, async, and await.
|
|
||||||
"""
|
|
||||||
categories = ["asynchronous"]
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[features]
|
|
||||||
all = []
|
|
||||||
default = [
|
|
||||||
"all",
|
|
||||||
]
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
futures-core-preview = "0.3.0-alpha.17"
|
|
||||||
futures-sink-preview = "0.3.0-alpha.17"
|
|
||||||
@@ -1,52 +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.
|
|
||||||
|
|
||||||
Copyright (c) 2016 futures-rs authors
|
|
||||||
|
|
||||||
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 Futures
|
|
||||||
|
|
||||||
Asynchronous 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,3 +0,0 @@
|
|||||||
//! Futures
|
|
||||||
|
|
||||||
pub use core::future::Future;
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#![doc(html_root_url = "https://docs.rs/tokio-futures/0.2.0")]
|
|
||||||
#![cfg(feature = "all")]
|
|
||||||
#![deny(missing_docs, missing_debug_implementations, rust_2018_idioms)]
|
|
||||||
#![cfg_attr(test, deny(warnings))]
|
|
||||||
|
|
||||||
//! Futures
|
|
||||||
|
|
||||||
pub mod future;
|
|
||||||
pub mod sink;
|
|
||||||
pub mod stream;
|
|
||||||
|
|
||||||
pub use crate::future::Future;
|
|
||||||
pub use crate::sink::Sink;
|
|
||||||
pub use crate::stream::Stream;
|
|
||||||
|
|
||||||
pub use futures_core::ready;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
//! Sinks
|
|
||||||
|
|
||||||
pub use futures_sink::Sink;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
//! Streams
|
|
||||||
|
|
||||||
pub use futures_core::stream::Stream;
|
|
||||||
@@ -22,13 +22,13 @@ categories = ["asynchronous"]
|
|||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
async-traits = ["tokio-futures"]
|
async-traits = ["futures-sink-preview"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-util = { git = "https://github.com/tokio-rs/async" }
|
async-util = { git = "https://github.com/tokio-rs/async" }
|
||||||
tokio-futures = { path = "../tokio-futures", optional = true }
|
|
||||||
fnv = "1.0.6"
|
fnv = "1.0.6"
|
||||||
futures-core-preview = { version = "0.3.0-alpha.17" }
|
futures-core-preview = { version = "0.3.0-alpha.17" }
|
||||||
|
futures-sink-preview = { version = "0.3.0-alpha.17", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = { version = "0.5", default-features = false }
|
env_logger = { version = "0.5", default-features = false }
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ impl<T> Sender<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async-traits")]
|
#[cfg(feature = "async-traits")]
|
||||||
impl<T> tokio_futures::Sink<T> for Sender<T> {
|
impl<T> futures_sink::Sink<T> for Sender<T> {
|
||||||
type Error = SendError;
|
type Error = SendError;
|
||||||
|
|
||||||
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ impl<T> UnboundedSender<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async-traits")]
|
#[cfg(feature = "async-traits")]
|
||||||
impl<T> tokio_futures::Sink<T> for UnboundedSender<T> {
|
impl<T> futures_sink::Sink<T> for UnboundedSender<T> {
|
||||||
type Error = UnboundedSendError;
|
type Error = UnboundedSendError;
|
||||||
|
|
||||||
fn poll_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ impl<T> Sender<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async-traits")]
|
#[cfg(feature = "async-traits")]
|
||||||
impl<T> tokio_futures::Sink<T> for Sender<T> {
|
impl<T> futures_sink::Sink<T> for Sender<T> {
|
||||||
type Error = error::SendError<T>;
|
type Error = error::SendError<T>;
|
||||||
|
|
||||||
fn poll_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ async fn async_send_recv_with_buffer() {
|
|||||||
#[cfg(feature = "async-traits")]
|
#[cfg(feature = "async-traits")]
|
||||||
fn send_sink_recv_with_buffer() {
|
fn send_sink_recv_with_buffer() {
|
||||||
use futures_core::Stream;
|
use futures_core::Stream;
|
||||||
|
use futures_sink::Sink;
|
||||||
use pin_utils::pin_mut;
|
use pin_utils::pin_mut;
|
||||||
use tokio_futures::Sink;
|
|
||||||
|
|
||||||
let mut t1 = MockTask::new();
|
let mut t1 = MockTask::new();
|
||||||
|
|
||||||
@@ -170,8 +170,8 @@ async fn async_send_recv_unbounded() {
|
|||||||
#[cfg(feature = "async-traits")]
|
#[cfg(feature = "async-traits")]
|
||||||
fn sink_send_recv_unbounded() {
|
fn sink_send_recv_unbounded() {
|
||||||
use futures_core::Stream;
|
use futures_core::Stream;
|
||||||
|
use futures_sink::Sink;
|
||||||
use pin_utils::pin_mut;
|
use pin_utils::pin_mut;
|
||||||
use tokio_futures::Sink;
|
|
||||||
|
|
||||||
let mut t1 = MockTask::new();
|
let mut t1 = MockTask::new();
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -40,7 +40,7 @@ default = [
|
|||||||
|
|
||||||
codec = ["io", "tokio-codec"]
|
codec = ["io", "tokio-codec"]
|
||||||
fs = ["tokio-fs"]
|
fs = ["tokio-fs"]
|
||||||
io = ["bytes", "tokio-io", "tokio-futures", "memchr"]
|
io = ["bytes", "tokio-io", "memchr"]
|
||||||
reactor = ["io", "tokio-reactor"]
|
reactor = ["io", "tokio-reactor"]
|
||||||
rt-full = [
|
rt-full = [
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
@@ -82,9 +82,6 @@ tokio-timer = { version = "0.3.0", optional = true, path = "../tokio-timer" }
|
|||||||
tracing-core = { version = "0.1", optional = true }
|
tracing-core = { version = "0.1", optional = true }
|
||||||
memchr = { version = "2.2", optional = true }
|
memchr = { version = "2.2", optional = true }
|
||||||
|
|
||||||
# Needed for async/await preview support
|
|
||||||
tokio-futures = { version = "0.2.0", optional = true, path = "../tokio-futures" }
|
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
tokio-uds = { version = "0.3.0", optional = true, path = "../tokio-uds" }
|
tokio-uds = { version = "0.3.0", optional = true, path = "../tokio-uds" }
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
use super::read_line::read_line_internal;
|
use super::read_line::read_line_internal;
|
||||||
use futures_core::ready;
|
|
||||||
|
use tokio_io::AsyncBufRead;
|
||||||
|
|
||||||
|
use futures_core::{ready, Stream};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use tokio_futures::Stream;
|
|
||||||
use tokio_io::AsyncBufRead;
|
|
||||||
|
|
||||||
/// Stream for the [`lines`](crate::io::AsyncBufReadExt::lines) method.
|
/// Stream for the [`lines`](crate::io::AsyncBufReadExt::lines) method.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
Reference in New Issue
Block a user