pub struct Builder<C, I, L, R> { /* private fields */ }Available on crate feature
client and crate feature client-pool and docsrs only.Expand description
A builder to configure a Negotiate.
§Unnameable
This type is normally unnameable, forbidding naming of the type within code. The type is exposed in the documentation to show which methods can be publicly called.
Implementations§
Source§impl<C, I, L, R> Builder<C, I, L, R>
impl<C, I, L, R> Builder<C, I, L, R>
Sourcepub fn inspect<II>(self, inspect: II) -> Builder<C, II, L, R>
pub fn inspect<II>(self, inspect: II) -> Builder<C, II, L, R>
Provide the inspector that determines the result of the negotiation.
Sourcepub fn fallback<LL>(self, fallback: LL) -> Builder<C, I, LL, R>
pub fn fallback<LL>(self, fallback: LL) -> Builder<C, I, LL, R>
Provide the layer to fallback to if negotiation fails.
Sourcepub fn upgrade<RR>(self, upgrade: RR) -> Builder<C, I, L, RR>
pub fn upgrade<RR>(self, upgrade: RR) -> Builder<C, I, L, RR>
Provide the layer to upgrade to if negotiation succeeds.
Sourcepub fn build<Dst>(self) -> Negotiate<L::Service, R::Service>where
C: Service<Dst>,
C::Error: Into<Box<dyn Error + Send + Sync>>,
L: Layer<Inspector<C, C::Response, I>>,
L::Service: Service<Dst> + Clone,
<L::Service as Service<Dst>>::Error: Into<Box<dyn Error + Send + Sync>>,
R: Layer<Inspected<C::Response>>,
R::Service: Service<()> + Clone,
<R::Service as Service<()>>::Error: Into<Box<dyn Error + Send + Sync>>,
I: Fn(&C::Response) -> bool + Clone,
pub fn build<Dst>(self) -> Negotiate<L::Service, R::Service>where
C: Service<Dst>,
C::Error: Into<Box<dyn Error + Send + Sync>>,
L: Layer<Inspector<C, C::Response, I>>,
L::Service: Service<Dst> + Clone,
<L::Service as Service<Dst>>::Error: Into<Box<dyn Error + Send + Sync>>,
R: Layer<Inspected<C::Response>>,
R::Service: Service<()> + Clone,
<R::Service as Service<()>>::Error: Into<Box<dyn Error + Send + Sync>>,
I: Fn(&C::Response) -> bool + Clone,
Build the Negotiate pool.
Trait Implementations§
Auto Trait Implementations§
impl<C, I, L, R> Freeze for Builder<C, I, L, R>
impl<C, I, L, R> RefUnwindSafe for Builder<C, I, L, R>
impl<C, I, L, R> Send for Builder<C, I, L, R>
impl<C, I, L, R> Sync for Builder<C, I, L, R>
impl<C, I, L, R> Unpin for Builder<C, I, L, R>
impl<C, I, L, R> UnwindSafe for Builder<C, I, L, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more