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: LabelStyle
The style/importance of this Highlight. Highlights with LabelStyle::Primary are given priority when being displayed.
fragment: Fragment
The Fragment containing the relevant section of code.
message: String
The 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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