pub struct Line<'a> { /* private fields */ }Expand description
A single line of styled spans.
Implementations§
Source§impl<'a> Line<'a>
impl<'a> Line<'a>
Sourcepub fn from_spans(spans: impl IntoIterator<Item = Span<'a>>) -> Self
pub fn from_spans(spans: impl IntoIterator<Item = Span<'a>>) -> Self
Create a line from spans.
Sourcepub fn styled(content: impl Into<Cow<'a, str>>, style: Style) -> Self
pub fn styled(content: impl Into<Cow<'a, str>>, 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<'a>>
pub fn wrap(&self, width: usize, mode: WrapMode) -> Vec<Line<'a>>
Wrap this line to the given width, preserving span styles.
Sourcepub fn into_segments(self) -> Vec<Segment<'a>>
pub fn into_segments(self) -> Vec<Segment<'a>>
Convert to segments.
Sourcepub fn into_segment_line(self) -> SegmentLine<'a>
pub fn into_segment_line(self) -> SegmentLine<'a>
Convert to a SegmentLine.
Trait Implementations§
Source§impl<'a> FromIterator<Line<'a>> for Text<'a>
impl<'a> FromIterator<Line<'a>> for Text<'a>
Source§impl<'a> IntoIterator for &'a Line<'a>
impl<'a> IntoIterator for &'a Line<'a>
Source§impl<'a> IntoIterator for Line<'a>
impl<'a> IntoIterator for Line<'a>
impl<'a> Eq for Line<'a>
impl<'a> StructuralPartialEq for Line<'a>
Auto Trait Implementations§
impl<'a> Freeze for Line<'a>
impl<'a> RefUnwindSafe for Line<'a>
impl<'a> Send for Line<'a>
impl<'a> Sync for Line<'a>
impl<'a> Unpin for Line<'a>
impl<'a> UnsafeUnpin for Line<'a>
impl<'a> UnwindSafe for Line<'a>
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.