pub struct Line { /* private fields */ }Expand description
A single line of styled spans.
Implementations§
Source§impl Line
impl Line
Sourcepub fn from_spans<'a>(spans: impl IntoIterator<Item = Span<'a>>) -> Self
pub fn from_spans<'a>(spans: impl IntoIterator<Item = Span<'a>>) -> Self
Create a line from spans.
Sourcepub fn styled(content: impl Into<String>, style: Style) -> Self
pub fn styled(content: impl Into<String>, style: Style) -> Self
Create a line from a single styled string.
Sourcepub fn measurement(&self) -> TextMeasurement
pub fn measurement(&self) -> TextMeasurement
Return bounds-based measurement for this line.
Sourcepub fn apply_base_style(&mut self, base: Style)
pub fn apply_base_style(&mut self, base: Style)
Apply a base style to all spans.
The base style is merged with each span’s style, with the span’s style taking precedence for conflicting properties.
Sourcepub fn to_plain_text(&self) -> String
pub fn to_plain_text(&self) -> String
Get the plain text content.
Sourcepub fn wrap(&self, width: usize, mode: WrapMode) -> Vec<Line>
pub fn wrap(&self, width: usize, mode: WrapMode) -> Vec<Line>
Wrap this line to the given width, preserving span styles.
Sourcepub fn into_segments(self) -> Vec<Segment<'static>>
pub fn into_segments(self) -> Vec<Segment<'static>>
Convert to segments.
Sourcepub fn into_segment_line(self) -> SegmentLine<'static>
pub fn into_segment_line(self) -> SegmentLine<'static>
Convert to a SegmentLine.
Trait Implementations§
Source§impl FromIterator<Line> for Text
impl FromIterator<Line> for Text
Source§impl<'a> IntoIterator for &'a Line
impl<'a> IntoIterator for &'a Line
Source§impl IntoIterator for Line
impl IntoIterator for Line
impl Eq for Line
impl StructuralPartialEq for Line
Auto Trait Implementations§
impl Freeze for Line
impl RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl UnsafeUnpin for Line
impl UnwindSafe for Line
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.