pub struct ScanLines<R: Read> { /* private fields */ }
Expand description
used to generate Scanner structs for each line
Implementations§
Source§impl<'a, R: Read> ScanLines<R>
impl<'a, R: Read> ScanLines<R>
Sourcepub fn new(f: R) -> ScanLines<R>
pub fn new(f: R) -> ScanLines<R>
create a Scanner ‘iterator’ over all lines from a readable.
This cannot be a proper Iterator
because the lifetime constraint
on Scanner
cannot be satisfied. You need to use the explicit form:
ⓘ
let mut iter = ScanLines::new(File::open("lines.txt")?);
while let Some(s) = iter.next() {
let mut s = s?;
// first token of each line
println!("{:?}",s.get());
}
Auto Trait Implementations§
impl<R> Freeze for ScanLines<R>where
R: Freeze,
impl<R> RefUnwindSafe for ScanLines<R>where
R: RefUnwindSafe,
impl<R> Send for ScanLines<R>where
R: Send,
impl<R> Sync for ScanLines<R>where
R: Sync,
impl<R> Unpin for ScanLines<R>where
R: Unpin,
impl<R> UnwindSafe for ScanLines<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more