Struct cod_render::prelude::TableCell
source · pub struct TableCell<'data> {
pub data: Cow<'data, str>,
pub col_span: usize,
pub alignment: Alignment,
pub pad_content: bool,
}
Expand description
A table cell containing some str data.
A cell may span multiple columns by setting the value of col_span
.
pad_content
will add a space to either side of the cell’s content.AsRef
Fields§
§data: Cow<'data, str>
§col_span: usize
§alignment: Alignment
§pad_content: bool
Implementations§
source§impl<'data> TableCell<'data>
impl<'data> TableCell<'data>
pub fn new<T>(data: T) -> TableCell<'data>where T: ToString,
pub fn new_with_col_span<T>(data: T, col_span: usize) -> TableCell<'data>where T: ToString,
pub fn new_with_alignment<T>( data: T, col_span: usize, alignment: Alignment ) -> TableCell<'data>where T: ToString,
pub fn new_with_alignment_and_padding<T>( data: T, col_span: usize, alignment: Alignment, pad_content: bool ) -> TableCell<'data>where T: ToString,
sourcepub fn width(&self) -> usize
pub fn width(&self) -> usize
Calculates the width of the cell.
New line characters are taken into account during the calculation.
sourcepub fn split_width(&self) -> f32
pub fn split_width(&self) -> f32
The width of the cell’s content divided by its col_span
value.