Re-export Stream from futures

staging
Stjepan Glavina 5 years ago
parent 33ff41df48
commit 73d7fea937

@ -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.
@ -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>> {

@ -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.
@ -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>> {

@ -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.
@ -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>> {

@ -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 _;

@ -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.
@ -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>> {

@ -1,4 +1,4 @@
use futures_core::stream::Stream;
use crate::stream::Stream;
/// Conversion into a `Stream`.
///

@ -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"))] {

@ -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.
@ -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>> {

@ -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.
@ -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>> {

@ -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.

@ -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,
{

@ -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,

@ -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>,

File diff suppressed because it is too large Load Diff

@ -24,7 +24,7 @@ impl<S, St, F> Scan<S, St, F> {
impl<S: Unpin, St, F> Unpin for Scan<S, St, F> {}
impl<S, St, F, B> futures_core::stream::Stream for Scan<S, St, F>
impl<S, St, F, B> Stream for Scan<S, St, F>
where
S: Stream,
F: FnMut(&mut St, S::Item) -> Option<B>,

@ -17,7 +17,7 @@ impl<S: Stream> Take<S> {
pin_utils::unsafe_unpinned!(remaining: usize);
}
impl<S: Stream> futures_core::stream::Stream for Take<S> {
impl<S: Stream> Stream for Take<S> {
type Item = S::Item;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<S::Item>> {

@ -36,7 +36,7 @@ impl<A: Stream, B> Zip<A, B> {
pin_utils::unsafe_pinned!(second: B);
}
impl<A: Stream, B: Stream> futures_core::stream::Stream for Zip<A, B> {
impl<A: Stream, B: Stream> Stream for Zip<A, B> {
type Item = (A::Item, B::Item);
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {

Loading…
Cancel
Save