pub struct HighlightSpan { /* private fields */ }Expand description
A highlight span attached to a byte range of source text.
use dioxus_code::advanced::HighlightSpan;
let span = HighlightSpan::new(0..2, "k");
assert_eq!(span.tag(), "k");Implementations§
Source§impl HighlightSpan
impl HighlightSpan
Sourcepub const fn new(range: Range<u32>, tag: &'static str) -> Self
pub const fn new(range: Range<u32>, tag: &'static str) -> Self
Create a highlight span.
use dioxus_code::advanced::HighlightSpan;
let span = HighlightSpan::new(0..2, "k");
assert_eq!(span.range(), 0..2);Sourcepub const fn from_offsets(start: u32, end: u32, tag: &'static str) -> Self
pub const fn from_offsets(start: u32, end: u32, tag: &'static str) -> Self
Create a highlight span from explicit byte offsets.
use dioxus_code::advanced::HighlightSpan;
let span = HighlightSpan::from_offsets(0, 2, "k");
assert_eq!(span.start(), 0);Sourcepub const fn start(self) -> u32
pub const fn start(self) -> u32
Byte offset, inclusive, of the span’s start in the source.
use dioxus_code::advanced::HighlightSpan;
assert_eq!(HighlightSpan::new(3..5, "k").start(), 3);Sourcepub const fn end(self) -> u32
pub const fn end(self) -> u32
Byte offset, exclusive, of the span’s end in the source.
use dioxus_code::advanced::HighlightSpan;
assert_eq!(HighlightSpan::new(3..5, "k").end(), 5);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 (const: unstable) · 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
Source§fn eq(&self, other: &HighlightSpan) -> bool
fn eq(&self, other: &HighlightSpan) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy 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<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
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<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.