1
1
use std:: {
2
2
collections:: VecDeque ,
3
- marker:: PhantomData ,
4
3
pin:: Pin ,
5
4
task:: { Context , Poll } ,
6
5
time:: Duration ,
7
6
} ;
8
7
9
8
use bson:: { RawDocument , RawDocumentBuf } ;
10
9
use derivative:: Derivative ;
11
- use futures_core:: { future:: BoxFuture , Future , Stream } ;
12
- use serde:: { de:: DeserializeOwned , Deserialize } ;
10
+ use futures_core:: { future:: BoxFuture , Future } ;
13
11
#[ cfg( test) ]
14
12
use tokio:: sync:: oneshot;
15
13
@@ -29,7 +27,7 @@ use crate::{
29
27
/// An internal cursor that can be used in a variety of contexts depending on its `GetMoreProvider`.
30
28
#[ derive( Derivative ) ]
31
29
#[ derivative( Debug ) ]
32
- pub ( super ) struct GenericCursor < P , T >
30
+ pub ( super ) struct GenericCursor < P >
33
31
where
34
32
P : GetMoreProvider ,
35
33
{
40
38
/// This is an `Option` to allow it to be "taken" when the cursor is no longer needed
41
39
/// but may be resumed in the future for `SessionCursor`.
42
40
state : Option < CursorState > ,
43
- _phantom : PhantomData < T > ,
44
41
}
45
42
46
- impl < P , T > GenericCursor < P , T >
43
+ impl < P > GenericCursor < P >
47
44
where
48
45
P : GetMoreProvider ,
49
46
{
64
61
post_batch_resume_token : None ,
65
62
pinned_connection,
66
63
} ) ,
67
- _phantom : Default :: default ( ) ,
68
64
}
69
65
}
70
66
78
74
provider,
79
75
client,
80
76
info,
81
- _phantom : Default :: default ( ) ,
82
77
state : state. into ( ) ,
83
78
}
84
79
}
@@ -192,19 +187,6 @@ where
192
187
pub ( super ) fn provider_mut ( & mut self ) -> & mut P {
193
188
& mut self . provider
194
189
}
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
- }
208
190
}
209
191
210
192
pub ( crate ) trait CursorStream {
@@ -217,10 +199,9 @@ pub(crate) enum BatchValue {
217
199
Exhausted ,
218
200
}
219
201
220
- impl < P , T > CursorStream for GenericCursor < P , T >
202
+ impl < P > CursorStream for GenericCursor < P >
221
203
where
222
204
P : GetMoreProvider ,
223
- T : DeserializeOwned + Unpin ,
224
205
{
225
206
fn poll_next_in_batch ( & mut self , cx : & mut Context < ' _ > ) -> Poll < Result < BatchValue > > {
226
207
// If there is a get more in flight, check on its status.
@@ -300,18 +281,6 @@ where
300
281
}
301
282
}
302
283
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
-
315
284
/// A trait implemented by objects that can provide batches of documents to a cursor via the getMore
316
285
/// command.
317
286
pub ( super ) trait GetMoreProvider : Unpin {
0 commit comments