rubchev 0.1.2

A Rust utility library for strings
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::fs;
use std::io::{self, Write};

/// Reads file contents and returns a Result.
pub fn read_file(path: &str) -> Result<String, String> {
    fs::read_to_string(path).map_err(|e| e.to_string())
}

/// Writes content to a file, overwriting if it exists.
pub fn write_file(path: &str, content: &str) -> Result<(), String> {
    fs::write(path, content).map_err(|e| e.to_string())
}