pub struct Cell { /* private fields */ }
Expand description
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
Implementations§
Source§impl Cell
impl Cell
Sourcepub fn new_align(string: &str, align: Alignment) -> Cell
pub fn new_align(string: &str, align: Alignment) -> Cell
Create a new Cell
initialized with content from string
.
Text alignment in cell is configurable with the align
argument
Sourcepub fn new(string: &str) -> Cell
pub fn new(string: &str) -> Cell
Create a new Cell
initialized with content from string
.
By default, content is align to LEFT
Sourcepub fn with_style(self, attr: Attr) -> Cell
pub fn with_style(self, attr: Attr) -> Cell
Add a style attribute to the cell. Can be chained
Sourcepub fn with_hspan(self, hspan: usize) -> Cell
pub fn with_hspan(self, hspan: usize) -> Cell
Add horizontal spanning to the cell
Sourcepub fn reset_style(&mut self)
pub fn reset_style(&mut self)
Remove all style attributes and reset alignment to default (LEFT)
Sourcepub fn style_spec(self, spec: &str) -> Cell
pub fn style_spec(self, spec: &str) -> Cell
Set 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 …
Sourcepub fn get_content(&self) -> String
pub fn get_content(&self) -> String
Return a copy of the full string contained in the cell