Skip to main content

read_file

Function read_file 

Source
pub fn read_file<P: AsRef<Path>>(path: P) -> Result<String>
Expand description

Reads a file to string, automatically choosing the best method.

§Arguments

  • path - Path to the file.

§Errors

Returns an error if the file cannot be read or is not valid UTF-8.

§Examples

use rlm_rs::io::read_file;

let content = read_file("example.txt").unwrap();