pub struct StyledStr { /* private fields */ }Expand description
A string with associated text attributes for rich text formatting.
Implementations§
Source§impl StyledStr
impl StyledStr
Sourcepub fn from_markdown(markdown: &str) -> Self
pub fn from_markdown(markdown: &str) -> Self
Creates a styled string from a subset of Markdown.
Supported features include headings, bold, and italic text. Other Markdown constructs are preserved as plain text.
Sourcepub fn plain(text: impl Into<Str>) -> Self
pub fn plain(text: impl Into<Str>) -> Self
Creates a plain attributed string with a single unstyled chunk.
Sourcepub fn push(&mut self, text: impl Into<Str>, style: Style)
pub fn push(&mut self, text: impl Into<Str>, style: Style)
Adds a new text chunk with the specified style.
Sourcepub fn push_str(&mut self, text: impl Into<Str>)
pub fn push_str(&mut self, text: impl Into<Str>)
Appends text to the last chunk, or creates a new chunk if empty.
Sourcepub fn into_chunks(self) -> Vec<(Str, Style)>
pub fn into_chunks(self) -> Vec<(Str, Style)>
Consumes the attributed string and returns its constituent chunks.
Sourcepub fn foreground(self, color: impl Into<Color>) -> Self
pub fn foreground(self, color: impl Into<Color>) -> Self
Sets the foreground color for all chunks.
Sourcepub fn background_color(self, color: impl Into<Color>) -> Self
pub fn background_color(self, color: impl Into<Color>) -> Self
Sets the background color for all chunks.
Sourcepub fn weight(self, weight: FontWeight) -> Self
pub fn weight(self, weight: FontWeight) -> Self
Sets the font weight for all chunks.
Sourcepub fn strikethrough(self, strikethrough: bool) -> Self
pub fn strikethrough(self, strikethrough: bool) -> Self
Sets the strikethrough style for all chunks.
Trait Implementations§
Source§impl Extend<(Str, Style)> for StyledStr
impl Extend<(Str, Style)> for StyledStr
Source§fn extend<T: IntoIterator<Item = (Str, Style)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (Str, Style)>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations§
impl Freeze for StyledStr
impl !RefUnwindSafe for StyledStr
impl !Send for StyledStr
impl !Sync for StyledStr
impl Unpin for StyledStr
impl !UnwindSafe for StyledStr
Blanket Implementations§
Source§impl<S> AnimationExt for Swhere
S: SignalExt,
impl<S> AnimationExt for Swhere
S: SignalExt,
Source§fn animated(self) -> WithMetadata<Self, Animation>where
Self: Sized,
fn animated(self) -> WithMetadata<Self, Animation>where
Self: Sized,
Apply default animation to this reactive value Read more
Source§fn with_animation(self, animation: Animation) -> WithMetadata<Self, Animation>where
Self: Sized,
fn with_animation(self, animation: Animation) -> WithMetadata<Self, Animation>where
Self: Sized,
Apply a specific animation to this reactive value Read more
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IdentifiableExt for T
impl<T> IdentifiableExt for T
Source§impl<C, Output> IntoSignal<Output> for C
impl<C, Output> IntoSignal<Output> for C
Source§impl<C> SignalExt for Cwhere
C: Signal,
impl<C> SignalExt for Cwhere
C: Signal,
Source§fn map<F, Output>(self, f: F) -> Map<Self, F, Output>
fn map<F, Output>(self, f: F) -> Map<Self, F, Output>
Transforms the output of this signal using the provided function.
Source§fn cached(self) -> Cached<Self>
fn cached(self) -> Cached<Self>
Wraps this signal with caching to avoid redundant computations.
Source§fn computed(self) -> Computed<Self::Output>where
Self: 'static,
fn computed(self) -> Computed<Self::Output>where
Self: 'static,
Converts this signal into a type-erased
Computed container.Source§fn with<T>(self, metadata: T) -> WithMetadata<Self, T>
fn with<T>(self, metadata: T) -> WithMetadata<Self, T>
Attaches metadata to this signal’s watcher notifications.