|
|
@ -10,7 +10,6 @@ use crate::task::{Context, Poll};
|
|
|
|
pub struct AllFuture<'a, S, F, T> {
|
|
|
|
pub struct AllFuture<'a, S, F, T> {
|
|
|
|
pub(crate) stream: &'a mut S,
|
|
|
|
pub(crate) stream: &'a mut S,
|
|
|
|
pub(crate) f: F,
|
|
|
|
pub(crate) f: F,
|
|
|
|
pub(crate) result: bool,
|
|
|
|
|
|
|
|
pub(crate) _marker: PhantomData<T>,
|
|
|
|
pub(crate) _marker: PhantomData<T>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -19,7 +18,6 @@ impl<'a, S, F, T> AllFuture<'a, S, F, T> {
|
|
|
|
Self {
|
|
|
|
Self {
|
|
|
|
stream,
|
|
|
|
stream,
|
|
|
|
f,
|
|
|
|
f,
|
|
|
|
result: true, // the default if the empty stream
|
|
|
|
|
|
|
|
_marker: PhantomData,
|
|
|
|
_marker: PhantomData,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -40,7 +38,6 @@ where
|
|
|
|
match next {
|
|
|
|
match next {
|
|
|
|
Some(v) => {
|
|
|
|
Some(v) => {
|
|
|
|
let result = (&mut self.f)(v);
|
|
|
|
let result = (&mut self.f)(v);
|
|
|
|
self.result = result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if result {
|
|
|
|
if result {
|
|
|
|
// don't forget to wake this task again to pull the next item from stream
|
|
|
|
// don't forget to wake this task again to pull the next item from stream
|
|
|
@ -50,7 +47,7 @@ where
|
|
|
|
Poll::Ready(false)
|
|
|
|
Poll::Ready(false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
None => Poll::Ready(self.result),
|
|
|
|
None => Poll::Ready(true),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|