@@ -6,7 +6,7 @@ mod signature_target;
66
77pub use authorization_policy:: AuthorizationPolicy ;
88use azure_core:: http:: {
9- pager:: PagerState ,
9+ pager:: { PagerOptions , PagerState } ,
1010 request:: { options:: ContentType , Request } ,
1111 response:: Response ,
1212 ClientOptions , Context , Method , RawResponse , RetryOptions ,
@@ -115,25 +115,30 @@ impl CosmosPipeline {
115115 // We have to double-clone here.
116116 // First we clone the pipeline to pass it in to the closure
117117 let pipeline = self . pipeline . clone ( ) ;
118- let ctx = ctx. with_value ( resource_link) . into_owned ( ) ;
119- Ok ( FeedPager :: from_callback ( move |continuation| {
120- // Then we have to clone it again to pass it in to the async block.
121- // This is because Pageable can't borrow any data, it has to own it all.
122- // That's probably good, because it means a Pageable can outlive the client that produced it, but it requires some extra cloning.
123- let pipeline = pipeline. clone ( ) ;
124- let mut req = base_request. clone ( ) ;
125- let ctx = ctx. clone ( ) ;
126- async move {
127- if let PagerState :: More ( continuation) = continuation {
128- req. insert_header ( constants:: CONTINUATION , continuation) ;
118+ let options = PagerOptions {
119+ context : ctx. with_value ( resource_link) . into_owned ( ) ,
120+ } ;
121+ Ok ( FeedPager :: from_callback (
122+ move |continuation, ctx| {
123+ // Then we have to clone it again to pass it in to the async block.
124+ // This is because Pageable can't borrow any data, it has to own it all.
125+ // That's probably good, because it means a Pageable can outlive the client that produced it, but it requires some extra cloning.
126+ let pipeline = pipeline. clone ( ) ;
127+ let mut req = base_request. clone ( ) ;
128+ let ctx = ctx. clone ( ) ;
129+ async move {
130+ if let PagerState :: More ( continuation) = continuation {
131+ req. insert_header ( constants:: CONTINUATION , continuation) ;
132+ }
133+
134+ let resp = pipeline. send ( & ctx, & mut req, None ) . await ?;
135+ let page = FeedPage :: < T > :: from_response ( resp) . await ?;
136+
137+ Ok ( page. into ( ) )
129138 }
130-
131- let resp = pipeline. send ( & ctx, & mut req, None ) . await ?;
132- let page = FeedPage :: < T > :: from_response ( resp) . await ?;
133-
134- Ok ( page. into ( ) )
135- }
136- } ) )
139+ } ,
140+ Some ( options) ,
141+ ) )
137142 }
138143
139144 /// Helper function to read a throughput offer given a resource ID.
0 commit comments