pub struct TerminalCell { /* private fields */ }Expand description
Single character cell inside a TerminalCellGrid supporting wide CJK glyphs, Extended Grapheme Clusters (combining marks & ZWJ emoji), and truecolor styling with zero heap allocation.
Implementations§
Source§impl TerminalCell
Construction, grapheme-cluster storage, and style inspection helpers for TerminalCell.
impl TerminalCell
Construction, grapheme-cluster storage, and style inspection helpers for TerminalCell.
Sourcepub const fn continuation(
fg: Option<Color>,
bg: Option<Color>,
bold: bool,
reverse: bool,
underline: bool,
) -> Self
pub const fn continuation( fg: Option<Color>, bg: Option<Color>, bold: bool, reverse: bool, underline: bool, ) -> Self
Creates a trailing continuation cell (width == 0) paired with a wide character lead cell.
§Arguments
Option<Color>- Inherited foreground color.Option<Color>- Inherited background color.bool- Inherited bold flag.bool- Inherited reverse-video flag.bool- Inherited underline flag.
§Returns
Self- Zero-width continuation cell.
Sourcepub const fn styled(
ch: char,
width: u8,
fg: Option<Color>,
bg: Option<Color>,
bold: bool,
reverse: bool,
underline: bool,
) -> Self
pub const fn styled( ch: char, width: u8, fg: Option<Color>, bg: Option<Color>, bold: bool, reverse: bool, underline: bool, ) -> Self
Creates a styled single-scalar character cell with explicit display width and ANSI flags.
§Arguments
char- Character scalar value.u8- Display width (1or2).Option<Color>- Optional foreground color.Option<Color>- Optional background color.bool- Bold flag.bool- Reverse-video flag.bool- Underline flag.
§Returns
Self- Constructed styled cell.
Sourcepub fn from_grapheme(cluster: &str, width: u8, style: Self) -> Self
pub fn from_grapheme(cluster: &str, width: u8, style: Self) -> Self
Creates a styled cell from an Extended Grapheme Cluster (retaining combining marks, variation selectors, and ZWJ emoji inline without heap allocation).
§Arguments
&str- Non-empty Extended Grapheme Cluster slice.u8- Precomputed display width (1or2).Self- Style template supplying colors and SGR emphasis flags.
§Returns
Self- Constructed grapheme cell.
Sourcepub fn tail_bytes(&self) -> &[u8] ⓘ
pub fn tail_bytes(&self) -> &[u8] ⓘ
Sourcepub fn push_grapheme_to(&self, out: &mut String)
pub fn push_grapheme_to(&self, out: &mut String)
Appends the complete Extended Grapheme Cluster stored in this cell into out.
§Arguments
&Self- Cell reference.&mut String- Destination UTF-8 output buffer.
Sourcepub const fn is_continuation(&self) -> bool
pub const fn is_continuation(&self) -> bool
Sourcepub const fn is_wide_lead(&self) -> bool
pub const fn is_wide_lead(&self) -> bool
Sourcepub fn same_style(&self, other: &Self) -> bool
pub fn same_style(&self, other: &Self) -> bool
Source§impl TerminalCell
impl TerminalCell
pub fn get_ch(&self) -> char
pub fn get_mut_ch(&mut self) -> &mut char
pub fn set_ch(&mut self, val: char) -> &mut Self
pub fn get_width(&self) -> u8
pub fn get_mut_width(&mut self) -> &mut u8
pub fn set_width(&mut self, val: u8) -> &mut Self
pub fn get_mut_fg(&mut self) -> &mut Option<Color>
pub fn set_fg(&mut self, val: Option<Color>) -> &mut Self
pub fn get_mut_bg(&mut self) -> &mut Option<Color>
pub fn set_bg(&mut self, val: Option<Color>) -> &mut Self
pub fn get_bold(&self) -> bool
pub fn get_mut_bold(&mut self) -> &mut bool
pub fn set_bold(&mut self, val: bool) -> &mut Self
pub fn get_reverse(&self) -> bool
pub fn get_mut_reverse(&mut self) -> &mut bool
pub fn set_reverse(&mut self, val: bool) -> &mut Self
pub fn get_underline(&self) -> bool
pub fn get_mut_underline(&mut self) -> &mut bool
pub fn set_underline(&mut self, val: bool) -> &mut Self
pub fn get_tail_len(&self) -> u8
pub fn get_mut_tail_len(&mut self) -> &mut u8
pub fn set_tail_len(&mut self, val: u8) -> &mut Self
Trait Implementations§
Source§impl Clone for TerminalCell
impl Clone for TerminalCell
impl Copy for TerminalCell
Source§impl Debug for TerminalCell
impl Debug for TerminalCell
Source§impl Default for TerminalCell
Blank default cell (' ', width 1, default terminal attributes).
impl Default for TerminalCell
Blank default cell (' ', width 1, default terminal attributes).
impl Eq for TerminalCell
Source§impl Hash for TerminalCell
impl Hash for TerminalCell
Source§impl PartialEq for TerminalCell
impl PartialEq for TerminalCell
impl StructuralPartialEq for TerminalCell
Auto Trait Implementations§
impl Forget for TerminalCell
impl Freeze for TerminalCell
impl Move for TerminalCell
impl RefUnwindSafe for TerminalCell
impl Send for TerminalCell
impl Sync for TerminalCell
impl Unpin for TerminalCell
impl UnsafeUnpin for TerminalCell
impl UnwindSafe for TerminalCell
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