11use std:: {
22 collections:: VecDeque ,
3- marker:: PhantomData ,
43 pin:: Pin ,
54 task:: { Context , Poll } ,
65 time:: Duration ,
76} ;
87
98use bson:: { RawDocument , RawDocumentBuf } ;
109use derivative:: Derivative ;
11- use futures_core:: { future:: BoxFuture , Future , Stream } ;
12- use serde:: { de:: DeserializeOwned , Deserialize } ;
10+ use futures_core:: { future:: BoxFuture , Future } ;
1311#[ cfg( test) ]
1412use tokio:: sync:: oneshot;
1513
@@ -29,7 +27,7 @@ use crate::{
2927/// An internal cursor that can be used in a variety of contexts depending on its `GetMoreProvider`.
3028#[ derive( Derivative ) ]
3129#[ derivative( Debug ) ]
32- pub ( super ) struct GenericCursor < P , T >
30+ pub ( super ) struct GenericCursor < P >
3331where
3432 P : GetMoreProvider ,
3533{
4038 /// This is an `Option` to allow it to be "taken" when the cursor is no longer needed
4139 /// but may be resumed in the future for `SessionCursor`.
4240 state : Option < CursorState > ,
43- _phantom : PhantomData < T > ,
4441}
4542
46- impl < P , T > GenericCursor < P , T >
43+ impl < P > GenericCursor < P >
4744where
4845 P : GetMoreProvider ,
4946{
6461 post_batch_resume_token : None ,
6562 pinned_connection,
6663 } ) ,
67- _phantom : Default :: default ( ) ,
6864 }
6965 }
7066
7874 provider,
7975 client,
8076 info,
81- _phantom : Default :: default ( ) ,
8277 state : state. into ( ) ,
8378 }
8479 }
@@ -192,19 +187,6 @@ where
192187 pub ( super ) fn provider_mut ( & mut self ) -> & mut P {
193188 & mut self . provider
194189 }
195-
196- pub ( super ) fn with_type < ' a , D > ( self ) -> GenericCursor < P , D >
197- where
198- D : Deserialize < ' a > ,
199- {
200- GenericCursor {
201- client : self . client ,
202- provider : self . provider ,
203- info : self . info ,
204- state : self . state ,
205- _phantom : Default :: default ( ) ,
206- }
207- }
208190}
209191
210192pub ( crate ) trait CursorStream {
@@ -217,10 +199,9 @@ pub(crate) enum BatchValue {
217199 Exhausted ,
218200}
219201
220- impl < P , T > CursorStream for GenericCursor < P , T >
202+ impl < P > CursorStream for GenericCursor < P >
221203where
222204 P : GetMoreProvider ,
223- T : DeserializeOwned + Unpin ,
224205{
225206 fn poll_next_in_batch ( & mut self , cx : & mut Context < ' _ > ) -> Poll < Result < BatchValue > > {
226207 // If there is a get more in flight, check on its status.
@@ -300,18 +281,6 @@ where
300281 }
301282}
302283
303- impl < P , T > Stream for GenericCursor < P , T >
304- where
305- P : GetMoreProvider ,
306- T : DeserializeOwned + Unpin ,
307- {
308- type Item = Result < T > ;
309-
310- fn poll_next ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < Self :: Item > > {
311- stream_poll_next ( Pin :: into_inner ( self ) , cx)
312- }
313- }
314-
315284/// A trait implemented by objects that can provide batches of documents to a cursor via the getMore
316285/// command.
317286pub ( super ) trait GetMoreProvider : Unpin {
0 commit comments