pub struct ConfigFile {
pub default: Option<String>,
pub profiles: Vec<(String, Profile)>,
pub language: Option<String>,
pub history_retention: Option<String>,
pub history_interval: Option<String>,
}Expand description
The whole file: the default profile and the profiles, in the order they were created.
Fields§
§default: Option<String>§profiles: Vec<(String, Profile)>§language: Option<String>ui.language: the interface language the person chose (doc 34, section 8).
history_retention: Option<String>history.retention and history.interval of the interface, as written (1h, 5s).
history_interval: Option<String>Implementations§
Source§impl ConfigFile
impl ConfigFile
pub fn get(&self, name: &str) -> Option<&Profile>
pub fn get_mut(&mut self, name: &str) -> Option<&mut Profile>
pub fn names(&self) -> Vec<&str>
Sourcepub fn add(&mut self, name: &str, profile: Profile) -> Result<(), String>
pub fn add(&mut self, name: &str, profile: Profile) -> Result<(), String>
Creates a profile. The file’s first profile becomes the default. Error if the name already exists.
Sourcepub fn remove(&mut self, name: &str) -> Result<(), String>
pub fn remove(&mut self, name: &str) -> Result<(), String>
Removes a profile; if it was the default, the file is left with no default.
pub fn set_default(&mut self, name: &str) -> Result<(), String>
pub fn parse(text: &str) -> Result<ConfigFile, String>
pub fn render(&self) -> String
Trait Implementations§
Source§impl Clone for ConfigFile
impl Clone for ConfigFile
Source§impl Debug for ConfigFile
impl Debug for ConfigFile
Source§impl Default for ConfigFile
impl Default for ConfigFile
impl Eq for ConfigFile
Source§impl PartialEq for ConfigFile
impl PartialEq for ConfigFile
impl StructuralPartialEq for ConfigFile
Auto Trait Implementations§
impl Freeze for ConfigFile
impl RefUnwindSafe for ConfigFile
impl Send for ConfigFile
impl Sync for ConfigFile
impl Unpin for ConfigFile
impl UnsafeUnpin for ConfigFile
impl UnwindSafe for ConfigFile
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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 more