pub struct DiffSpanHighlight { /* private fields */ }Expand description
A painted emphasis on a character span of one source line, such as the matched text of a search hit.
span is a byte range in the line’s content, before tab expansion. The
fill paints over syntax, inline-change emphasis and decorations, so the
span stays visible on marked lines; an active text selection still shows
above it.
Implementations§
Source§impl DiffSpanHighlight
impl DiffSpanHighlight
Sourcepub fn new(position: DiffLinePosition, span: Range<usize>) -> Self
pub fn new(position: DiffLinePosition, span: Range<usize>) -> Self
Highlights span of the line at position.
Sourcepub fn with_underline(self) -> Self
pub fn with_underline(self) -> Self
Underlines the span in its text color, the way a link reads.
Sourcepub fn with_background(self, background: impl Into<Hsla>) -> Self
pub fn with_background(self, background: impl Into<Hsla>) -> Self
Sets the fill, which defaults to a translucent warning color. A fully transparent fill leaves whatever the line shows beneath the span: for emphasis carried by the text itself, such as a link.
Sourcepub fn with_foreground(self, foreground: impl Into<Hsla>) -> Self
pub fn with_foreground(self, foreground: impl Into<Hsla>) -> Self
Sets the text color over the fill, keeping it readable on a strong one.
pub fn position(&self) -> &DiffLinePosition
pub fn span(&self) -> Range<usize> ⓘ
Sourcepub fn background(&self) -> Option<Hsla>
pub fn background(&self) -> Option<Hsla>
The fill set with Self::with_background.
Sourcepub fn foreground(&self) -> Option<Hsla>
pub fn foreground(&self) -> Option<Hsla>
The text color set with Self::with_foreground.
Trait Implementations§
Auto Trait Implementations§
impl Forget for DiffSpanHighlight
impl Freeze for DiffSpanHighlight
impl Move for DiffSpanHighlight
impl RefUnwindSafe for DiffSpanHighlight
impl Send for DiffSpanHighlight
impl Sync for DiffSpanHighlight
impl Unpin for DiffSpanHighlight
impl UnsafeUnpin for DiffSpanHighlight
impl UnwindSafe for DiffSpanHighlight
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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