11#[ cfg( not( target_arch = "wasm32" ) ) ]
22use crate :: policies:: TransportPolicy ;
33use crate :: policies:: { CustomHeadersInjectorPolicy , Policy , TelemetryPolicy } ;
4- use crate :: { ClientOptions , Error , HttpClient , PipelineContext , Request , Response } ;
4+ use crate :: { ClientOptions , Context , Error , HttpClient , Request , Response } ;
55use std:: sync:: Arc ;
66
77/// Execution pipeline.
@@ -32,18 +32,12 @@ use std::sync::Arc;
3232/// context. For example, in CosmosDB, the generic carries the operation-specific information used by
3333/// the authorization policy.
3434#[ derive( Debug , Clone ) ]
35- pub struct Pipeline < C >
36- where
37- C : Send + Sync ,
38- {
35+ pub struct Pipeline {
3936 http_client : Arc < dyn HttpClient > ,
40- pipeline : Vec < Arc < dyn Policy < C > > > ,
37+ pipeline : Vec < Arc < dyn Policy > > ,
4138}
4239
43- impl < C > Pipeline < C >
44- where
45- C : Send + Sync ,
46- {
40+ impl Pipeline {
4741 /// Creates a new pipeline given the client library crate name and version,
4842 /// alone with user-specified and client library-specified policies.
4943 ///
@@ -52,11 +46,11 @@ where
5246 pub fn new (
5347 crate_name : Option < & ' static str > ,
5448 crate_version : Option < & ' static str > ,
55- options : ClientOptions < C > ,
56- per_call_policies : Vec < Arc < dyn Policy < C > > > ,
57- per_retry_policies : Vec < Arc < dyn Policy < C > > > ,
49+ options : ClientOptions ,
50+ per_call_policies : Vec < Arc < dyn Policy > > ,
51+ per_retry_policies : Vec < Arc < dyn Policy > > ,
5852 ) -> Self {
59- let mut pipeline: Vec < Arc < dyn Policy < C > > > = Vec :: with_capacity (
53+ let mut pipeline: Vec < Arc < dyn Policy > > = Vec :: with_capacity (
6054 options. per_call_policies . len ( )
6155 + per_call_policies. len ( )
6256 + options. per_retry_policies . len ( )
8377 #[ cfg( not( target_arch = "wasm32" ) ) ]
8478 {
8579 #[ allow( unused_mut) ]
86- let mut policy: Arc < dyn Policy < _ > > =
80+ let mut policy: Arc < dyn Policy > =
8781 Arc :: new ( TransportPolicy :: new ( options. transport . clone ( ) ) ) ;
8882
8983 // This code replaces the default transport policy at runtime if these two conditions
@@ -132,23 +126,15 @@ where
132126 self . http_client . as_ref ( )
133127 }
134128
135- pub fn replace_policy (
136- & mut self ,
137- policy : Arc < dyn Policy < C > > ,
138- position : usize ,
139- ) -> Arc < dyn Policy < C > > {
129+ pub fn replace_policy ( & mut self , policy : Arc < dyn Policy > , position : usize ) -> Arc < dyn Policy > {
140130 std:: mem:: replace ( & mut self . pipeline [ position] , policy)
141131 }
142132
143- pub fn policies ( & self ) -> & [ Arc < dyn Policy < C > > ] {
133+ pub fn policies ( & self ) -> & [ Arc < dyn Policy > ] {
144134 & self . pipeline
145135 }
146136
147- pub async fn send (
148- & self ,
149- ctx : & mut PipelineContext < C > ,
150- request : & mut Request ,
151- ) -> Result < Response , Error > {
137+ pub async fn send ( & self , ctx : & mut Context , request : & mut Request ) -> Result < Response , Error > {
152138 self . pipeline [ 0 ]
153139 . send ( ctx, request, & self . pipeline [ 1 ..] )
154140 . await
0 commit comments