Struct reqwest_middleware::ClientBuilder
source · pub struct ClientBuilder { /* private fields */ }
Expand description
A ClientBuilder
is used to build a ClientWithMiddleware
.
Implementations§
source§impl ClientBuilder
impl ClientBuilder
pub fn new(client: Client) -> Self
sourcepub fn with<M>(self, middleware: M) -> Selfwhere
M: Middleware,
pub fn with<M>(self, middleware: M) -> Selfwhere
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 with_init<I>(self, initialiser: I) -> Selfwhere
I: RequestInitialiser,
pub fn with_init<I>(self, initialiser: I) -> Selfwhere
I: RequestInitialiser,
Convenience method to attach a request initialiser.
If you need to keep a reference to the initialiser after attaching, use with_arc_init
.
sourcepub fn with_arc_init(self, initialiser: Arc<dyn RequestInitialiser>) -> Self
pub fn with_arc_init(self, initialiser: Arc<dyn RequestInitialiser>) -> Self
Add a request initialiser to the chain. with_init
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 Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
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