Struct codespan_reporting::diagnostic::Label
source · pub struct Label<FileId> {
pub style: LabelStyle,
pub file_id: FileId,
pub range: Range<usize>,
pub message: String,
}
Expand description
A label describing an underlined region of code associated with a diagnostic.
Fields§
§style: LabelStyle
The style of the label.
file_id: FileId
The file that we are labelling.
range: Range<usize>
The range in bytes we are going to include in the final snippet.
message: String
An optional message to provide some additional information for the underlined code. These should not include line breaks.
Implementations§
source§impl<FileId> Label<FileId>
impl<FileId> Label<FileId>
sourcepub fn new(
style: LabelStyle,
file_id: FileId,
range: impl Into<Range<usize>>
) -> Label<FileId>
pub fn new( style: LabelStyle, file_id: FileId, range: impl Into<Range<usize>> ) -> Label<FileId>
Create a new label.
sourcepub fn primary(file_id: FileId, range: impl Into<Range<usize>>) -> Label<FileId>
pub fn primary(file_id: FileId, range: impl Into<Range<usize>>) -> Label<FileId>
Create a new label with a style of LabelStyle::Primary
.
sourcepub fn secondary(
file_id: FileId,
range: impl Into<Range<usize>>
) -> Label<FileId>
pub fn secondary( file_id: FileId, range: impl Into<Range<usize>> ) -> Label<FileId>
Create a new label with a style of LabelStyle::Secondary
.
sourcepub fn with_message(self, message: impl Into<String>) -> Label<FileId>
pub fn with_message(self, message: impl Into<String>) -> Label<FileId>
Add a message to the diagnostic.
Trait Implementations§
source§impl<FileId: PartialEq> PartialEq for Label<FileId>
impl<FileId: PartialEq> PartialEq for Label<FileId>
impl<FileId: Eq> Eq for Label<FileId>
impl<FileId> StructuralEq for Label<FileId>
impl<FileId> StructuralPartialEq for Label<FileId>
Auto Trait Implementations§
impl<FileId> RefUnwindSafe for Label<FileId>where
FileId: RefUnwindSafe,
impl<FileId> Send for Label<FileId>where
FileId: Send,
impl<FileId> Sync for Label<FileId>where
FileId: Sync,
impl<FileId> Unpin for Label<FileId>where
FileId: Unpin,
impl<FileId> UnwindSafe for Label<FileId>where
FileId: 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