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.