[−][src]Struct meli::terminal::Cell
A single point on a terminal display.
A Cell
contains a character and style.
Fields
ch: char
empty: bool
Set a Cell
as empty when a previous cell spans multiple columns and it would
"overflow" to this cell.
fg: Color
bg: Color
attrs: Attr
keep_fg: bool
keep_bg: bool
keep_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
, Color
s 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 Color
s.
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,