Update Tokio to Rust 2018 (#1082)

This commit is contained in:
Carl Lerche
2019-05-14 10:27:36 -07:00
committed by GitHub
parent 79d8820050
commit cb4aea394e
343 changed files with 1725 additions and 2813 deletions
+4 -2
View File
@@ -7,8 +7,9 @@ name = "tokio-buf"
# - Cargo.toml
# - README.md
# - Update CHANGELOG.md.
# - Create "v0.1.x" git tag.
version = "0.1.1"
# - Create "v0.2.x" git tag.
version = "0.2.0"
edition = "2018"
authors = ["Carl Lerche <[email protected]>"]
license = "MIT"
repository = "https://github.com/tokio-rs/tokio"
@@ -18,6 +19,7 @@ description = """
Asynchronous stream of byte buffers
"""
categories = ["asynchronous"]
publish = false
[dependencies]
bytes = "0.4.10"
+1 -7
View File
@@ -6,19 +6,13 @@ Asynchronous stream of byte buffers
## Usage
First, add this to your `Cargo.toml`:
Add this to your `Cargo.toml`:
```toml
[dependencies]
tokio-buf = "0.1.1"
```
Next, add this to your crate:
```rust
extern crate tokio_buf;
```
You can find extensive documentation and examples about how to use this crate
online at [https://tokio.rs](https://tokio.rs). The [API
documentation](https://docs.rs/tokio-buf) is also a great place to get started
+8 -9
View File
@@ -1,6 +1,12 @@
#![doc(html_root_url = "https://docs.rs/tokio-buf/0.1.1")]
#![deny(missing_docs, missing_debug_implementations, unreachable_pub)]
#![deny(
missing_docs,
missing_debug_implementations,
unreachable_pub,
rust_2018_idioms
)]
#![cfg_attr(test, deny(warnings))]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
//! Asynchronous stream of bytes.
//!
@@ -9,13 +15,6 @@
//! instead of yielding arbitrary values, it only yields types that implement
//! `Buf` (i.e, byte collections).
extern crate bytes;
#[cfg(feature = "util")]
extern crate either;
#[allow(unused)]
#[macro_use]
extern crate futures;
mod never;
mod size_hint;
mod str;
@@ -26,7 +25,7 @@ pub mod util;
pub use self::size_hint::SizeHint;
#[doc(inline)]
#[cfg(feature = "util")]
pub use util::BufStreamExt;
pub use crate::util::BufStreamExt;
use bytes::Buf;
use futures::Poll;
+2 -2
View File
@@ -4,13 +4,13 @@ use std::{error, fmt};
pub enum Never {}
impl fmt::Debug for Never {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {}
}
}
impl fmt::Display for Never {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {}
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
use never::Never;
use BufStream;
use SizeHint;
use crate::never::Never;
use crate::BufStream;
use crate::SizeHint;
use futures::Poll;
+2 -2
View File
@@ -1,8 +1,8 @@
use crate::never::Never;
use crate::BufStream;
use bytes::{Bytes, BytesMut};
use futures::Poll;
use never::Never;
use std::io;
use BufStream;
impl BufStream for Vec<u8> {
type Item = io::Cursor<Vec<u8>>;
+2 -2
View File
@@ -1,7 +1,7 @@
use BufStream;
use crate::BufStream;
use either::Either;
use futures::Poll;
use futures::{try_ready, Poll};
/// A buf stream that sequences two buf streams together.
///
+2 -2
View File
@@ -1,7 +1,7 @@
use super::FromBufStream;
use BufStream;
use crate::BufStream;
use futures::{Future, Poll};
use futures::{try_ready, Future, Poll};
/// Consumes a buf stream, collecting the data into a single byte container.
///
+3 -3
View File
@@ -1,4 +1,4 @@
use SizeHint;
use crate::SizeHint;
use bytes::{Buf, BufMut, Bytes};
@@ -138,7 +138,7 @@ impl<T: Buf> FromBufStream<T> for Bytes {
}
impl fmt::Display for CollectVecError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "BufStream is too big")
}
}
@@ -150,7 +150,7 @@ impl Error for CollectVecError {
}
impl fmt::Display for CollectBytesError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "BufStream too big")
}
}
+2 -2
View File
@@ -1,8 +1,8 @@
use crate::BufStream;
use bytes::Buf;
use futures::Poll;
use std::error::Error;
use std::fmt;
use BufStream;
/// Converts an `Iterator` into a `BufStream` which is always ready to yield the
/// next value.
@@ -42,7 +42,7 @@ where
}
impl fmt::Display for Never {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
unreachable!();
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
use BufStream;
use crate::BufStream;
use bytes::Buf;
use futures::Poll;
+1 -1
View File
@@ -22,7 +22,7 @@ pub mod error {
pub use super::limit::LimitError;
}
use BufStream;
use crate::BufStream;
impl<T> BufStreamExt for T where T: BufStream {}
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::BufStream;
use bytes::Buf;
use futures::{Async, Poll, Stream};
use BufStream;
/// Converts a `Stream` of `Buf` types into a `BufStream`.
///
+1 -3
View File
@@ -1,7 +1,5 @@
extern crate tokio_buf;
use tokio_buf::BufStream;
// Ensures that `BufStream` can be a trait object
#[allow(dead_code)]
fn obj(_: &mut BufStream<Item = u32, Error = ()>) {}
fn obj(_: &mut dyn BufStream<Item = u32, Error = ()>) {}
-6
View File
@@ -1,15 +1,9 @@
#![cfg(feature = "util")]
extern crate bytes;
extern crate futures;
extern crate tokio_buf;
use futures::Async::*;
use tokio_buf::{BufStream, BufStreamExt};
#[macro_use]
mod support;
use support::*;
#[test]
-6
View File
@@ -1,16 +1,10 @@
#![cfg(feature = "util")]
extern crate bytes;
extern crate futures;
extern crate tokio_buf;
use bytes::Bytes;
use futures::Future;
use tokio_buf::BufStreamExt;
#[macro_use]
mod support;
use support::*;
macro_rules! test_collect_impl {
-5
View File
@@ -1,12 +1,7 @@
extern crate bytes;
extern crate futures;
extern crate tokio_buf;
use futures::Async::*;
use std::io::Cursor;
use tokio_buf::{util, BufStream};
#[macro_use]
mod support;
type Buf = Cursor<&'static [u8]>;
-6
View File
@@ -1,16 +1,10 @@
#![cfg(feature = "util")]
extern crate bytes;
extern crate futures;
extern crate tokio_buf;
use futures::Async::*;
use futures::Future;
use tokio_buf::{BufStream, BufStreamExt};
#[macro_use]
mod support;
use support::*;
#[test]
-2
View File
@@ -1,5 +1,3 @@
extern crate tokio_buf;
use tokio_buf::SizeHint;
#[test]
-6
View File
@@ -1,15 +1,9 @@
extern crate bytes;
extern crate futures;
extern crate tokio_buf;
extern crate tokio_mock_task;
use futures::sync::mpsc;
use futures::Async::*;
use std::io::Cursor;
use tokio_buf::{util, BufStream};
use tokio_mock_task::MockTask;
#[macro_use]
mod support;
type Buf = Cursor<&'static [u8]>;
-5
View File
@@ -1,12 +1,7 @@
extern crate bytes;
extern crate futures;
extern crate tokio_buf;
use futures::Async::*;
use std::fmt;
use tokio_buf::BufStream;
#[macro_use]
mod support;
fn test_hello_world<B>(mut bs: B)
+3 -4
View File
@@ -1,9 +1,5 @@
#![allow(unused)]
extern crate bytes;
extern crate futures;
extern crate tokio_buf;
use bytes::Buf;
use futures::Async::*;
use futures::Poll;
@@ -12,6 +8,7 @@ use tokio_buf::{BufStream, SizeHint};
use std::collections::VecDeque;
use std::io::Cursor;
#[macro_export]
macro_rules! assert_buf_eq {
($actual:expr, $expect:expr) => {{
use bytes::Buf;
@@ -27,6 +24,7 @@ macro_rules! assert_buf_eq {
}};
}
#[macro_export]
macro_rules! assert_none {
($actual:expr) => {
match $actual {
@@ -36,6 +34,7 @@ macro_rules! assert_none {
};
}
#[macro_export]
macro_rules! assert_not_ready {
($actual:expr) => {
match $actual {