Skip to content

Re-export Stream from futures #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from Sep 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/fs/read_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::pin::Pin;
use crate::fs::DirEntry;
use crate::future::Future;
use crate::io;
use crate::stream::Stream;
use crate::task::{blocking, Context, Poll};

/// Returns a stream of entries in a directory.
Expand Down Expand Up @@ -80,7 +81,7 @@ impl ReadDir {
}
}

impl futures_core::stream::Stream for ReadDir {
impl Stream for ReadDir {
type Item = io::Result<DirEntry>;

fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Expand Down
3 changes: 2 additions & 1 deletion src/io/buf_read/lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::str;

use super::read_until_internal;
use crate::io::{self, BufRead};
use crate::stream::Stream;
use crate::task::{Context, Poll};

/// A stream of lines in a byte stream.
Expand All @@ -23,7 +24,7 @@ pub struct Lines<R> {
pub(crate) read: usize,
}

impl<R: BufRead> futures_core::stream::Stream for Lines<R> {
impl<R: BufRead> Stream for Lines<R> {
type Item = io::Result<String>;

fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Expand Down
3 changes: 2 additions & 1 deletion src/os/unix/net/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::future::{self, Future};
use crate::io;
use crate::net::driver::Watcher;
use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use crate::stream::Stream;
use crate::task::{blocking, Context, Poll};

/// A Unix domain socket server, listening for connections.
Expand Down Expand Up @@ -185,7 +186,7 @@ impl fmt::Debug for UnixListener {
#[derive(Debug)]
pub struct Incoming<'a>(&'a UnixListener);

impl futures_core::stream::Stream for Incoming<'_> {
impl Stream for Incoming<'_> {
type Item = io::Result<UnixStream>;

fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Expand Down
2 changes: 2 additions & 0 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ pub use crate::io::read::ReadExt as _;
pub use crate::io::seek::SeekExt as _;
#[doc(hidden)]
pub use crate::io::write::WriteExt as _;
#[doc(hidden)]
pub use crate::stream::stream::StreamExt as _;
3 changes: 2 additions & 1 deletion src/stream/empty.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::marker::PhantomData;
use std::pin::Pin;

use crate::stream::Stream;
use crate::task::{Context, Poll};

/// Creates a stream that doesn't yield any items.
Expand Down Expand Up @@ -35,7 +36,7 @@ pub struct Empty<T> {
_marker: PhantomData<T>,
}

impl<T> futures_core::stream::Stream for Empty<T> {
impl<T> Stream for Empty<T> {
type Item = T;

fn poll_next(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Expand Down
2 changes: 1 addition & 1 deletion src/stream/into_stream.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use futures_core::stream::Stream;
use crate::stream::Stream;

/// Conversion into a `Stream`.
///
Expand Down
5 changes: 3 additions & 2 deletions src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ use cfg_if::cfg_if;
pub use empty::{empty, Empty};
pub use once::{once, Once};
pub use repeat::{repeat, Repeat};
pub use stream::{Fuse, Scan, Stream, Take, Zip};
pub use stream::{Chain, Filter, Fuse, Inspect, Scan, Skip, SkipWhile, StepBy, Stream, Take, Zip};

pub(crate) mod stream;

mod empty;
mod once;
mod repeat;
mod stream;

cfg_if! {
if #[cfg(any(feature = "unstable", feature = "docs"))] {
Expand Down
3 changes: 2 additions & 1 deletion src/stream/once.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::pin::Pin;

use crate::stream::Stream;
use crate::task::{Context, Poll};

/// Creates a stream that yields a single item.
Expand Down Expand Up @@ -33,7 +34,7 @@ pub struct Once<T> {
value: Option<T>,
}

impl<T: Unpin> futures_core::stream::Stream for Once<T> {
impl<T: Unpin> Stream for Once<T> {
type Item = T;

fn poll_next(mut self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<T>> {
Expand Down
3 changes: 2 additions & 1 deletion src/stream/repeat.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::pin::Pin;

use crate::stream::Stream;
use crate::task::{Context, Poll};

/// Creates a stream that yields the same item repeatedly.
Expand Down Expand Up @@ -36,7 +37,7 @@ pub struct Repeat<T> {
item: T,
}

impl<T: Clone> futures_core::stream::Stream for Repeat<T> {
impl<T: Clone> Stream for Repeat<T> {
type Item = T;

fn poll_next(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Expand Down
2 changes: 1 addition & 1 deletion src/stream/stream/chain.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::pin::Pin;

use super::fuse::Fuse;
use crate::stream::Stream;
use crate::prelude::*;
use crate::task::{Context, Poll};

/// Chains two streams one after another.
Expand Down
2 changes: 1 addition & 1 deletion src/stream/stream/enumerate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl<S> Enumerate<S> {
}
}

impl<S> futures_core::stream::Stream for Enumerate<S>
impl<S> Stream for Enumerate<S>
where
S: Stream,
{
Expand Down
2 changes: 1 addition & 1 deletion src/stream/stream/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<S, P, T> Filter<S, P, T> {
}
}

impl<S, P> futures_core::stream::Stream for Filter<S, P, S::Item>
impl<S, P> Stream for Filter<S, P, S::Item>
where
S: Stream,
P: FnMut(&S::Item) -> bool,
Expand Down
2 changes: 1 addition & 1 deletion src/stream/stream/filter_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<S, F, T, B> FilterMap<S, F, T, B> {
}
}

impl<S, F, B> futures_core::stream::Stream for FilterMap<S, F, S::Item, B>
impl<S, F, B> Stream for FilterMap<S, F, S::Item, B>
where
S: Stream,
F: FnMut(S::Item) -> Option<B>,
Expand Down
Loading