pub struct HighlightSpan {
pub start: usize,
pub end: usize,
pub label: Option<String>,
}Expand description
A span to highlight within a command.
Fields§
§start: usizeStart byte offset (inclusive).
end: usizeEnd byte offset (exclusive).
label: Option<String>Optional label for the highlight (shown below carets).
Implementations§
Source§impl HighlightSpan
impl HighlightSpan
Sourcepub const fn new(start: usize, end: usize) -> Self
pub const fn new(start: usize, end: usize) -> Self
Create a new highlight span without a label.
Sourcepub fn with_label(start: usize, end: usize, label: impl Into<String>) -> Self
pub fn with_label(start: usize, end: usize, label: impl Into<String>) -> Self
Create a new highlight span with a label.
Sourcepub const fn to_match_span(&self) -> MatchSpan
pub const fn to_match_span(&self) -> MatchSpan
Convert to a MatchSpan for windowing.
Trait Implementations§
Source§impl Clone for HighlightSpan
impl Clone for HighlightSpan
Source§fn clone(&self) -> HighlightSpan
fn clone(&self) -> HighlightSpan
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HighlightSpan
impl Debug for HighlightSpan
Source§impl PartialEq for HighlightSpan
impl PartialEq for HighlightSpan
impl Eq for HighlightSpan
impl StructuralPartialEq for HighlightSpan
Auto Trait Implementations§
impl Freeze for HighlightSpan
impl RefUnwindSafe for HighlightSpan
impl Send for HighlightSpan
impl Sync for HighlightSpan
impl Unpin for HighlightSpan
impl UnsafeUnpin for HighlightSpan
impl UnwindSafe for HighlightSpan
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
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