pub struct RichCell { /* private fields */ }Expand description
A table cell whose content is a sequence of StyledSpans.
RichCell extends the plain Cell::Text model with per-span styling,
enabling mixed bold/italic/coloured text and proper CJK/emoji shaping
through the TextPipeline.
§Relationship to Cell
RichCell is intentionally separate from crate::Cell so that data
sources that do not need rich text are unaffected by the oxiui-text
dependency. Renderers that understand RichCell can convert it to a
Cell::Text for generic rendering via RichCell::to_plain_cell.
Implementations§
Source§impl RichCell
impl RichCell
Sourcepub fn plain(text: impl Into<String>) -> Self
pub fn plain(text: impl Into<String>) -> Self
Create a RichCell with a single plain span (no-feature version).
Sourcepub fn push_span(&mut self, span: StyledSpan)
pub fn push_span(&mut self, span: StyledSpan)
Append a span to this cell.
Sourcepub fn spans(&self) -> &[StyledSpan]
pub fn spans(&self) -> &[StyledSpan]
Borrow the span list.
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
Return the concatenated plain text of all spans (no style information).
Sourcepub fn to_plain_cell(&self) -> Cell
pub fn to_plain_cell(&self) -> Cell
Convert to a plain Cell::Text for generic (non-rich) rendering.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RichCell
impl RefUnwindSafe for RichCell
impl Send for RichCell
impl Sync for RichCell
impl Unpin for RichCell
impl UnsafeUnpin for RichCell
impl UnwindSafe for RichCell
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> 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