pub struct TmcConfig {
pub location: PathBuf,
pub projects_dir: PathBuf,
pub table: Table,
}Expand description
The main configuration file. A separate one is used for each client.
Fields§
§location: PathBuf§projects_dir: PathBuf§table: TableImplementations§
Source§impl TmcConfig
impl TmcConfig
Sourcepub fn load(client_name: &str) -> Result<TmcConfig, LangsError>
pub fn load(client_name: &str) -> Result<TmcConfig, LangsError>
Reads or initialises the config for the given client.
Sourcepub fn load_from(
client_name: &str,
path: PathBuf,
) -> Result<TmcConfig, LangsError>
pub fn load_from( client_name: &str, path: PathBuf, ) -> Result<TmcConfig, LangsError>
Reads or initialises for the client from the given path.
Sourcepub fn get_projects_dir(&self) -> &Path
pub fn get_projects_dir(&self) -> &Path
Returns the projects dir.
Sourcepub fn set_projects_dir(
&mut self,
target: PathBuf,
) -> Result<PathBuf, LangsError>
pub fn set_projects_dir( &mut self, target: PathBuf, ) -> Result<PathBuf, LangsError>
Sets the projects dir. Returns the old projects dir.
Sourcepub fn insert(&mut self, key: String, value: Value) -> Option<Value>
pub fn insert(&mut self, key: String, value: Value) -> Option<Value>
Inserts a value with the given key and value. Returns the old value, if any.
Sourcepub fn remove(&mut self, key: &str) -> Option<Value>
pub fn remove(&mut self, key: &str) -> Option<Value>
Removes the value with the given key. Returns the removed value, if any.
Sourcepub fn save(&mut self) -> Result<(), LangsError>
pub fn save(&mut self) -> Result<(), LangsError>
Saves the config struct to the given path.
pub fn get_location(client_name: &str) -> Result<PathBuf, LangsError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TmcConfig
impl<'de> Deserialize<'de> for TmcConfig
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 Freeze for TmcConfig
impl RefUnwindSafe for TmcConfig
impl Send for TmcConfig
impl Sync for TmcConfig
impl Unpin for TmcConfig
impl UnwindSafe for TmcConfig
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