pub struct ClientBuilder { /* private fields */ }Expand description
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn username(self, username: impl Into<String>) -> Self
pub fn username(self, username: impl Into<String>) -> Self
Sets the Librus username.
§Example
use librus_rs::ClientBuilder;
let builder = ClientBuilder::new().username("my_username");Sourcepub fn password(self, password: impl Into<String>) -> Self
pub fn password(self, password: impl Into<String>) -> Self
Sets the Librus password.
§Example
use librus_rs::ClientBuilder;
let builder = ClientBuilder::new()
.username("my_username")
.password("my_password");Sourcepub async fn build(self) -> Result<Client>
pub async fn build(self) -> Result<Client>
Builds and authenticates the client.
This method consumes the builder and attempts to authenticate with Librus.
§Errors
Returns an error if:
- Username is missing (
Error::MissingCredentials) - Password is missing (
Error::MissingCredentials) - Authentication fails (
Error::Authentication) - Network error occurs (
Error::Request)
§Example
use librus_rs::ClientBuilder;
let client = ClientBuilder::new()
.username("my_username")
.password("my_password")
.build()
.await?;Trait Implementations§
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 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