We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using this library to get the first N amount of lines from a file in reverse... my current implementation is this:
fn lines_from_file(file: &File, limit: usize) -> Vec<String> { let mut vec = vec![]; let rev_lines = RevLines::new(file); for (i, line) in rev_lines.enumerate() { match line { Ok(line) => vec.push(line), Err(e) => panic!("RevLinesError in lines_from_file: {}", e), } if i == limit { break; } } return vec; }
Ideally, if the FromIterator<String, RevLinesError> interface was implemented I could do roughly something like this:
fn lines_from_file(file: &File, limit: usize) -> Vec<String> { let rev_lines = RevLines::new(file); rev_lines.take(limit).collect() }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am using this library to get the first N amount of lines from a file in reverse... my current implementation is this:
Ideally, if the FromIterator<String, RevLinesError> interface was implemented I could do roughly something like this:
The text was updated successfully, but these errors were encountered: