Lyricdev
GitHub

class FileLinesIter

pub class FileLinesIter :: [Iterator, Closeable]

Conforms to Iterator, Closeable.

The lines of a file, from lines. After its end or an error it gives no more; after close() a call throws Closed, as the file's would.

Methods

pub mut fn next(): ?string throws IoError

Returns the next line, or null at the end.

Errors

Throws IoError with the path: Closed after close(), InvalidData for bytes that are not UTF-8, else the system's failure to read.

pub fn close(): void throws IoError

Closes the file before the end. A second close does nothing.

Errors

Throws IoError with the path when the system fails to close it.