pub struct RichText { /* private fields */ }Expand description
A sequence of Spans that together form a rich text document.
Implementations§
Source§impl RichText
impl RichText
Sourcepub fn split_at(&mut self, byte_offset: usize)
pub fn split_at(&mut self, byte_offset: usize)
Split a span at byte_offset (relative to the whole rich text).
After the call the span that straddles byte_offset is replaced by two
spans. Offsets that fall exactly on a span boundary are no-ops.
Sourcepub fn merge_adjacent(&mut self)
pub fn merge_adjacent(&mut self)
Merge adjacent spans that have identical style into a single span.
Sourcepub fn apply_style_range(
&mut self,
start: usize,
end: usize,
style_fn: impl Fn(&mut TextStyle),
)
pub fn apply_style_range( &mut self, start: usize, end: usize, style_fn: impl Fn(&mut TextStyle), )
Apply a style mutation to all spans (or portions thereof) within
[start, end) byte offsets (relative to the full rich-text string).
Spans are split at the boundaries as needed, then style_fn is called
on each span fully contained in the range.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RichText
impl RefUnwindSafe for RichText
impl Send for RichText
impl Sync for RichText
impl Unpin for RichText
impl UnsafeUnpin for RichText
impl UnwindSafe for RichText
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> 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