Struct tty_interface::segment::Segment
source · [−]pub struct Segment { /* private fields */ }
Expand description
A segment of text which may have formatting. Accumulates changes until applied by its parent
Line
. May be obtained from the Line
API.
Implementations
sourceimpl Segment
impl Segment
sourcepub fn identifier(&self) -> SegmentId
pub fn identifier(&self) -> SegmentId
This segment’s unique identifier.
sourcepub fn text(&self) -> Option<&String>
pub fn text(&self) -> Option<&String>
This segment’s text. Reflects the latest state, even if staged changes have not yet been applied to the interface.
sourcepub fn color(&self) -> Option<&Color>
pub fn color(&self) -> Option<&Color>
This segment’s color. Reflects the latest state, even if staged changes have not yet been applied to the interface.
sourcepub fn styles(&self) -> &Vec<Style>
pub fn styles(&self) -> &Vec<Style>
This segment’s styles. Reflects the latest state, even if staged changes have not yet been applied to the interface.
sourcepub fn set_text(&mut self, text: &str)
pub fn set_text(&mut self, text: &str)
Update this segment’s text. The new text will be staged until applied for this Interface
.
sourcepub fn set_color(&mut self, color: Color)
pub fn set_color(&mut self, color: Color)
Update this segment’s color. The new color is staged until applied for this Interface
.
sourcepub fn reset_color(&mut self)
pub fn reset_color(&mut self)
Clear this segment’s color. The reset is staged until applied for this Interface
.
sourcepub fn set_styles(&mut self, styles: Vec<Style>)
pub fn set_styles(&mut self, styles: Vec<Style>)
Update this segment’s styles. The new styles are staged until applied for this Interface
.
sourcepub fn reset_styles(&mut self)
pub fn reset_styles(&mut self)
Clear this segment’s styles. The reset is staged until applied for this Interface
.
sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Whether this segment has any staged changes.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnwindSafe for Segment
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