pub struct SegmentLine<'a> { /* private fields */ }Expand description
A line of segments.
Represents a single line of text that may contain multiple styled segments.
Implementations§
Source§impl<'a> SegmentLine<'a>
impl<'a> SegmentLine<'a>
Sourcepub fn from_segments(segments: Vec<Segment<'a>>) -> Self
pub fn from_segments(segments: Vec<Segment<'a>>) -> Self
Create a line from a vector of segments.
Sourcepub fn from_segment(segment: Segment<'a>) -> Self
pub fn from_segment(segment: Segment<'a>) -> Self
Create a line from a single segment.
Sourcepub fn cell_length(&self) -> usize
pub fn cell_length(&self) -> usize
Get the total cell width of the line.
Sourcepub fn segments_mut(&mut self) -> &mut Vec<Segment<'a>>
pub fn segments_mut(&mut self) -> &mut Vec<Segment<'a>>
Get mutable access to segments.
Sourcepub fn split_at_cell(&self, cell_pos: usize) -> (Self, Self)
pub fn split_at_cell(&self, cell_pos: usize) -> (Self, Self)
Split the line at a cell position.
Returns (left, right) where the split respects grapheme boundaries.
Sourcepub fn to_plain_text(&self) -> String
pub fn to_plain_text(&self) -> String
Concatenate plain text from all segments.
Sourcepub fn into_owned(self) -> SegmentLine<'static>
pub fn into_owned(self) -> SegmentLine<'static>
Convert all segments to owned (remove lifetime constraints).
Trait Implementations§
Source§impl<'a> Clone for SegmentLine<'a>
impl<'a> Clone for SegmentLine<'a>
Source§fn clone(&self) -> SegmentLine<'a>
fn clone(&self) -> SegmentLine<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for SegmentLine<'a>
impl<'a> Debug for SegmentLine<'a>
Source§impl<'a> Default for SegmentLine<'a>
impl<'a> Default for SegmentLine<'a>
Source§fn default() -> SegmentLine<'a>
fn default() -> SegmentLine<'a>
Returns the “default value” for a type. Read more
Source§impl<'a, 'b> IntoIterator for &'b SegmentLine<'a>
impl<'a, 'b> IntoIterator for &'b SegmentLine<'a>
Source§impl<'a> IntoIterator for SegmentLine<'a>
impl<'a> IntoIterator for SegmentLine<'a>
Source§impl<'a> PartialEq for SegmentLine<'a>
impl<'a> PartialEq for SegmentLine<'a>
impl<'a> Eq for SegmentLine<'a>
impl<'a> StructuralPartialEq for SegmentLine<'a>
Auto Trait Implementations§
impl<'a> Freeze for SegmentLine<'a>
impl<'a> RefUnwindSafe for SegmentLine<'a>
impl<'a> Send for SegmentLine<'a>
impl<'a> Sync for SegmentLine<'a>
impl<'a> Unpin for SegmentLine<'a>
impl<'a> UnsafeUnpin for SegmentLine<'a>
impl<'a> UnwindSafe for SegmentLine<'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.