pub struct UserConfig {
pub id: String,
pub name: String,
pub email: Option<String>,
pub accounts: Vec<AccountConfig>,
pub active: bool,
}Expand description
Configuration for a single user.
Fields§
§id: StringUnique user identifier.
name: StringHuman-readable user name.
email: Option<String>Email address (optional).
accounts: Vec<AccountConfig>User’s accounts.
active: boolWhether the user is active.
Implementations§
Source§impl UserConfig
impl UserConfig
Sourcepub fn new(id: impl Into<String>, name: impl Into<String>) -> Self
pub fn new(id: impl Into<String>, name: impl Into<String>) -> Self
Creates a new user configuration.
Sourcepub fn add_account(&mut self, account: AccountConfig)
pub fn add_account(&mut self, account: AccountConfig)
Adds an account to the user.
Sourcepub fn get_account(&self, id: &str) -> Option<&AccountConfig>
pub fn get_account(&self, id: &str) -> Option<&AccountConfig>
Gets an account by ID.
Sourcepub fn active_accounts(&self) -> impl Iterator<Item = &AccountConfig>
pub fn active_accounts(&self) -> impl Iterator<Item = &AccountConfig>
Returns all active accounts.
Trait Implementations§
Source§impl Clone for UserConfig
impl Clone for UserConfig
Source§impl Debug for UserConfig
impl Debug for UserConfig
Source§impl<'de> Deserialize<'de> for UserConfig
impl<'de> Deserialize<'de> for UserConfig
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 Forget for UserConfig
impl Freeze for UserConfig
impl Move for UserConfig
impl RefUnwindSafe for UserConfig
impl Send for UserConfig
impl Sync for UserConfig
impl Unpin for UserConfig
impl UnsafeUnpin for UserConfig
impl UnwindSafe for UserConfig
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