Struct stanza::table::Table

source ·
pub struct Table { /* private fields */ }

Implementations§

source§

impl Table

source

pub fn new(styles: Styles, cols: Vec<Col>, rows: Vec<Row>) -> Self

source

pub fn with_styles(styles: Styles) -> Self

source

pub fn with_cols(self, cols: Vec<Col>) -> Self

source

pub fn with_row<R: Into<Row>>(self, row: R) -> Self

source

pub fn with_rows(self, rows: impl IntoIterator<Item = Row>) -> Self

source

pub fn set_cols(&mut self, cols: Vec<Col>)

Assigns columns to the table. The number of columns cannot be less (but may exceed) the number of cells in the widest row.

Panics

If the number of columns is fewer than the number of cells in the widest row.

source

pub fn push_row<R: Into<Row>>(&mut self, row: R)

source

pub fn push_rows(&mut self, it: impl IntoIterator<Item = Row>)

source

pub fn num_rows(&self) -> usize

source

pub fn num_cols(&self) -> usize

source

pub fn col(&self, col: usize) -> Element<'_, Col>

source

pub fn row(&self, row_idx: usize) -> Element<'_, Row>

source

pub fn cell(&self, col_idx: usize, row_idx: usize) -> Element<'_, Cell>

source

pub fn is_empty(&self) -> bool

source§

impl Table

source

pub fn col_widths(&self, renderer: &impl Renderer) -> Vec<usize>

source

pub fn col_width(&self, col: usize, renderer: &impl Renderer) -> usize

Trait Implementations§

source§

impl Default for Table

source§

fn default() -> Table

Returns the “default value” for a type. Read more
source§

impl From<Table> for Cell

source§

fn from(table: Table) -> Self

Converts to this type from the input type.
source§

impl From<Table> for Content

source§

fn from(table: Table) -> Self

Converts to this type from the input type.
source§

impl Styled for Table

source§

fn styles(&self) -> &Styles

Auto Trait Implementations§

§

impl !RefUnwindSafe for Table

§

impl !Send for Table

§

impl !Sync for Table

§

impl Unpin for Table

§

impl !UnwindSafe for Table

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>,

§

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>,

§

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.