pub struct PersistedConfig {
pub config_path: String,
}
Expand description
PersistedConfig is a struct that represents a persisted config.
Fields§
§config_path: String
The path to the config directory.
Implementations§
Source§impl PersistedConfig
impl PersistedConfig
Sourcepub fn new(config_path: &str) -> PersistedConfig
pub fn new(config_path: &str) -> PersistedConfig
Sourcepub fn save_config(&self, file_name: &str, data: &str) -> Result<(), Error>
pub fn save_config(&self, file_name: &str, data: &str) -> Result<(), Error>
Save config file.
§Arguments
file_name
- The name of the config file.data
- The data to be saved.
§Examples
use persisted_config_rs::PersistedConfig;
fn main() -> Result<(), std::io::Error> {
let file_name = "test.txt";
let data = "Hello, world!";
PersistedConfig::new("config").save_config(file_name, data)?;
Ok(())
}
Auto Trait Implementations§
impl Freeze for PersistedConfig
impl RefUnwindSafe for PersistedConfig
impl Send for PersistedConfig
impl Sync for PersistedConfig
impl Unpin for PersistedConfig
impl UnwindSafe for PersistedConfig
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