pub trait Policy:
Send
+ Sync
+ Debug {
// Required method
fn send<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 Context<'_>,
request: &'life2 mut Request,
next: &'life3 [Arc<dyn Policy>],
) -> Pin<Box<dyn Future<Output = Result<AsyncRawResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
}Expand description
A pipeline policy.
Policies are expected to modify the request and then call the subsequent policy. Policies can then inspect the response, potentially signaling failure. The only runtime enforced check is that the last policy must be a Transport policy. It’s up to the implementer to call the subsequent policy.
Required Methods§
Sourcefn send<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 Context<'_>,
request: &'life2 mut Request,
next: &'life3 [Arc<dyn Policy>],
) -> Pin<Box<dyn Future<Output = Result<AsyncRawResponse, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn send<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 Context<'_>,
request: &'life2 mut Request,
next: &'life3 [Arc<dyn Policy>],
) -> Pin<Box<dyn Future<Output = Result<AsyncRawResponse, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Send the request through this policy and the subsequent policies in the pipeline.
§Arguments
ctx- The context for the request.request- The mutable reference to the request to be sent.next- The slice of subsequent policies to call after this one.
§Returns
A PolicyResult containing either the RawResponse or an error if the request failed at any point in the pipeline.