@@ -2,6 +2,10 @@ use std::marker::PhantomData;
22use std:: pin:: Pin ;
33use std:: task:: { Context , Poll } ;
44
5+ use crate :: future:: Future ;
6+ use crate :: stream:: Stream ;
7+
8+ #[ doc( hidden) ]
59#[ allow( missing_debug_implementations) ]
610pub struct FindMapFuture < ' a , S , F , T , B > {
711 stream : & ' a mut S ,
@@ -11,9 +15,6 @@ pub struct FindMapFuture<'a, S, F, T, B> {
1115}
1216
1317impl < ' a , S , B , F , T > FindMapFuture < ' a , S , F , T , B > {
14- pin_utils:: unsafe_pinned!( stream: & ' a mut S ) ;
15- pin_utils:: unsafe_unpinned!( f: F ) ;
16-
1718 pub ( super ) fn new ( stream : & ' a mut S , f : F ) -> Self {
1819 FindMapFuture {
1920 stream,
@@ -24,20 +25,20 @@ impl<'a, S, B, F, T> FindMapFuture<'a, S, F, T, B> {
2425 }
2526}
2627
27- impl < ' a , S , B , F > futures_core:: future:: Future for FindMapFuture < ' a , S , F , S :: Item , B >
28+ impl < S : Unpin , F , T , B > Unpin for FindMapFuture < ' _ , S , F , T , B > { }
29+
30+ impl < ' a , S , B , F > Future for FindMapFuture < ' a , S , F , S :: Item , B >
2831where
29- S : futures_core :: stream :: Stream + Unpin + Sized ,
32+ S : Stream + Unpin + Sized ,
3033 F : FnMut ( S :: Item ) -> Option < B > ,
3134{
3235 type Output = Option < B > ;
3336
3437 fn poll ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
35- use futures_core:: stream:: Stream ;
36-
37- let item = futures_core:: ready!( self . as_mut( ) . stream( ) . poll_next( cx) ) ;
38+ let item = futures_core:: ready!( Pin :: new( & mut * self . stream) . poll_next( cx) ) ;
3839
3940 match item {
40- Some ( v) => match ( self . as_mut ( ) . f ( ) ) ( v) {
41+ Some ( v) => match ( & mut self . f ) ( v) {
4142 Some ( v) => Poll :: Ready ( Some ( v) ) ,
4243 None => {
4344 cx. waker ( ) . wake_by_ref ( ) ;
0 commit comments