pub struct ProviderConfig {
pub sections: Vec<ProviderSection>,
pub path_override: Option<PathBuf>,
}Expand description
Parsed provider configuration from ~/.purple/providers.
Fields§
§sections: Vec<ProviderSection>§path_override: Option<PathBuf>Override path for save(). None uses the default ~/.purple/providers. Set to Some in tests to avoid writing to the real config.
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn load() -> Self
pub fn load() -> Self
Load provider config from ~/.purple/providers. Returns empty config if file doesn’t exist (normal first-use). Prints a warning to stderr on real IO errors (permissions, etc.).
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Save provider config to ~/.purple/providers (atomic write, chmod 600). Respects path_override when set (used in tests).
Sourcepub fn section(&self, provider: &str) -> Option<&ProviderSection>
pub fn section(&self, provider: &str) -> Option<&ProviderSection>
Get a configured provider section by name.
Sourcepub fn set_section(&mut self, section: ProviderSection)
pub fn set_section(&mut self, section: ProviderSection)
Add or replace a provider section.
Sourcepub fn remove_section(&mut self, provider: &str)
pub fn remove_section(&mut self, provider: &str)
Remove a provider section.
Sourcepub fn configured_providers(&self) -> &[ProviderSection]
pub fn configured_providers(&self) -> &[ProviderSection]
Get all configured provider sections.
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Source§fn clone(&self) -> ProviderConfig
fn clone(&self) -> ProviderConfig
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 ProviderConfig
impl Debug for ProviderConfig
Source§impl Default for ProviderConfig
impl Default for ProviderConfig
Source§fn default() -> ProviderConfig
fn default() -> ProviderConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ProviderConfig
impl RefUnwindSafe for ProviderConfig
impl Send for ProviderConfig
impl Sync for ProviderConfig
impl Unpin for ProviderConfig
impl UnsafeUnpin for ProviderConfig
impl UnwindSafe for ProviderConfig
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