pub struct AnnotatedStringBuilder { /* private fields */ }Expand description
Builder for constructing an AnnotatedString.
Implementations§
Source§impl AnnotatedStringBuilder
impl AnnotatedStringBuilder
pub fn new() -> Self
Sourcepub fn push(&mut self, text: &str) -> &mut Self
pub fn push(&mut self, text: &str) -> &mut Self
Append plain text (inherits parent style, or default if at top level).
Sourcepub fn push_with_style(&mut self, text: &str, style: SpanStyle) -> &mut Self
pub fn push_with_style(&mut self, text: &str, style: SpanStyle) -> &mut Self
Append text with a specific style.
Sourcepub fn push_color(&mut self, text: &str, color: Color) -> &mut Self
pub fn push_color(&mut self, text: &str, color: Color) -> &mut Self
Append text in a specific color.
Sourcepub fn add_style(
&mut self,
start: usize,
end: usize,
style: SpanStyle,
) -> &mut Self
pub fn add_style( &mut self, start: usize, end: usize, style: SpanStyle, ) -> &mut Self
Apply a style to a range of already-appended text.
pub fn build(&mut self) -> AnnotatedString
Trait Implementations§
Source§impl Default for AnnotatedStringBuilder
impl Default for AnnotatedStringBuilder
Source§fn default() -> AnnotatedStringBuilder
fn default() -> AnnotatedStringBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AnnotatedStringBuilder
impl RefUnwindSafe for AnnotatedStringBuilder
impl Send for AnnotatedStringBuilder
impl Sync for AnnotatedStringBuilder
impl Unpin for AnnotatedStringBuilder
impl UnsafeUnpin for AnnotatedStringBuilder
impl UnwindSafe for AnnotatedStringBuilder
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