pub struct Highlight {
pub style: LabelStyle,
pub fragment: Fragment,
pub message: String,
}Available on crate feature
reporting only.Expand description
A highlighted section of a Source that’s used in a Diagnostic.
Fields§
§style: LabelStyleThe style/importance of this Highlight. Highlights with LabelStyle::Primary are given priority when being displayed.
fragment: FragmentThe Fragment containing the relevant section of code.
message: StringThe message attached to this Highlight. This can be empty, in which case the Fragment will just be underlined when displayed.
Implementations§
Source§impl Highlight
impl Highlight
Sourcepub fn primary(fragment: Fragment, message: impl Into<String>) -> Self
pub fn primary(fragment: Fragment, message: impl Into<String>) -> Self
Construct a new Highlight with LabelStyle::Primary.
Sourcepub fn secondary(fragment: Fragment, message: impl Into<String>) -> Self
pub fn secondary(fragment: Fragment, message: impl Into<String>) -> Self
Construct a new Highlight with LabelStyle::Secondary.
Sourcepub fn with_message(self, message: impl Into<String>) -> Self
pub fn with_message(self, message: impl Into<String>) -> Self
Builder style function to set the Highlight::message.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Highlight
impl RefUnwindSafe for Highlight
impl Send for Highlight
impl Sync for Highlight
impl Unpin for Highlight
impl UnwindSafe for Highlight
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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