Function fsio::file::write_text_file
source · [−]Expand description
Creates and writes the text to the requested file path. If a file exists at that path, it will be overwritten.
Arguments
path
- The file pathtext
- The file text content
Example
use crate::fsio::file;
use std::path::Path;
fn main() {
let file_path = "./target/__test/file_test/write_text_file/file.txt";
let result = file::write_text_file(file_path, "some content");
assert!(result.is_ok());
let text = file::read_text_file(file_path).unwrap();
assert_eq!(text, "some content");
}