pub struct ProfilesConfig {
pub version: u32,
pub profiles: HashMap<String, Profile>,
}Expand description
Root configuration structure with versioning for future migration
Fields§
§version: u32§profiles: HashMap<String, Profile>Implementations§
Source§impl ProfilesConfig
impl ProfilesConfig
pub fn new() -> Self
Sourcepub fn set(&mut self, name: String, profile: Profile)
pub fn set(&mut self, name: String, profile: Profile)
Add or update a profile This method allows overwriting existing profiles
Sourcepub fn add(
&mut self,
name: String,
profile: Profile,
) -> Result<(), ProfileError>
pub fn add( &mut self, name: String, profile: Profile, ) -> Result<(), ProfileError>
Add a new profile, returning an error if the name already exists
Sourcepub fn set_or_update(
&mut self,
name: String,
profile: Profile,
) -> Result<(), ProfileError>
pub fn set_or_update( &mut self, name: String, profile: Profile, ) -> Result<(), ProfileError>
Update or create a profile for a given (team_id, user_id) pair If a profile with the same (team_id, user_id) exists, it will be updated If the profile name already exists but points to a different (team_id, user_id), returns an error PLACEHOLDER values are treated specially: they are always replaced by real values
Sourcepub fn list_names(&self) -> Vec<String>
pub fn list_names(&self) -> Vec<String>
List all profile names
Trait Implementations§
Source§impl Clone for ProfilesConfig
impl Clone for ProfilesConfig
Source§fn clone(&self) -> ProfilesConfig
fn clone(&self) -> ProfilesConfig
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 ProfilesConfig
impl Debug for ProfilesConfig
Source§impl Default for ProfilesConfig
impl Default for ProfilesConfig
Source§impl<'de> Deserialize<'de> for ProfilesConfig
impl<'de> Deserialize<'de> for ProfilesConfig
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
Source§impl PartialEq for ProfilesConfig
impl PartialEq for ProfilesConfig
Source§impl Serialize for ProfilesConfig
impl Serialize for ProfilesConfig
impl StructuralPartialEq for ProfilesConfig
Auto Trait Implementations§
impl Freeze for ProfilesConfig
impl RefUnwindSafe for ProfilesConfig
impl Send for ProfilesConfig
impl Sync for ProfilesConfig
impl Unpin for ProfilesConfig
impl UnwindSafe for ProfilesConfig
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