Cell

Struct Cell 

Source
pub struct Cell { /* private fields */ }
Expand description

A Cell corresponds to a single grapheme cluster on some Plane,

A Cell is bounded to n Plane, but the cell doesn’t store anything about the plane.

At any NcCell, we can have a theoretically arbitrarily long UTF-8 string, a foreground color, a background color, and a Style attribute set.

Implementations§

Source§

impl Cell

§constructors

Source

pub fn new() -> Cell

Creates an empty cell.

Source

pub fn from_str(plane: &mut Plane, string: &str) -> Result<Cell>

Returns a Cell from a string.

It only stores the first extended grapheme cluster from the string.

Source§

impl Cell

§egc

methods
Source

pub const fn uses_egcpool(&self) -> bool

Returns true if the egc is stored in the associated plane’s egc pool, or false if the egc is stored entirely within the cell,

Egcs of up to 4 bytes are stored in the cell.

Source

pub fn try_egc(&self) -> Option<String>

Returns the extended grapheme cluster only if it’s stored in the cell.

Returns none if the egc is stored in the associated plane.

Source

pub fn egc(&self, plane: &mut Plane) -> &str

Returns a reference to the egc.

Source§

impl Cell

§channel methods

Source

pub fn channels(&self) -> Channels

Gets the channels.

Source

pub fn fg(&self) -> Channel

Gets the foreground channel.

Source

pub fn bg(&self) -> Channel

Gets the background channel.

Source

pub fn set_channels(&mut self, channels: impl Into<Channels>) -> Channels

Sets the channels, returning the previous value.

Source

pub fn set_fg(&mut self, channel: impl Into<Channel>) -> Channel

Sets the foreground channel, returning the previous value.

Source

pub fn set_bg(&mut self, channel: impl Into<Channel>) -> Channel

Sets the background channel, returning the previous value.

Source

pub fn cset_channels(self, channels: impl Into<Channels>) -> Self

Chain-sets the channels.

Source

pub fn cset_fg(self, channel: impl Into<Channel>) -> Self

Chain-sets the foreground channel.

Source

pub fn cset_bg(self, channel: impl Into<Channel>) -> Self

Chain-sets the foreground channel.

Source§

impl Cell

§alpha methods

Source

pub fn fg_alpha(&self) -> Alpha

Gets the foreground alpha.

Source

pub fn bg_alpha(&self) -> Alpha

Gets the background alpha.

Source

pub fn set_fg_alpha(&mut self, foreground: Alpha) -> Alpha

Sets the foreground alpha, returning the previous value.

Source

pub fn set_bg_alpha(&mut self, background: Alpha) -> Alpha

Gets the background alpha, returning the previous value.

Source§

impl Cell

§style methods

Source

pub fn styles(&self) -> Style

Gets the styles.

Source

pub fn set_styles(&mut self, styles: impl Into<Style>) -> Style

Sets the styles, returning the previous value.

Source

pub fn add_styles(&mut self, styles: impl Into<Style>) -> Style

Adds the specified styles, returning the previous value.

Source

pub fn del_styles(&mut self, styles: impl Into<Style>) -> Style

Deletes the specified styles, returning the previous value.

Source

pub fn cset_style(self, styles: impl Into<Style>) -> Self

Chain-sets the styles.

Trait Implementations§

Source§

impl Clone for Cell

Source§

fn clone(&self) -> Cell

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cell

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Cell

Source§

fn default() -> Cell

Returns the “default value” for a type. Read more
Source§

impl Display for Cell

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'c> From<&'c Cell> for &'c NcCell

Source§

fn from(c: &'c Cell) -> &'c NcCell

Converts to this type from the input type.
Source§

impl From<Cell> for NcCell

Source§

fn from(c: Cell) -> NcCell

Converts to this type from the input type.
Source§

impl From<nccell> for Cell

Source§

fn from(nc: NcCell) -> Cell

Converts to this type from the input type.
Source§

impl PartialEq for Cell

Source§

fn eq(&self, other: &Cell) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Cell

Source§

impl Eq for Cell

Source§

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 UnwindSafe for Cell

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.