pub enum Label {
Error(String),
Warning(String),
Note,
Help,
}Expand description
Label can be considered as a component of diagnostic to display a short label message in Diagnositc.
Label provides “error”, “warning”, “note” and “Help” four kinds of labels.
§Examples
let mut sb = StyledBuffer::<DiagnosticStyle>::new();
let mut errs = vec![];
// rendering text: "error[E3131]"
Label::Error("E3131".to_string()).format(&mut sb, &mut errs);
// rendering text: "warning[W3131]"
Label::Warning("W3131".to_string()).format(&mut sb, &mut errs);
// rendering text: "note"
Label::Note.format(&mut sb, &mut errs);
// rendering text: "help"
Label::Help.format(&mut sb, &mut errs);Variants§
Trait Implementations§
Source§impl Component<DiagnosticStyle> for Label
impl Component<DiagnosticStyle> for Label
Source§fn format(
&self,
sb: &mut StyledBuffer<DiagnosticStyle>,
_: &mut Vec<ComponentFormatError>,
)
fn format( &self, sb: &mut StyledBuffer<DiagnosticStyle>, _: &mut Vec<ComponentFormatError>, )
Auto Trait Implementations§
impl Freeze for Label
impl RefUnwindSafe for Label
impl Send for Label
impl Sync for Label
impl Unpin for Label
impl UnwindSafe for Label
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