pub struct AccountsConfig {
pub active_account: Option<String>,
pub accounts: HashMap<String, AccountConfig>,
}Expand description
All accounts configuration
Fields§
§active_account: Option<String>§accounts: HashMap<String, AccountConfig>Implementations§
Source§impl AccountsConfig
impl AccountsConfig
Sourcepub fn get_account(&self, alias: &str) -> Option<&AccountConfig>
pub fn get_account(&self, alias: &str) -> Option<&AccountConfig>
Get an account by alias
Sourcepub fn get_account_mut(&mut self, alias: &str) -> Option<&mut AccountConfig>
pub fn get_account_mut(&mut self, alias: &str) -> Option<&mut AccountConfig>
Get an account by alias (mutable)
Sourcepub fn add_account(&mut self, account: AccountConfig)
pub fn add_account(&mut self, account: AccountConfig)
Add or update an account
Sourcepub fn remove_account(&mut self, alias: &str) -> bool
pub fn remove_account(&mut self, alias: &str) -> bool
Remove an account
Sourcepub fn list_accounts(&self) -> Vec<&AccountConfig>
pub fn list_accounts(&self) -> Vec<&AccountConfig>
List all accounts
Sourcepub fn set_active_account(&mut self, alias: &str) -> Result<()>
pub fn set_active_account(&mut self, alias: &str) -> Result<()>
Set an account as active
Sourcepub fn get_active_account(&self) -> Option<&AccountConfig>
pub fn get_active_account(&self) -> Option<&AccountConfig>
Get the active account
Sourcepub fn get_active_alias(&self) -> Option<&str>
pub fn get_active_alias(&self) -> Option<&str>
Get active account alias
Sourcepub fn get_key_id(account_alias: &str, auth_type: &str) -> String
pub fn get_key_id(account_alias: &str, auth_type: &str) -> String
Get a unique key ID for an account and auth method
Trait Implementations§
Source§impl Clone for AccountsConfig
impl Clone for AccountsConfig
Source§fn clone(&self) -> AccountsConfig
fn clone(&self) -> AccountsConfig
Returns a duplicate 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 AccountsConfig
impl Debug for AccountsConfig
Source§impl Default for AccountsConfig
impl Default for AccountsConfig
Source§fn default() -> AccountsConfig
fn default() -> AccountsConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AccountsConfig
impl<'de> Deserialize<'de> for AccountsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AccountsConfig
impl RefUnwindSafe for AccountsConfig
impl Send for AccountsConfig
impl Sync for AccountsConfig
impl Unpin for AccountsConfig
impl UnwindSafe for AccountsConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.