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 from_client(client_with_middleware: ClientWithMiddleware) -> Self
pub fn from_client(client_with_middleware: ClientWithMiddleware) -> Self
This method allows creating a ClientBuilder from an existing ClientWithMiddleware instance
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