Struct term_table::table_cell::TableCell
source · pub struct TableCell {
pub data: String,
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: String
§col_span: usize
§alignment: Alignment
§pad_content: bool
Implementations§
source§impl TableCell
impl TableCell
pub fn new<T>(data: T) -> TableCellwhere
T: ToString,
pub fn builder<T>(data: T) -> TableCellBuilderwhere
T: ToString,
pub fn new_with_col_span<T>(data: T, col_span: usize) -> TableCellwhere
T: ToString,
👎Deprecated since 1.4.0: Use builder instead
pub fn new_with_alignment<T>(
data: T,
col_span: usize,
alignment: Alignment,
) -> TableCellwhere
T: ToString,
👎Deprecated since 1.4.0: Use builder instead
pub fn new_with_alignment_and_padding<T>(
data: T,
col_span: usize,
alignment: Alignment,
pad_content: bool,
) -> TableCellwhere
T: ToString,
👎Deprecated since 1.4.0: Use builder instead
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.
sourcepub fn wrapped_content(&self, width: usize) -> Vec<String>
pub fn wrapped_content(&self, width: usize) -> Vec<String>
Wraps the cell’s content to the provided width.
New line characters are taken into account.
Trait Implementations§
source§impl Into<TableCell> for &mut TableCellBuilder
impl Into<TableCell> for &mut TableCellBuilder
Auto Trait Implementations§
impl Freeze for TableCell
impl RefUnwindSafe for TableCell
impl Send for TableCell
impl Sync for TableCell
impl Unpin for TableCell
impl UnwindSafe for TableCell
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)