Expand description
Reads a file from disk and returns its contents as a std::io::Result<String>
.
You would use this function to read both the settings and defaults file, before
passing their contents to crate::deserialize()
and crate::merge()
.
Reading a file into a String
This shows how to obtain a std::io::Result
that wraps a String
.
if let Ok(file_contents) = renvy::read_file("/path/to/my/.env") {
println!("File contents: {}", &file_contents);
}
You can reuse the same function for reading the settings file as well as the defaults file.