pub fn for_each<F: FnMut(&[u8]) -> io::Result<bool>>(&mut self, mut f: F) -> io::Result<()> {
        while let Some(line) = self.next_line() {
            if !f(line?)? {
                break;
            }
        }

        Ok(())
    }
/// Run the given closure for each line while while the closure returns `Ok(true)`.
///
/// If either the reader or the closure return an error, iteration ends and the error is returned.
///
/// ```no_run
/// # use linereader::LineReader;
/// # use std::fs::File;
/// # use std::io;
/// # fn x() -> io::Result<()> {
/// let buf: &[u8] = b"foo\nbar\nbaz";
/// let mut reader = LineReader::new(buf);
/// let mut lines = vec![];
/// reader.for_each(|line| {
///     lines.push(line.to_vec());
///     Ok(true)
/// })?;
/// assert_eq!(lines.len(), 3);
/// assert_eq!(lines[0], b"foo\n");
/// assert_eq!(lines[1], b"bar\n");
/// assert_eq!(lines[2], b"baz");
/// # Ok(())
/// # }
/// ```
Run the given closure for each line while while the closure returns `Ok(true)`.
If either the reader or the closure return an error, iteration ends and the error is returned.


Run the given closure for each line while while the closure returns ` Ok ( true ) ` . If either the reader or the closure return an error iteration ends and the error is returned .
pub fn for_each<F: FnMut(&[u8]) -> io::Result<bool>>(&mut self, mut f: F) -> io::Result<()> {
        while let Some(line) = self.next_line() {
            if !f(line?)? {
                break;
            }
        }
        Ok(())
    }
pub fn for_each < F : FnMut ( & [ u8 ] ) -> io :: Result < bool > > ( & mut self , mut f : F ) -> io :: Result < ( ) > { while let Some ( line ) = self . next_line ( ) { if ! f ( line ? ) ? { break ; } } Ok ( ( ) ) }
Run the given closure for each line while while the closure returns `Ok(true)`.
Run the given closure for each line while while the closure returns ` Ok ( true ) ` .
&mut self
f
F
&mut self
f
F
use linereader::linereader;
None
use std::fs::file;
None
use std::io;
None
fn x() -> io::result<()> {
let buf: &[u8] = b"foo\nbar\nbaz";
let mut reader = LineReader::new(buf);
let mut lines = vec![];
reader.for_each(|line| {
lines.push(line.to_vec());
Ok(true)
})?;
assert_eq!(lines.len(), 3);
assert_eq!(lines[0], b"foo\n");
assert_eq!(lines[1], b"bar\n");
assert_eq!(lines[2], b"baz").
let buf : & [ u8 ] = b " foo \ nbar \ nbaz " ; let mut reader = LineReader :: new ( buf ) ; let mut lines = vec! [] ; reader . for_each ( |line| { lines . push ( line . to_vec () ) ; Ok ( true ) } ) ? ; assert_eq! ( lines . len () 3 ) ; assert_eq! ( lines [ 0 ] b " foo \ n " ) ; assert_eq! ( lines [ 1 ] b " bar \ n " ) ; assert_eq! ( lines [ 2 ] b " baz " ) .
ok(())
None
}
None