Struct reqwest_middleware::ClientBuilder
source · [−]pub struct ClientBuilder { /* private fields */ }
Expand description
A ClientBuilder
is used to build a ClientWithMiddleware
.
Implementations
sourceimpl ClientBuilder
impl ClientBuilder
pub fn new(client: Client) -> Self
sourcepub fn with<M>(self, middleware: M) -> Self where
M: Middleware,
pub fn with<M>(self, middleware: M) -> Self where
M: Middleware,
Convenience method to attach middleware.
If you need to keep a reference to the middleware after attaching, use with_arc
.
sourcepub fn with_arc(self, middleware: Arc<dyn Middleware>) -> Self
pub fn with_arc(self, middleware: Arc<dyn Middleware>) -> Self
Add middleware to the chain. with
is more ergonomic if you don’t need the Arc
.
sourcepub fn build(self) -> ClientWithMiddleware
pub fn build(self) -> ClientWithMiddleware
Returns a ClientWithMiddleware
using this builder configuration.
Auto Trait Implementations
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more