Trait anterofit::net::intercept::Interceptor [−][src]
pub trait Interceptor: Send + Sync + 'static { fn intercept(&self, req: &mut RequestHead); fn chain<I>(self, then: I) -> Chain<Self, I>
where
Self: Sized,
I: Interceptor, { ... } fn chain2<I1, I2>(self, then: I1, after: I2) -> Chain2<Self, I1, I2>
where
Self: Sized,
I1: Interceptor,
I2: Interceptor, { ... } fn debug(&self, f: &mut Formatter) -> Result { ... } }
A trait describing a type which may intercept and modify outgoing request from an adapter instance.
Implemented for Fn(&mut RequestHead) + Send + Sync + 'static
.
Required Methods
fn intercept(&self, req: &mut RequestHead)
Modify the request head in any way desired.
Great care must be taken to not introduce logic errors in service methods (i.e. by changing their endpoints such that they receive unexpected responses).
Provided Methods
fn chain<I>(self, then: I) -> Chain<Self, I> where
Self: Sized,
I: Interceptor,
Self: Sized,
I: Interceptor,
Chain self
with then
, invoking self
then then
for each request.
fn chain2<I1, I2>(self, then: I1, after: I2) -> Chain2<Self, I1, I2> where
Self: Sized,
I1: Interceptor,
I2: Interceptor,
Self: Sized,
I1: Interceptor,
I2: Interceptor,
Chain self
with two more interceptors.
Saves a level in debug printing, mainly.
fn debug(&self, f: &mut Formatter) -> Result
Write debug output equivalent to std::fmt::Debug
.
Trait Implementations
impl Debug for Interceptor
[src]
impl Debug for Interceptor
Implementations on Foreign Types
impl<I: Interceptor + ?Sized> Interceptor for Arc<I>
[src]
impl<I: Interceptor + ?Sized> Interceptor for Arc<I>
fn intercept(&self, req: &mut RequestHead)
[src]
fn intercept(&self, req: &mut RequestHead)
fn chain<I>(self, then: I) -> Chain<Self, I> where
Self: Sized,
I: Interceptor,
[src]
fn chain<I>(self, then: I) -> Chain<Self, I> where
Self: Sized,
I: Interceptor,
fn chain2<I1, I2>(self, then: I1, after: I2) -> Chain2<Self, I1, I2> where
Self: Sized,
I1: Interceptor,
I2: Interceptor,
[src]
fn chain2<I1, I2>(self, then: I1, after: I2) -> Chain2<Self, I1, I2> where
Self: Sized,
I1: Interceptor,
I2: Interceptor,
fn debug(&self, f: &mut Formatter) -> Result
[src]
fn debug(&self, f: &mut Formatter) -> Result
Implementors
impl<F> Interceptor for F where
F: Fn(&mut RequestHead) + Send + Sync + 'static,impl<I1: Interceptor, I2: Interceptor> Interceptor for Chain<I1, I2>
impl<I1: Interceptor, I2: Interceptor, I3: Interceptor> Interceptor for Chain2<I1, I2, I3>
impl Interceptor for NoIntercept
impl<H: Header + HeaderFormat> Interceptor for AddHeader<H>
impl<S: AsRef<str> + Send + Sync + 'static> Interceptor for PrependUrl<S>
impl<S: AsRef<str> + Send + Sync + 'static> Interceptor for AppendUrl<S>
impl Interceptor for AppendQuery