pub struct RichText { /* private fields */ }Expand description
预处理后的富文本:拼接文本 + 文本 span 的字节区间 + 内联项(一次构造,多次测量/绘制)。
Implementations§
Source§impl RichText
impl RichText
pub fn new(spans: Vec<RichTextSpan>) -> Self
pub fn from_items(items: Vec<RichItem>) -> Self
Sourcepub fn plain_text(&self) -> &str
pub fn plain_text(&self) -> &str
纯文本(a11y label / 测试断言用;内联项不含文本)
pub fn spans(&self) -> &[RichTextSpan]
pub fn is_empty(&self) -> bool
Trait Implementations§
impl StructuralPartialEq for RichText
Auto Trait Implementations§
impl !RefUnwindSafe for RichText
impl !Send for RichText
impl !Sync for RichText
impl !UnwindSafe for RichText
impl Freeze for RichText
impl Unpin for RichText
impl UnsafeUnpin 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