pub struct BasicAuth {
pub username: String,
pub password: String,
}Expand description
HTTP Basic credentials for the opencode server.
opencode uses Basic auth only when it was launched with a password; against a
no-auth server the transport is constructed without any BasicAuth.
Fields§
§username: StringBasic auth username. Defaults to DEFAULT_USERNAME in
BasicAuth::from_env.
password: StringBasic auth password (the value opencode was started with).
Implementations§
Source§impl BasicAuth
impl BasicAuth
Sourcepub fn new(username: impl Into<String>, password: impl Into<String>) -> Self
pub fn new(username: impl Into<String>, password: impl Into<String>) -> Self
Construct credentials from an explicit username and password.
Sourcepub fn from_env() -> Option<Self>
pub fn from_env() -> Option<Self>
Build credentials from OPENCODE_SERVER_PASSWORD, using DEFAULT_USERNAME
as the username.
Returns None when the variable is unset or empty. This is the only
place the crate consults the environment for auth; request paths never do.
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