pub struct HttpClientBuilder { /* private fields */ }Expand description
Builder for HttpClient.
Implementations§
Source§impl HttpClientBuilder
impl HttpClientBuilder
Sourcepub fn new<T>(url: T) -> Self
pub fn new<T>(url: T) -> Self
Creates a new builder instance with url.
All configurations are set to default.
Sourcepub fn with_host<S>(host: S) -> Self
pub fn with_host<S>(host: S) -> Self
Creates a new builder instance with the given host name host.
This method configures the builder with a URL of the form https://{host}/api/.
All other configurations are set to default.
Sourcepub fn header<K, V>(self, key: K, value: V) -> Selfwhere
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
K::Error: Into<Error>,
V::Error: Into<Error>,
pub fn header<K, V>(self, key: K, value: V) -> Selfwhere
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
K::Error: Into<Error>,
V::Error: Into<Error>,
Sets an additional header for all requests.
Sourcepub fn build(self) -> Result<HttpClient, Error>
pub fn build(self) -> Result<HttpClient, Error>
Finish this builder instance and build HttpClient.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HttpClientBuilder
impl !RefUnwindSafe for HttpClientBuilder
impl Send for HttpClientBuilder
impl Sync for HttpClientBuilder
impl Unpin for HttpClientBuilder
impl !UnwindSafe for HttpClientBuilder
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