pub fn save<P: Into<Option<String>>>(&self, path: P) -> anyhow::Result<()> {
        let path = path
            .into()
            .or_else(|| std::env::var("CONFIG_PATH").ok())
            .unwrap_or(CONFIG_PATH.to_string());
        debug!("Saving config to {}", path);
        let path = Path::new(&path);
        if let Some(dir) = path.parent() {
            if !dir.exists() {
                std::fs::create_dir_all(dir)?;
            }
        }
        let f = std::fs::File::create(Path::new(&path))?;

        ron::ser::to_writer_pretty(f, self, ron::ser::PrettyConfig::default()).map_err(|e| anyhow!(e))
    }
/// Save versioned config to a RON file. Will use the first of the following possible locations:
/// 1. Provided path
/// 2. Environment variable CONFIG_PATH
/// 3. Default config path: ./config.ron
Save versioned config to a RON file. Will use the first of the following possible locations:
1. Provided path
2. Environment variable CONFIG_PATH
3.
Save versioned config to a RON file . Will use the first of the following possible locations : 1 . Provided path 2 . Environment variable CONFIG_PATH 3 .
pub fn save<P: Into<Option<String>>>(&self, path: P) -> anyhow::Result<()> {
        let path = path
            .into()
            .or_else(|| std::env::var("CONFIG_PATH").ok())
            .unwrap_or(CONFIG_PATH.to_string());
        debug!("Saving config to {}", path);
        let path = Path::new(&path);
        if let Some(dir) = path.parent() {
            if !dir.exists() {
                std::fs::create_dir_all(dir)?;
            }
        }
        let f = std::fs::File::create(Path::new(&path))?;
        ron::ser::to_writer_pretty(f, self, ron::ser::PrettyConfig::default()).map_err(|e| anyhow!(e))
    }
pub fn save < P : Into < Option < String > > > ( & self , path : P ) -> anyhow :: Result < ( ) > { let path = path . into ( ) . or_else ( | | std :: env :: var ( " " ) . ok ( ) ) . unwrap_or ( CONFIG_PATH . to_string ( ) ) ; debug ! ( " " path ) ; let path = Path :: new ( & path ) ; if let Some ( dir ) = path . parent ( ) { if ! dir . exists ( ) { std :: fs :: create_dir_all ( dir ) ? ; } } let f = std :: fs :: File :: create ( Path :: new ( & path ) ) ? ; ron :: ser :: to_writer_pretty ( f , self , ron :: ser :: PrettyConfig :: default ( ) ) . map_err ( | e | anyhow ! ( e ) ) }
Save versioned config to a RON file.
Save versioned config to a RON file .
&self
path
P