pub struct Config { /* private fields */ }
Implementations§
Source§impl Config
impl Config
Sourcepub fn get_directory(&self) -> String
pub fn get_directory(&self) -> String
Sourcepub fn set_directory(&mut self, new_directory: &str) -> Result<()>
pub fn set_directory(&mut self, new_directory: &str) -> Result<()>
Sourcepub fn get_languages(&self) -> Vec<String>
pub fn get_languages(&self) -> Vec<String>
Sourcepub fn add_language(&mut self, language: String) -> Result<()>
pub fn add_language(&mut self, language: String) -> Result<()>
Add a new language to the languages list if it does not exist.
§Example
ⓘ
use languages_rs::Config;
let mut config = Config::default().unwrap();
assert_eq!(config.get_languages(), Vec::<String>::new());
assert!(config.add_language(String::from("en")).is_ok());
assert_eq!(config.get_languages(), vec![String::from("en")]);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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