Skip to main content

inspect_line

Function inspect_line 

Source
pub fn inspect_line(path: &Path, line: u64) -> Result<Option<LineInfo>, Error>
Expand description

Inspects a 1-based line of a regular file.

Returns Some with its raw byte length, including any terminating LF, or None beyond EOF. CR is ordinary content; a trailing LF does not create an additional empty line. Invalid UTF-8 is accepted.

Reopens the path and requires file stability.

§Errors

Returns Error::InvalidLineNumber for line zero, Error::Io if metadata lookup, opening, or reading fails, or Error::NotRegularFile for a non-regular input.

§Examples

See fingerprint_line_prefix for an example inspecting and hashing a line.