[][src]Struct meli::terminal::cells::Cell

pub struct Cell {
    ch: char,
    empty: bool,
    fg: Color,
    bg: Color,
    attrs: Attr,
    keep_fg: bool,
    keep_bg: bool,
    keep_attrs: bool,
}

A single point on a terminal display.

A Cell contains a character and style.

Fields

ch: charempty: bool

Set a Cell as empty when a previous cell spans multiple columns and it would "overflow" to this cell.

fg: Colorbg: Colorattrs: Attrkeep_fg: boolkeep_bg: boolkeep_attrs: bool

Implementations

impl Cell[src]

pub fn new(ch: char, fg: Color, bg: Color, attrs: Attr) -> Cell[src]

Creates a new Cell with the given char, Colors and Attr.

Examples

let cell = Cell::new('x', Color::Default, Color::Green, Attr::DEFAULT);
assert_eq!(cell.ch(), 'x');
assert_eq!(cell.fg(), Color::Default);
assert_eq!(cell.bg(), Color::Green);
assert_eq!(cell.attrs(), Attr::DEFAULT);

pub fn with_char(ch: char) -> Cell[src]

Creates a new Cell with the given char and default style.

Examples

let mut cell = Cell::with_char('x');
assert_eq!(cell.ch(), 'x');
assert_eq!(cell.fg(), Color::Default);
assert_eq!(cell.bg(), Color::Default);
assert_eq!(cell.attrs(), Attr::DEFAULT);

pub fn with_style(fg: Color, bg: Color, attr: Attr) -> Cell[src]

Creates a new Cell with the given style and a blank char.

Examples

let mut cell = Cell::with_style(Color::Default, Color::Red, Attr::BOLD);
assert_eq!(cell.fg(), Color::Default);
assert_eq!(cell.bg(), Color::Red);
assert_eq!(cell.attrs(), Attr::BOLD);
assert_eq!(cell.ch(), ' ');

pub fn ch(&self) -> char[src]

Returns the Cell's character.

Examples

let mut cell = Cell::with_char('x');
assert_eq!(cell.ch(), 'x');

pub fn set_ch(&mut self, newch: char) -> &mut Cell[src]

Sets the Cell's character to the given char

Examples

let mut cell = Cell::with_char('x');
assert_eq!(cell.ch(), 'x');

cell.set_ch('y');
assert_eq!(cell.ch(), 'y');

pub fn fg(&self) -> Color[src]

Returns the Cell's foreground Color.

Examples

let mut cell = Cell::with_style(Color::Blue, Color::Default, Attr::DEFAULT);
assert_eq!(cell.fg(), Color::Blue);

pub fn set_fg(&mut self, newfg: Color) -> &mut Cell[src]

Sets the Cell's foreground Color to the given Color.

Examples

let mut cell = Cell::default();
assert_eq!(cell.fg(), Color::Default);

cell.set_fg(Color::White);
assert_eq!(cell.fg(), Color::White);

pub fn bg(&self) -> Color[src]

Returns the Cell's background Color.

Examples

let mut cell = Cell::with_style(Color::Default, Color::Green, Attr::DEFAULT);
assert_eq!(cell.bg(), Color::Green);

pub fn set_bg(&mut self, newbg: Color) -> &mut Cell[src]

Sets the Cell's background Color to the given Color.

Examples

let mut cell = Cell::default();
assert_eq!(cell.bg(), Color::Default);

cell.set_bg(Color::Black);
assert_eq!(cell.bg(), Color::Black);

pub fn attrs(&self) -> Attr[src]

pub fn set_attrs(&mut self, newattrs: Attr) -> &mut Cell[src]

pub fn empty(&self) -> bool[src]

Set a Cell as empty when a previous cell spans multiple columns and it would "overflow" to this cell.

pub fn set_empty(&mut self, new_val: bool) -> &mut Cell[src]

pub fn set_keep_fg(&mut self, new_val: bool) -> &mut Cell[src]

Sets keep_fg field. If true, the foreground color will not be altered if attempted so until the character content of the cell is changed.

pub fn set_keep_bg(&mut self, new_val: bool) -> &mut Cell[src]

Sets keep_bg field. If true, the background color will not be altered if attempted so until the character content of the cell is changed.

pub fn set_keep_attrs(&mut self, new_val: bool) -> &mut Cell[src]

Sets keep_attrs field. If true, the text attributes will not be altered if attempted so until the character content of the cell is changed.

Trait Implementations

impl Clone for Cell[src]

impl Copy for Cell[src]

impl Debug for Cell[src]

impl Default for Cell[src]

fn default() -> Cell[src]

Constructs a new Cell with a blank char and default Colors.

Examples

let mut cell = Cell::default();
assert_eq!(cell.ch(), ' ');
assert_eq!(cell.fg(), Color::Default);
assert_eq!(cell.bg(), Color::Default);

impl Eq for Cell[src]

impl PartialEq<Cell> for Cell[src]

impl StructuralEq for Cell[src]

impl StructuralPartialEq for Cell[src]

Auto Trait Implementations

impl RefUnwindSafe for Cell

impl Send for Cell

impl Sync for Cell

impl Unpin for Cell

impl UnwindSafe for Cell

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]