@@ -58,12 +58,13 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
5858 println ! ( "Created 5 documents." ) ;
5959
6060 // Let's get 3 entries at a time.
61- let response = client
61+ let mut paged = client
6262 . list_documents ( )
6363 . consistency_level ( response. unwrap ( ) )
6464 . max_item_count ( 3i32 )
65- . execute :: < MySampleStruct > ( )
66- . await ?;
65+ . into_stream :: < MySampleStruct > ( ) ;
66+
67+ let response = paged. next ( ) . await . unwrap ( ) ?;
6768
6869 assert_eq ! ( response. documents. len( ) , 3 ) ;
6970 println ! ( "response == {:#?}" , response) ;
@@ -72,16 +73,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
7273 // continuation_token must be present
7374 assert ! ( response. continuation_token. is_some( ) ) ;
7475
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 ( ) ?;
8577
8678 assert_eq ! ( response. documents. len( ) , 2 ) ;
8779 println ! ( "response == {:#?}" , response) ;
@@ -101,7 +93,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
10193 . list_documents ( )
10294 . consistency_level ( session_token. clone ( ) )
10395 . max_item_count ( 3 ) ;
104- let mut stream = Box :: pin ( stream. stream :: < MySampleStruct > ( ) ) ;
96+ let mut stream = stream. into_stream :: < MySampleStruct > ( ) ;
10597 // TODO: As soon as the streaming functionality is completed
10698 // in Rust substitute this while let Some... into
10799 // for each (or whatever the Rust team picks).
0 commit comments