Skip to main content

Table

Struct Table 

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

A more horizontally compact leaf for Report.

Implementations§

Source§

impl Table

Source

pub fn new<I>(headers: I) -> Self
where I: IntoIterator<Item: Into<Cow<'static, str>>>,

Create a new empty Table with the specified headers.

Trying to add a new row via Table::push_row will fail is the row does not contain the same number of entries as headers.

Source

pub fn status(&self) -> Status

Return the overall status of the table.

Status::Fail will be returned if any internal check is a failure.

Source

pub fn ncols(&self) -> usize

Return the number of columns in the table.

This is equal to the number of headers provided to Table::new.

Source

pub fn nrows(&self) -> usize

Return the number of rows in the table.

Source

pub fn new_row(&self) -> Row

Construct a new Row.

The returned Row will not be automatically added to the table. Use Table::push_row to add it.

Source

pub fn push_row(&mut self, row: Row) -> Result<()>

Add row to the self.

Returns an error if row.len() != self.ncols().

Source

pub fn finish(self) -> Report

Complete the table.

Trait Implementations§

Source§

impl Debug for Table

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Table

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<Table> for Report

Source§

fn from(table: Table) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Table

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Table

§

impl !Send for Table

§

impl !Sync for Table

§

impl !UnwindSafe for Table

§

impl Forget for Table

§

impl Freeze for Table

§

impl Move for Table

§

impl Unpin for Table

§

impl UnsafeUnpin 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.