fix mistake in Config::load and Config::save docs (fixes #256)

This commit is contained in:
Aaron Weiss 2024-03-18 16:06:39 -07:00
parent b5a017a58b
commit f640e49571
No known key found for this signature in database
GPG key ID: A932353BB65E4960

View file

@ -242,7 +242,7 @@ impl Config {
/// Loads a configuration from the desired path. This will use the file extension to detect /// Loads a configuration from the desired path. This will use the file extension to detect
/// which format to parse the file as (json, toml, or yaml). Using each format requires having /// which format to parse the file as (json, toml, or yaml). Using each format requires having
/// its respective crate feature enabled. Only json is available by default. /// its respective crate feature enabled. Only toml is available by default.
pub fn load<P: AsRef<Path>>(path: P) -> Result<Config> { pub fn load<P: AsRef<Path>>(path: P) -> Result<Config> {
let mut file = File::open(&path)?; let mut file = File::open(&path)?;
let mut data = String::new(); let mut data = String::new();
@ -317,7 +317,7 @@ impl Config {
/// Saves a configuration to the desired path. This will use the file extension to detect /// Saves a configuration to the desired path. This will use the file extension to detect
/// which format to parse the file as (json, toml, or yaml). Using each format requires having /// which format to parse the file as (json, toml, or yaml). Using each format requires having
/// its respective crate feature enabled. Only json is available by default. /// its respective crate feature enabled. Only toml is available by default.
pub fn save<P: AsRef<Path>>(&mut self, path: P) -> Result<()> { pub fn save<P: AsRef<Path>>(&mut self, path: P) -> Result<()> {
let _ = self.path.take(); let _ = self.path.take();
let mut file = File::create(&path)?; let mut file = File::create(&path)?;