Require S: async_std::stream::Stream in Scan

This commit is contained in:
Wonwoo Choi 2019-09-16 18:35:37 +09:00
parent d6ffdbce8d
commit b70dfeab15

View file

@ -1,7 +1,8 @@
use crate::task::{Context, Poll};
use std::pin::Pin; use std::pin::Pin;
use crate::stream::Stream;
use crate::task::{Context, Poll};
/// A stream to maintain state while polling another stream. /// A stream to maintain state while polling another stream.
#[derive(Debug)] #[derive(Debug)]
pub struct Scan<S, St, F> { pub struct Scan<S, St, F> {
@ -25,7 +26,7 @@ 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> futures_core::stream::Stream for Scan<S, St, F>
where where
S: futures_core::stream::Stream, S: Stream,
F: FnMut(&mut St, S::Item) -> Option<B>, F: FnMut(&mut St, S::Item) -> Option<B>,
{ {
type Item = B; type Item = B;