nom-tutorial icon indicating copy to clipboard operation
nom-tutorial copied to clipboard

References to removed ParseError in tutorial

Open Brian-Williams opened this issue 4 years ago • 0 comments

The tutorial references the ParseError, which was removed in commit 34cd46621333971a05f28ce22b7edb18baa31ba3 https://github.com/benkay86/nom-tutorial/blame/master/README.md#L551.

I was able to get it working with the following, but don't think it's a great solution as it's incompatible with the src version:

pub fn mounts() -> Result<(), Box<dyn Error>> {
	let file = std::fs::File::open("/proc/mounts")?;
	let buf_reader = std::io::BufReader::new(file);
	for line in buf_reader.lines() {
        match parsers::parse_line(&line?[..]) {
            Ok( (_, m) ) => {
				println!("{}", m);
			},
			Err(e) => return Err(e.to_owned().into())
        }
	}
	Ok(())
}

Brian-Williams avatar Sep 18 '20 02:09 Brian-Williams