docs/generated/contracts.mdgenerated from code

Reference · 1 min read

api-lines

Contracts: api-lines.

Source: crates/lvcs-api/src/lines.rs.

ruston main
1/// A range as a reader is shown it (discussion:owner/156 and discussion:owner/160).2///3/// `first` and `last` are the 1-based numbers of its first and last lines in4/// the text it was named in, inclusive. `near` is git's default hunk-header5/// line, taken at or above `first`: the nearest line whose first character6/// is an ASCII letter, `_`, or `$`, without its newline and trailing7/// whitespace, cut to `RANGE_CONTEXT_MAX_CHARS` code points. It is a8/// heuristic line, never a parse, so it can name a line outside the9/// enclosing definition. `Display` writes `line 40` or `lines 40\u{2013}52`,10/// then `, near "<near>"` when there is one; a surface that doesn't already11/// name the file puts the path first.12#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]13pub struct LineName {14    /// The range's first line, 1-based.15    pub first: usize,16    /// Its last line, 1-based and inclusive.17    pub last: usize,18    /// The hunk-header line at or above `first`, if any.19    pub near: Option<String>,20}