@@ -58,12 +58,13 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
58
58
println ! ( "Created 5 documents." ) ;
59
59
60
60
// Let's get 3 entries at a time.
61
- let response = client
61
+ let mut paged = client
62
62
. list_documents ( )
63
63
. consistency_level ( response. unwrap ( ) )
64
64
. max_item_count ( 3i32 )
65
- . execute :: < MySampleStruct > ( )
66
- . await ?;
65
+ . into_stream :: < MySampleStruct > ( ) ;
66
+
67
+ let response = paged. next ( ) . await . unwrap ( ) ?;
67
68
68
69
assert_eq ! ( response. documents. len( ) , 3 ) ;
69
70
println ! ( "response == {:#?}" , response) ;
@@ -72,16 +73,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
72
73
// continuation_token must be present
73
74
assert ! ( response. continuation_token. is_some( ) ) ;
74
75
75
- let session_token = & response;
76
- let ct = response. continuation_token . clone ( ) . unwrap ( ) ;
77
- println ! ( "ct == {}" , ct) ;
78
-
79
- let response = client
80
- . list_documents ( )
81
- . consistency_level ( session_token)
82
- . continuation ( ct. as_str ( ) )
83
- . execute :: < MySampleStruct > ( )
84
- . await ?;
76
+ let response = paged. next ( ) . await . unwrap ( ) ?;
85
77
86
78
assert_eq ! ( response. documents. len( ) , 2 ) ;
87
79
println ! ( "response == {:#?}" , response) ;
@@ -101,7 +93,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
101
93
. list_documents ( )
102
94
. consistency_level ( session_token. clone ( ) )
103
95
. max_item_count ( 3 ) ;
104
- let mut stream = Box :: pin ( stream. stream :: < MySampleStruct > ( ) ) ;
96
+ let mut stream = stream. into_stream :: < MySampleStruct > ( ) ;
105
97
// TODO: As soon as the streaming functionality is completed
106
98
// in Rust substitute this while let Some... into
107
99
// for each (or whatever the Rust team picks).
0 commit comments