pub struct LineAnnotationMap { /* private fields */ }Expand description
Maps each source line to the annotation regions covering it.
Implementations§
Source§impl LineAnnotationMap
impl LineAnnotationMap
Sourcepub fn build_from_regions(regions: &[RegionRef], total_lines: usize) -> Self
pub fn build_from_regions(regions: &[RegionRef], total_lines: usize) -> Self
Build the map from regions and the total number of source lines.
Sourcepub fn regions_at_line(&self, line: u32) -> &[usize]
pub fn regions_at_line(&self, line: u32) -> &[usize]
Get region indices covering a given line (1-indexed).
Sourcepub fn next_annotated_line(&self, from: u32) -> Option<u32>
pub fn next_annotated_line(&self, from: u32) -> Option<u32>
Find the next line >= from (1-indexed) that has annotation coverage.
Returns None if no annotated lines from that point.
Sourcepub fn prev_annotated_line(&self, from: u32) -> Option<u32>
pub fn prev_annotated_line(&self, from: u32) -> Option<u32>
Find the previous line <= from (1-indexed) that has annotation coverage.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LineAnnotationMap
impl RefUnwindSafe for LineAnnotationMap
impl Send for LineAnnotationMap
impl Sync for LineAnnotationMap
impl Unpin for LineAnnotationMap
impl UnwindSafe for LineAnnotationMap
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more