Struct Cell

Source
pub struct Cell { /* private fields */ }
Expand description

A table cell represents a single grid rectangle within a table.

Cells belong to a row.

Implementations§

Source§

impl Cell

Source

pub fn empty() -> Cell

Source

pub fn new(contents: Vec<Content>, base_style: ContentStyle) -> Cell

Source

pub fn from_styled_content(format: &str, contents: Vec<&str>) -> Cell

Returns a Cell from styled content.

§Arguments
  • format - The style format.
  • contents - The contents of the new cell.
Source

pub fn from_data_item(data_item: &DataItem, base_style: ContentStyle) -> Cell

Returns a Cell from a DataItem.

§Arguments
  • data_item - The data item from which to build the table cell.
  • base_style - The base style to apply to the cell contents.
Source

pub fn get_cell_width(self: &Cell) -> CellWidth

Returns the column break specified in the first content line of the cell.

This is used to determine the column break for cells used in the table header row.

Source

pub fn get_iterator( self: &Cell, column_break: &CellWidth, ) -> TableCellContentIterator<'_>

Returns the next formatted line of content from this table cell.

§Arguments
  • self - The table cell containing the line.
  • width - The format width.
Source

pub fn measure_height(self: &Cell, column_break: &CellWidth) -> usize

Measures the height needed for this cell when formatting its contents into a specific column width.

§Arguments
  • self - The table cell being measured.
  • column_width - The column width to measure against.
Source

pub fn measure_width(self: &Cell, column_break: &CellWidth) -> usize

Measures the width of this cell.

§Arguments
  • self - The table cell being measured.
  • column_break - The column break for this cell.

Trait Implementations§

Source§

impl Debug for Cell

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Cell

§

impl RefUnwindSafe for Cell

§

impl Send for Cell

§

impl Sync for Cell

§

impl Unpin for Cell

§

impl UnwindSafe for Cell

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.