pub struct Cell { /* private fields */ }Expand description
One character cell of the screen: its text (a grapheme cluster), its colour
Style, and the wide/trail flags that track double-width glyphs.
A single screen cell: its text (a grapheme cluster), its colour Style,
and flags tracking double-width glyphs.
One cell can hold a whole grapheme cluster (a base character plus combining
marks / ZWJ sequence), stored as an owned String. Double-width handling: a
width-2 grapheme occupies a wide lead cell immediately
followed by a trail continuation cell whose symbol
is empty.
PartialEq is derived because the render diff compares the back buffer
against the front buffer cell-by-cell to emit only changed cells.
§Turbo Vision heritage
Ports TScreenCell + TCellChar (scrncell.h). The original packs the text
inline as up to 15 UTF-8 bytes; here it is an owned String. The colour is a
typed Style rather than a packed attribute byte (deviation D6), and the
inline grapheme model carries combining marks and ZWJ sequences (deviation
D13).
Implementations§
Source§impl Cell
impl Cell
Sourcepub fn blank(style: Style) -> Self
pub fn blank(style: Style) -> Self
A blank cell carrying the given style (the usual fill for clearing a region to a background colour).
Sourcepub fn set_char(&mut self, ch: char)
pub fn set_char(&mut self, ch: char)
Set the text to a single char, clearing the wide/trail flags.
Sourcepub fn set_str(&mut self, s: &str, wide: bool)
pub fn set_str(&mut self, s: &str, wide: bool)
Set the text to a grapheme cluster, flagging it wide if it is a
double-width glyph.
Sourcepub fn set_wide_trail(&mut self)
pub fn set_wide_trail(&mut self)
Mark this cell as the trailing half of a double-width glyph (empty symbol,
trail set).
Sourcepub fn symbol(&self) -> &str
pub fn symbol(&self) -> &str
The grapheme cluster occupying this cell (empty for a wide trail).
pub fn style(&self) -> Style
pub fn set_style(&mut self, style: Style)
Sourcepub fn is_wide_trail(&self) -> bool
pub fn is_wide_trail(&self) -> bool
Whether this cell is the trailing half of a double-width glyph.
Trait Implementations§
impl Eq for Cell
impl StructuralPartialEq for Cell
Auto Trait Implementations§
impl Freeze for Cell
impl RefUnwindSafe for Cell
impl Send for Cell
impl Sync for Cell
impl Unpin for Cell
impl UnsafeUnpin for Cell
impl UnwindSafe for Cell
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.