pub struct SourceExcerpt {
pub file_path: FilePath,
pub line_number: usize,
pub source_line: SharedString,
pub annotations: Vec<SourceAnnotation>,
}Expand description
One rendered source line plus inline annotations.
Fields§
§file_path: FilePathLogical path for the excerpted source line.
line_number: usizeOne-based line number in the source file.
source_line: SharedStringFull source line text.
annotations: Vec<SourceAnnotation>Span annotations attached to this line.
Implementations§
Source§impl SourceExcerpt
impl SourceExcerpt
Sourcepub fn new(
file_path: impl Into<FilePath>,
line_number: usize,
source_line: impl Into<SharedString>,
) -> Self
pub fn new( file_path: impl Into<FilePath>, line_number: usize, source_line: impl Into<SharedString>, ) -> Self
Creates a source excerpt from its file path, line number, and source text.
Sourcepub fn with_annotation(self, annotation: SourceAnnotation) -> Self
pub fn with_annotation(self, annotation: SourceAnnotation) -> Self
Returns a copy of this excerpt with one appended annotation.
Trait Implementations§
Source§impl Clone for SourceExcerpt
impl Clone for SourceExcerpt
Source§fn clone(&self) -> SourceExcerpt
fn clone(&self) -> SourceExcerpt
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SourceExcerpt
impl Debug for SourceExcerpt
Source§impl PartialEq for SourceExcerpt
impl PartialEq for SourceExcerpt
impl Eq for SourceExcerpt
impl StructuralPartialEq for SourceExcerpt
Auto Trait Implementations§
impl Freeze for SourceExcerpt
impl RefUnwindSafe for SourceExcerpt
impl Send for SourceExcerpt
impl Sync for SourceExcerpt
impl Unpin for SourceExcerpt
impl UnsafeUnpin for SourceExcerpt
impl UnwindSafe for SourceExcerpt
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