[][src]Function fungus::sys::readlines_p

pub fn readlines_p<T: AsRef<Path>>(path: T) -> Result<Lines<BufReader<File>>>

Returns an Iterator to the Reader of the lines of the file.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_readlines_p");
let tmpfile = tmpdir.mash("file1");
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(sys::mkdir(&tmpdir).is_ok());
assert!(sys::write(&tmpfile, "this is a test").is_ok());
assert_iter_eq(sys::readlines_p(&tmpfile).unwrap().collect::<io::Result<Vec<String>>>().unwrap(), vec![String::from("this is a test")]);
assert!(sys::remove_all(&tmpdir).is_ok());