pub struct BasicAuth { /* private fields */ }Expand description
HTTP Basic authentication (Authorization: Basic <base64(username:password)>).
Credentials are encoded per RFC 7617: base64(username ":" password).
Implementations§
Source§impl BasicAuth
impl BasicAuth
Sourcepub fn new(username: &str, password: &str) -> Result<Self, ClientError>
pub fn new(username: &str, password: &str) -> Result<Self, ClientError>
Construct a BasicAuth from a username and password.
§Errors
ClientError::InvalidArgumentifusernamecontains a colon (:), which is forbidden by RFC 7617 §2.ClientError::InvalidHeaderValueif the resulting header value contains characters that are not valid in an HTTP header value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BasicAuth
impl RefUnwindSafe for BasicAuth
impl Send for BasicAuth
impl Sync for BasicAuth
impl Unpin for BasicAuth
impl UnsafeUnpin for BasicAuth
impl UnwindSafe for BasicAuth
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