Function read_lines

Source
pub fn read_lines<Path: AsRef<str>>(file_path: &Path) -> Result<Vec<String>>
Expand description

Reads the contents of a file and returns it as lines.

§Returns

Result<Vec<String>>

§Examples

fn main() -> std::io::Result<()> {
    Ok({
        let file_path: &str = "Cargo.toml";
        let file_path: String = String::from(file_path);

        let lines: Vec<String> = file_access::read_lines(&file_path)?;
        lines.iter().for_each(|line| println!("{}", line));
    })
}