Struct tty_interface::line::Line
source · [−]pub struct Line { /* private fields */ }Expand description
A line composed of text segments. Accumulates changes until applied by its parent Interface.
May be obtained from the Interface API.
Implementations
sourceimpl Line
impl Line
sourcepub fn identifier(&self) -> LineId
pub fn identifier(&self) -> LineId
This line’s unique identifier.
sourcepub fn segment_ids(&self) -> &Vec<SegmentId>
pub fn segment_ids(&self) -> &Vec<SegmentId>
This line’s text segment identifiers. Reflects the latest state, even if staged changes have not yet been applied to the interface.
sourcepub fn segments(&self) -> Vec<&Segment>
pub fn segments(&self) -> Vec<&Segment>
This line’s text segments. Reflects the latest state, even if staged changes have not yet been applied to the interface.
sourcepub fn get_segments(&self, ids: &Vec<SegmentId>) -> Result<Vec<&Segment>>
pub fn get_segments(&self, ids: &Vec<SegmentId>) -> Result<Vec<&Segment>>
Retrieves several segment references by their identifiers.
sourcepub fn get_segment(&self, id: &SegmentId) -> Result<&Segment>
pub fn get_segment(&self, id: &SegmentId) -> Result<&Segment>
Retrieves a segment reference by its identifier.
sourcepub fn get_segment_mut(&mut self, id: &SegmentId) -> Result<&mut Segment>
pub fn get_segment_mut(&mut self, id: &SegmentId) -> Result<&mut Segment>
Retrieves a mutable segment reference by its identifier.
sourcepub fn get_segment_index(&self, id: &SegmentId) -> Result<usize>
pub fn get_segment_index(&self, id: &SegmentId) -> Result<usize>
Determines the specified segment’s index in this line.
sourcepub fn add_segment(&mut self) -> &mut Segment
pub fn add_segment(&mut self) -> &mut Segment
Appends a new text segment to this line. The text segment addition will be staged until
changes are applied for this line’s Interface. Note that the returned segment may have
other changes staged against it for the same update.
sourcepub fn insert_segment(&mut self, index: usize) -> Result<&mut Segment>
pub fn insert_segment(&mut self, index: usize) -> Result<&mut Segment>
Inserts a new text segment in this line at a specified index. The segment insertion will be
staged until changes are applied for this line’s Interface. Note that the returned
segment may have other changes staged against it for the same update.
sourcepub fn remove_segment(&mut self, id: &SegmentId) -> Result<()>
pub fn remove_segment(&mut self, id: &SegmentId) -> Result<()>
Removes a text segment with the specified identifier from this line. The segment removal
will be staged until changes are applied for this line’s Interface.
sourcepub fn remove_segment_at(&mut self, index: usize) -> Result<SegmentId>
pub fn remove_segment_at(&mut self, index: usize) -> Result<SegmentId>
Removes a text segment from this line at the specified index. The segment removal will be
staged until changes are applied for this line’s Interface.
sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Whether this line or its text segments have any staged changes.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl UnwindSafe for Line
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more