Struct prettytable::Cell [−][src]
pub struct Cell { /* fields omitted */ }Represent a table cell containing a string.
Once created, a cell's content cannot be modified. The cell would have to be replaced by another one
Methods
impl Cell[src]
impl Cellpub fn new_align(string: &str, align: Alignment) -> Cell[src]
pub fn new_align(string: &str, align: Alignment) -> CellCreate a new Cell initialized with content from string.
Text alignment in cell is configurable with the align argument
pub fn new(string: &str) -> Cell[src]
pub fn new(string: &str) -> CellCreate a new Cell initialized with content from string.
By default, content is align to LEFT
pub fn align(&mut self, align: Alignment)[src]
pub fn align(&mut self, align: Alignment)Set text alignment in the cell
pub fn style(&mut self, attr: Attr)[src]
pub fn style(&mut self, attr: Attr)Add a style attribute to the cell
pub fn with_style(self, attr: Attr) -> Cell[src]
pub fn with_style(self, attr: Attr) -> CellAdd a style attribute to the cell. Can be chained
pub fn with_hspan(self, hspan: usize) -> Cell[src]
pub fn with_hspan(self, hspan: usize) -> CellAdd horizontal spanning to the cell
pub fn reset_style(&mut self)[src]
pub fn reset_style(&mut self)Remove all style attributes and reset alignment to default (LEFT)
pub fn style_spec(self, spec: &str) -> Cell[src]
pub fn style_spec(self, spec: &str) -> CellSet the cell's style by applying the given specifier string
Style spec syntax
The syntax for the style specifier looks like this : FrBybl which means Foreground red Background yellow bold left
List of supported specifiers :
- F : Foreground (must be followed by a color specifier)
- B : Background (must be followed by a color specifier)
- H : Horizontal span (must be followed by a number)
- b : bold
- i : italic
- u : underline
- c : Align center
- l : Align left
- r : Align right
- d : default style
List of color specifiers :
- r : Red
- b : Blue
- g : Green
- y : Yellow
- c : Cyan
- m : Magenta
- w : White
- d : Black
And capital letters are for bright colors. Eg :
- R : Bright Red
- B : Bright Blue
- ... and so on ...
pub fn get_height(&self) -> usize[src]
pub fn get_height(&self) -> usize: Will become private in future release. See issue #87
Return the height of the cell
pub fn get_width(&self) -> usize[src]
pub fn get_width(&self) -> usize: Will become private in future release. See issue #87
Return the width of the cell
pub fn set_hspan(&mut self, hspan: usize)[src]
pub fn set_hspan(&mut self, hspan: usize)Set horizontal span for this cell (must be > 0)
pub fn get_hspan(&self) -> usize[src]
pub fn get_hspan(&self) -> usizeGet horizontal span of this cell (> 0)
pub fn get_content(&self) -> String[src]
pub fn get_content(&self) -> StringReturn a copy of the full string contained in the cell
pub fn print<T: Write + ?Sized>(
&self,
out: &mut T,
idx: usize,
col_width: usize,
skip_right_fill: bool
) -> Result<(), Error>[src]
pub fn print<T: Write + ?Sized>(
&self,
out: &mut T,
idx: usize,
col_width: usize,
skip_right_fill: bool
) -> Result<(), Error>: Will become private in future release. See issue #87
Print a partial cell to out. Since the cell may be multi-lined,
idx is the line index to print. col_width is the column width used to
fill the cells with blanks so it fits in the table.
If ìdx is higher than this cell's height, it will print empty content
pub fn print_term<T: Terminal + ?Sized>(
&self,
out: &mut T,
idx: usize,
col_width: usize,
skip_right_fill: bool
) -> Result<(), Error>[src]
pub fn print_term<T: Terminal + ?Sized>(
&self,
out: &mut T,
idx: usize,
col_width: usize,
skip_right_fill: bool
) -> Result<(), Error>: Will become private in future release. See issue #87
Apply style then call print to print the cell into a terminal
Trait Implementations
impl Clone for Cell[src]
impl Clone for Cellfn clone(&self) -> Cell[src]
fn clone(&self) -> CellReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for Cell[src]
impl Debug for Cellfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Hash for Cell[src]
impl Hash for Cellfn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash<__H: Hasher>(&self, state: &mut __H)Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl PartialEq for Cell[src]
impl PartialEq for Cellfn eq(&self, other: &Cell) -> bool[src]
fn eq(&self, other: &Cell) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Cell) -> bool[src]
fn ne(&self, other: &Cell) -> boolThis method tests for !=.
impl Eq for Cell[src]
impl Eq for Cellimpl<'a, T: ToString> From<&'a T> for Cell[src]
impl<'a, T: ToString> From<&'a T> for Cellimpl ToString for Cell[src]
impl ToString for Cellimpl Default for Cell[src]
impl Default for Cell