pub struct Annotations<'a, M> { /* private fields */ }Expand description
A collection of annotations for a source snippet.
Implementations§
Source§impl<'a, M> Annotations<'a, M>
impl<'a, M> Annotations<'a, M>
pub fn new(snippet: &'a SourceSnippet, main_style: MainStyle<M>) -> Self
pub fn add_annotation( &mut self, span: Range<usize>, style: AnnotStyle<M>, label: Vec<(String, M)>, )
pub fn max_line_no_width(&self) -> usize
Source§impl<'a, M: Clone> Annotations<'a, M>
impl<'a, M: Clone> Annotations<'a, M>
Sourcepub fn render(
&self,
max_line_no_width: usize,
max_fill_after_first: usize,
max_fill_before_last: usize,
) -> Vec<(String, M)>
pub fn render( &self, max_line_no_width: usize, max_fill_after_first: usize, max_fill_before_last: usize, ) -> Vec<(String, M)>
Renders the snippet with the annotations.
max_line_no_width should be at least
self.max_line_no_width(), but
it can be greater to align the margin of multiple snippets.
Trait Implementations§
Auto Trait Implementations§
impl<'a, M> Freeze for Annotations<'a, M>where
M: Freeze,
impl<'a, M> RefUnwindSafe for Annotations<'a, M>where
M: RefUnwindSafe,
impl<'a, M> Send for Annotations<'a, M>where
M: Send,
impl<'a, M> Sync for Annotations<'a, M>where
M: Sync,
impl<'a, M> Unpin for Annotations<'a, M>where
M: Unpin,
impl<'a, M> UnwindSafe for Annotations<'a, M>where
M: UnwindSafe,
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