Skip to content

Commit

Permalink
util: remove tokio-stream dependency from tokio-util (#3487)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn authored Jan 31, 2021
1 parent 06d6adf commit ee1f0c4
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions tokio-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ rt = ["tokio/rt"]
__docs_rs = ["futures-util"]

[dependencies]
tokio = { version = "1.0.0" }
tokio-stream = { version = "0.1" }
tokio = { version = "1.0.0", features = ["sync"] }

bytes = "1.0.0"
futures-core = "0.3.0"
Expand All @@ -51,6 +50,7 @@ slab = { version = "0.4.1", optional = true } # Backs `DelayQueue`
[dev-dependencies]
tokio = { version = "1.0.0", features = ["full"] }
tokio-test = { version = "0.4.0" }
tokio-stream = { version = "0.1" }

async-stream = "0.3.0"
futures = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion tokio-util/src/codec/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub trait Decoder {
/// calling `split` on the [`Framed`] returned by this method, which will
/// break them into separate objects, allowing them to interact more easily.
///
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
/// [`Sink`]: futures_sink::Sink
/// [`Framed`]: crate::codec::Framed
fn framed<T: AsyncRead + AsyncWrite + Sized>(self, io: T) -> Framed<T, Self>
Expand Down
10 changes: 5 additions & 5 deletions tokio-util/src/codec/framed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::codec::decoder::Decoder;
use crate::codec::encoder::Encoder;
use crate::codec::framed_impl::{FramedImpl, RWFrames, ReadFrame, WriteFrame};

use futures_core::Stream;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_stream::Stream;

use bytes::BytesMut;
use futures_sink::Sink;
Expand All @@ -20,7 +20,7 @@ pin_project! {
/// You can create a `Framed` instance by using the [`Decoder::framed`] adapter, or
/// by using the `new` function seen below.
///
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
/// [`Sink`]: futures_sink::Sink
/// [`AsyncRead`]: tokio::io::AsyncRead
/// [`Decoder::framed`]: crate::codec::Decoder::framed()
Expand Down Expand Up @@ -52,7 +52,7 @@ where
/// calling [`split`] on the `Framed` returned by this method, which will
/// break them into separate objects, allowing them to interact more easily.
///
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
/// [`Sink`]: futures_sink::Sink
/// [`Decode`]: crate::codec::Decoder
/// [`Encoder`]: crate::codec::Encoder
Expand Down Expand Up @@ -86,7 +86,7 @@ where
/// calling [`split`] on the `Framed` returned by this method, which will
/// break them into separate objects, allowing them to interact more easily.
///
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
/// [`Sink`]: futures_sink::Sink
/// [`Decode`]: crate::codec::Decoder
/// [`Encoder`]: crate::codec::Encoder
Expand Down Expand Up @@ -131,7 +131,7 @@ impl<T, U> Framed<T, U> {
/// calling [`split`] on the `Framed` returned by this method, which will
/// break them into separate objects, allowing them to interact more easily.
///
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
/// [`Sink`]: futures_sink::Sink
/// [`Decoder`]: crate::codec::Decoder
/// [`Encoder`]: crate::codec::Encoder
Expand Down
2 changes: 1 addition & 1 deletion tokio-util/src/codec/framed_impl.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::codec::decoder::Decoder;
use crate::codec::encoder::Encoder;

use futures_core::Stream;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_stream::Stream;

use bytes::BytesMut;
use futures_core::ready;
Expand Down
4 changes: 2 additions & 2 deletions tokio-util/src/codec/framed_read.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::codec::framed_impl::{FramedImpl, ReadFrame};
use crate::codec::Decoder;

use futures_core::Stream;
use tokio::io::AsyncRead;
use tokio_stream::Stream;

use bytes::BytesMut;
use futures_sink::Sink;
Expand All @@ -14,7 +14,7 @@ use std::task::{Context, Poll};
pin_project! {
/// A [`Stream`] of messages decoded from an [`AsyncRead`].
///
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
/// [`AsyncRead`]: tokio::io::AsyncRead
pub struct FramedRead<T, D> {
#[pin]
Expand Down
2 changes: 1 addition & 1 deletion tokio-util/src/codec/framed_write.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::codec::encoder::Encoder;
use crate::codec::framed_impl::{FramedImpl, WriteFrame};

use futures_core::Stream;
use tokio::io::AsyncWrite;
use tokio_stream::Stream;

use bytes::BytesMut;
use futures_sink::Sink;
Expand Down
2 changes: 1 addition & 1 deletion tokio-util/src/codec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
//!
//! [`AsyncRead`]: tokio::io::AsyncRead
//! [`AsyncWrite`]: tokio::io::AsyncWrite
//! [`Stream`]: tokio_stream::Stream
//! [`Stream`]: futures_core::Stream
//! [`Sink`]: futures_sink::Sink
//! [`SinkExt::close`]: https://docs.rs/futures/0.3/futures/sink/trait.SinkExt.html#method.close
//! [`FramedRead`]: struct@crate::codec::FramedRead
Expand Down
4 changes: 2 additions & 2 deletions tokio-util/src/io/reader_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pin_project! {
///
/// [`AsyncRead`]: tokio::io::AsyncRead
/// [`StreamReader`]: crate::io::StreamReader
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
#[derive(Debug)]
pub struct ReaderStream<R> {
// Reader itself.
Expand All @@ -58,7 +58,7 @@ impl<R: AsyncRead> ReaderStream<R> {
/// `Result<Bytes, std::io::Error>`.
///
/// [`AsyncRead`]: tokio::io::AsyncRead
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
pub fn new(reader: R) -> Self {
ReaderStream {
reader: Some(reader),
Expand Down
2 changes: 1 addition & 1 deletion tokio-util/src/io/stream_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pin_project! {
/// ```
///
/// [`AsyncRead`]: tokio::io::AsyncRead
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
/// [`ReaderStream`]: crate::io::ReaderStream
#[derive(Debug)]
pub struct StreamReader<S, B> {
Expand Down
4 changes: 2 additions & 2 deletions tokio-util/src/udp/frame.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::codec::{Decoder, Encoder};

use futures_core::Stream;
use tokio::{io::ReadBuf, net::UdpSocket};
use tokio_stream::Stream;

use bytes::{BufMut, BytesMut};
use futures_core::ready;
Expand All @@ -28,7 +28,7 @@ use std::{io, mem::MaybeUninit};
/// calling [`split`] on the `UdpFramed` returned by this method, which will break
/// them into separate objects, allowing them to interact more easily.
///
/// [`Stream`]: tokio_stream::Stream
/// [`Stream`]: futures_core::Stream
/// [`Sink`]: futures_sink::Sink
/// [`split`]: https://docs.rs/futures/0.3/futures/stream/trait.StreamExt.html#method.split
#[must_use = "sinks do nothing unless polled"]
Expand Down

0 comments on commit ee1f0c4

Please sign in to comment.