pub struct Line { /* private fields */ }Expand description
One terminal display line made of styled spans.
Implementations§
Source§impl Line
impl Line
Sourcepub fn from_plain(content: impl Into<String>) -> Result<Self, TextError>
pub fn from_plain(content: impl Into<String>) -> Result<Self, TextError>
Creates an unstyled line from plain content.
Sourcepub fn from_raw_lossy(content: impl AsRef<str>) -> Result<Self, TextError>
pub fn from_raw_lossy(content: impl AsRef<str>) -> Result<Self, TextError>
Creates a plain line from raw terminal text by lossily sanitizing unsafe content.
ANSI escape sequences and unsupported control characters are stripped, and tabs are replaced with spaces.
Sourcepub fn from_ansi(content: impl AsRef<str>) -> Result<Self, TextError>
pub fn from_ansi(content: impl AsRef<str>) -> Result<Self, TextError>
Creates a styled line by parsing ANSI SGR escape sequences.
Sourcepub fn from_spans(spans: Vec<Span>) -> Self
pub fn from_spans(spans: Vec<Span>) -> Self
Creates a line from already-validated spans.
Sourcepub fn plain_content(&self) -> String
pub fn plain_content(&self) -> String
Returns this line’s text content without style information.
Sourcepub fn display_width(&self) -> usize
pub fn display_width(&self) -> usize
Returns the Unicode display width of this line.
Trait Implementations§
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