@ -2,6 +2,10 @@ use std::marker::PhantomData;
use std ::pin ::Pin ;
use std ::pin ::Pin ;
use std ::task ::{ Context , Poll } ;
use std ::task ::{ Context , Poll } ;
use crate ::future ::Future ;
use crate ::stream ::Stream ;
#[ doc(hidden) ]
#[ allow(missing_debug_implementations) ]
#[ allow(missing_debug_implementations) ]
pub struct FindMapFuture < ' a , S , F , T , B > {
pub struct FindMapFuture < ' a , S , F , T , B > {
stream : & ' a mut S ,
stream : & ' a mut S ,
@ -11,9 +15,6 @@ pub struct FindMapFuture<'a, S, F, T, B> {
}
}
impl < ' a , S , B , F , T > FindMapFuture < ' a , S , F , T , B > {
impl < ' a , S , B , F , T > FindMapFuture < ' a , S , F , T , B > {
pin_utils ::unsafe_pinned ! ( stream : & ' a mut S ) ;
pin_utils ::unsafe_unpinned ! ( f : F ) ;
pub ( super ) fn new ( stream : & ' a mut S , f : F ) -> Self {
pub ( super ) fn new ( stream : & ' a mut S , f : F ) -> Self {
FindMapFuture {
FindMapFuture {
stream ,
stream ,
@ -24,20 +25,20 @@ impl<'a, S, B, F, T> FindMapFuture<'a, S, F, T, B> {
}
}
}
}
impl < ' a , S , B , F > futures_core ::future ::Future for FindMapFuture < ' a , S , F , S ::Item , B >
impl < S : Unpin , F , T , B > Unpin for FindMapFuture < ' _ , S , F , T , B > { }
impl < ' a , S , B , F > Future for FindMapFuture < ' a , S , F , S ::Item , B >
where
where
S : futures_core ::stream ::Stream + Unpin + Sized ,
S : Stream + Unpin + Sized ,
F : FnMut ( S ::Item ) -> Option < B > ,
F : FnMut ( S ::Item ) -> Option < B > ,
{
{
type Output = Option < B > ;
type Output = Option < B > ;
fn poll ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self ::Output > {
fn poll ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self ::Output > {
use futures_core ::stream ::Stream ;
let item = futures_core ::ready ! ( Pin ::new ( & mut * self . stream ) . poll_next ( cx ) ) ;
let item = futures_core ::ready ! ( self . as_mut ( ) . stream ( ) . poll_next ( cx ) ) ;
match item {
match item {
Some ( v ) = > match ( self . as_mut ( ) . f ( ) ) ( v ) {
Some ( v ) = > match ( & mut self . f ) ( v ) {
Some ( v ) = > Poll ::Ready ( Some ( v ) ) ,
Some ( v ) = > Poll ::Ready ( Some ( v ) ) ,
None = > {
None = > {
cx . waker ( ) . wake_by_ref ( ) ;
cx . waker ( ) . wake_by_ref ( ) ;