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§
impl<FileId: Eq> Eq for Label<FileId>
impl<FileId> StructuralPartialEq for Label<FileId>
Auto Trait Implementations§
impl<FileId> Freeze for Label<FileId>where
FileId: Freeze,
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