Struct megamind::ClientBuilder
source · pub struct ClientBuilder { /* private fields */ }
Expand description
Builder for Client
s.
Implementations§
source§impl ClientBuilder
impl ClientBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new ClientBuilder
.
Returns
A new ClientBuilder
, with the base API URL configured to the production API URL.
sourcepub fn auth_token<S: Into<String>>(self, auth_token: S) -> Self
pub fn auth_token<S: Into<String>>(self, auth_token: S) -> Self
Set the auth token.
Note: does not protect you from entering invalid tokens (e.g., an empty string, an expired token, token with invalid characters, etc.).
Args
auth_token
- The auth token for API requests.
Returns
The modified ClientBuilder
.
sourcepub fn build(self) -> Result<Client, ClientBuilderError>
pub fn build(self) -> Result<Client, ClientBuilderError>
Build a Client
.
Returns
A configured Client
.
ClientBuilderError
s can occur if the auth token is missing or contains invalid characters.
ClientBuilderError::ReqwestBuilder
can technically happen but it wouldn’t be clear as to why it would occur.
Trait Implementations§
source§impl Clone for ClientBuilder
impl Clone for ClientBuilder
source§fn clone(&self) -> ClientBuilder
fn clone(&self) -> ClientBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ClientBuilder
impl Debug for ClientBuilder
source§impl Default for ClientBuilder
impl Default for ClientBuilder
source§fn default() -> ClientBuilder
fn default() -> ClientBuilder
Returns the “default value” for a type. Read more
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§
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