pub struct StyledText(/* private fields */);Expand description
Immutable text with inline styles. Cloning shares the underlying data.
Implementations§
Source§impl StyledText
impl StyledText
pub fn from_plain_text(text: impl Into<String>) -> Self
pub fn from_runs( text: impl Into<String>, runs: Vec<StyledRun>, ) -> Result<Self, StyledTextError>
pub fn from_parts( text: impl Into<String>, runs: Vec<StyledRun>, links: Vec<StyledLink>, ) -> Result<Self, StyledTextError>
pub fn text(&self) -> &str
pub fn runs(&self) -> &[StyledRun]
pub fn links(&self) -> &[StyledLink]
pub fn from_markdown(source: &str) -> Result<Self, StyledTextError>
Trait Implementations§
Source§impl Clone for StyledText
impl Clone for StyledText
Source§impl Debug for StyledText
impl Debug for StyledText
Source§impl Default for StyledText
impl Default for StyledText
impl Eq for StyledText
Source§impl From<StyledText> for Value
impl From<StyledText> for Value
Source§fn from(value: StyledText) -> Self
fn from(value: StyledText) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Forget for StyledText
impl Freeze for StyledText
impl RefUnwindSafe for StyledText
impl Send for StyledText
impl Sync for StyledText
impl Unpin for StyledText
impl UnsafeUnpin for StyledText
impl UnwindSafe for StyledText
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