#[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>,
}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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
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
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
pub fn is_sortable(&self) -> bool
Trait Implementations§
source§impl Ord for Loc
impl Ord for Loc
source§impl PartialEq for Loc
impl PartialEq for Loc
source§impl PartialOrd for Loc
impl PartialOrd for Loc
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Eq for Loc
Auto Trait Implementations§
impl Freeze for Loc
impl RefUnwindSafe for Loc
impl Send for Loc
impl Sync for Loc
impl Unpin for Loc
impl UnwindSafe for Loc
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