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]
fn new(ch: char, fg: Color, bg: Color, attrs: Attr) -> Cell
Creates a new Cell
with the given char
, Color
s 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);
fn with_char(ch: char) -> Cell
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);
fn with_style(fg: Color, bg: Color, attr: Attr) -> Cell
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(), ' ');
fn ch(&self) -> char
Returns the Cell
's character.
Examples
use rustty::Cell; let mut cell = Cell::with_char('x'); assert_eq!(cell.ch(), 'x');
fn set_ch(&mut self, newch: char) -> &mut Cell
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');
fn fg(&self) -> Color
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);
fn set_fg(&mut self, newfg: Color) -> &mut Cell
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);
fn bg(&self) -> Color
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);
fn set_bg(&mut self, newbg: Color) -> &mut Cell
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);
fn attrs(&self) -> Attr
fn set_attrs(&mut self, newattrs: Attr) -> &mut Cell
Trait Implementations
impl Debug for Cell
[src]
impl Copy for Cell
[src]
impl Clone for Cell
[src]
fn clone(&self) -> Cell
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for Cell
[src]
fn eq(&self, __arg_0: &Cell) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Cell) -> bool
This method tests for !=
.