Struct rustty::Cell [] [src]

pub struct Cell { /* fields omitted */ }

A single point on a terminal display.

A Cell contains a character and style.

Methods

impl Cell
[src]

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

Examples

use rustty::{Cell, Color, Attr};

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);

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

Examples

use rustty::{Cell, Color, Attr};

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);

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

Examples

use rustty::{Cell, Color, Attr};

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(), ' ');

Returns the Cell's character.

Examples

use rustty::Cell;

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

Sets the Cell's character to the given char

Examples

use rustty::Cell;

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

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

Returns the Cell's foreground Color.

Examples

use rustty::{Cell, Color, Attr};

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

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

Examples

use rustty::{Cell, Color, Attr};

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

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

Returns the Cell's background Color.

Examples

use rustty::{Cell, Color, Attr};

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

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

Examples

use rustty::{Cell, Color, Attr};

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

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

Trait Implementations

impl Debug for Cell
[src]

Formats the value using the given formatter.

impl Copy for Cell
[src]

impl Clone for Cell
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Cell
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Cell
[src]

impl Default for Cell
[src]

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

Examples

use rustty::{Cell, Color};

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