pub fn read(path: String) -> Result<String, String>Expand description
Reads a file as a UTF-8 string.
§Arguments
path- Path to the file (relative or absolute)
§Returns
The file contents as a string, or an error message describing the failure.
§Errors
Returns an error if:
- The file doesn’t exist
- The file can’t be read (permissions, I/O error)
- The file contents aren’t valid UTF-8
§Example
use logicaffeine_system::file;
match file::read("config.json".to_string()) {
Ok(content) => println!("Config: {}", content),
Err(e) => eprintln!("Error: {}", e),
}