#[non_exhaustive]pub struct Loc {
pub content: String,
pub sort_key: String,
pub indent: usize,
pub start_depth: usize,
pub end_depth: usize,
pub is_annotation: bool,
pub can_complete: bool,
pub wishes: Vec<Wish>,
pub gifts: Vec<Gift>,
pub starts_normal: bool,
}Expand description
A Line of Code, analyzed.
While public, this is implementation dependant and may change on patch versions.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.content: StringThe whole content of the line, including the ending newline
sort_key: StringThe key used for sorting, may be empty
indent: usizenumber of bytes of leading spaces
start_depth: usizeThe syntactic depth considered on the whole file, at start of line
end_depth: usizeThe syntactic depth considered on the whole file, at end of line
is_annotation: boolWhether this line starts a java annotation, a rust attribute, etc.
can_complete: bool§wishes: Vec<Wish>wishes needed after this loc
gifts: Vec<Gift>gifts not required by this loc
starts_normal: boolBefore the first char, is the line normal (not a comment or a multi line literal) ?
Implementations§
Source§impl Loc
impl Loc
Sourcepub fn min_depth(&self) -> usize
pub fn min_depth(&self) -> usize
Either the depth at start, or the depth at end, whichever is smaller
Sourcepub fn starts_with(&self, s: &str) -> bool
pub fn starts_with(&self, s: &str) -> bool
Whether the deindented content starts with the given string
Sourcepub fn last_significant_char(&self) -> Option<char>
pub fn last_significant_char(&self) -> Option<char>
the last character which is not a whitespace or part of a comment