pub struct Text {
pub spans: Vec<Span>,
pub alignment: Alignment,
pub overflow: Overflow,
pub style: Style,
}Expand description
A text container with multiple styled spans.
Fields§
§spans: Vec<Span>The spans that make up this text
alignment: AlignmentText alignment
overflow: OverflowOverflow behavior
style: StyleOptional style applied to the whole text
Implementations§
Source§impl Text
impl Text
Sourcepub fn styled<S: Into<Cow<'static, str>>>(text: S, style: Style) -> Self
pub fn styled<S: Into<Cow<'static, str>>>(text: S, style: Style) -> Self
Create text from a styled string.
Sourcepub fn from_spans<I: IntoIterator<Item = Span>>(spans: I) -> Self
pub fn from_spans<I: IntoIterator<Item = Span>>(spans: I) -> Self
Create text from multiple spans.
Sourcepub fn push_styled<S: Into<Cow<'static, str>>>(&mut self, text: S, style: Style)
pub fn push_styled<S: Into<Cow<'static, str>>>(&mut self, text: S, style: Style)
Append styled text.
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
Get the plain text content without styling.
Trait Implementations§
Source§impl Renderable for Text
Implement Renderable for Text.
impl Renderable for Text
Implement Renderable for Text.
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
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> Measurable for Twhere
T: Renderable,
impl<T> Measurable for Twhere
T: Renderable,
Source§fn measure(&self, width: usize) -> Measurement
fn measure(&self, width: usize) -> Measurement
Measure this renderable at the given width.