[go: up one dir, main page]

read_text_file

Function read_text_file 

Source
pub fn read_text_file<T: AsPath + ?Sized>(path: &T) -> FsIOResult<String>
Expand description

Reads the requested text file and returns its content.

§Arguments

  • path - The file path

§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");
}