pub struct TextSpan {
pub start: u32,
pub length: u32,
pub type_role: Option<TypeRole>,
pub color: Option<Paint>,
pub bold: bool,
pub italic: bool,
pub underline: bool,
pub strikethrough: bool,
pub on_click: Option<u64>,
}Expand description
One run, given in bytes into the string rather than characters.
Bytes because that is what the string is measured in on both sides, and a character count would have to be recomputed against a UTF-8 buffer at every use.
Fields§
§start: u32§length: u32§type_role: Option<TypeRole>§color: Option<Paint>§bold: bool§italic: bool§underline: bool§strikethrough: bool§on_click: Option<u64>The handler a press on this run reports to, if it is a link.
Implementations§
Source§impl TextSpan
impl TextSpan
Sourcepub const fn new(start: u32, length: u32) -> Self
pub const fn new(start: u32, length: u32) -> Self
A run of the given bytes with nothing said about it yet.
pub const fn bold(self) -> Self
pub const fn italic(self) -> Self
pub const fn underline(self) -> Self
pub const fn strikethrough(self) -> Self
pub const fn with_role(self, role: TypeRole) -> Self
pub const fn with_color(self, color: Paint) -> Self
Trait Implementations§
impl Copy for TextSpan
impl StructuralPartialEq for TextSpan
Auto Trait Implementations§
impl Freeze for TextSpan
impl RefUnwindSafe for TextSpan
impl Send for TextSpan
impl Sync for TextSpan
impl Unpin for TextSpan
impl UnsafeUnpin for TextSpan
impl UnwindSafe for TextSpan
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,
impl<T> DependencyElement for T
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.