Struct prettytable::Row

source ·
pub struct Row { /* private fields */ }
Expand description

Represent a table row made of cells

Implementations§

source§

impl Row

source

pub fn new(cells: Vec<Cell>) -> Row

Create a new Row backed with cells vector

source

pub fn empty() -> Row

Create an row of length size, with empty strings stored

source

pub fn column_count(&self) -> usize

👎Deprecated since 0.8.0: Will become private in future release. See issue #87

Count the number of column required in the table grid. It takes into account horizontal spanning of cells. For example, a cell with an hspan of 3 will add 3 column to the grid

source

pub fn len(&self) -> usize

Get the number of cells in this row

source

pub fn is_empty(&self) -> bool

Check if the row is empty (has no cell)

source

pub fn get_height(&self) -> usize

👎Deprecated since 0.8.0: Will become private in future release. See issue #87

Get the height of this row

source

pub fn get_column_width(&self, column: usize, format: &TableFormat) -> usize

👎Deprecated since 0.8.0: Will become private in future release. See issue #87

Get the minimum width required by the cell in the column column. Return 0 if the cell does not exist in this row

source

pub fn get_cell(&self, idx: usize) -> Option<&Cell>

Get the cell at index idx

source

pub fn get_mut_cell(&mut self, idx: usize) -> Option<&mut Cell>

Get the mutable cell at index idx

source

pub fn set_cell(&mut self, cell: Cell, idx: usize) -> Result<(), &str>

Set the cell in the row at the given idx index

source

pub fn add_cell(&mut self, cell: Cell)

Append a cell at the end of the row

source

pub fn insert_cell(&mut self, index: usize, cell: Cell)

Insert cell at position index. If index is higher than the row length, the cell will be appended at the end

source

pub fn remove_cell(&mut self, index: usize)

Remove the cell at position index. Silently skip if this cell does not exist

source

pub fn iter(&self) -> Iter<'_, Cell>

Returns an immutable iterator over cells

source

pub fn iter_mut(&mut self) -> IterMut<'_, Cell>

Returns an mutable iterator over cells

source

pub fn print<T: Write + ?Sized>( &self, out: &mut T, format: &TableFormat, col_width: &[usize], ) -> Result<usize, Error>

👎Deprecated since 0.8.0: Will become private in future release. See issue #87

Print the row to out, with separator as column separator, and col_width specifying the width of each columns. Returns the number of printed lines

source

pub fn print_term<T: Terminal + ?Sized>( &self, out: &mut T, format: &TableFormat, col_width: &[usize], ) -> Result<usize, Error>

👎Deprecated since 0.8.0: Will become private in future release. See issue #87

Print the row to terminal out, with separator as column separator, and col_width specifying the width of each columns. Apply style when needed. returns the number of printed lines

Trait Implementations§

source§

impl Clone for Row

source§

fn clone(&self) -> Row

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Row

source§

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

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

impl Default for Row

source§

fn default() -> Row

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

impl<S: ToString> Extend<S> for Row

source§

fn extend<T: IntoIterator<Item = S>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<T, A> From<T> for Row
where A: ToString, T: IntoIterator<Item = A>,

source§

fn from(it: T) -> Row

Converts to this type from the input type.
source§

impl<A: ToString> FromIterator<A> for Row

source§

fn from_iter<T>(iterator: T) -> Row
where T: IntoIterator<Item = A>,

Creates a value from an iterator. Read more
source§

impl FromIterator<Row> for Table

source§

fn from_iter<T>(iterator: T) -> Table
where T: IntoIterator<Item = Row>,

Creates a value from an iterator. Read more
source§

impl Hash for Row

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Index<usize> for Row

§

type Output = Cell

The returned type after indexing.
source§

fn index(&self, idx: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for Row

source§

fn index_mut(&mut self, idx: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<'a> IntoIterator for &'a Row

§

type Item = &'a Cell

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, Cell>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a> IntoIterator for &'a mut Row

§

type Item = &'a mut Cell

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, Cell>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq for Row

source§

fn eq(&self, other: &Row) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Row

source§

impl StructuralPartialEq for Row

Auto Trait Implementations§

§

impl Freeze for Row

§

impl RefUnwindSafe for Row

§

impl Send for Row

§

impl Sync for Row

§

impl Unpin for Row

§

impl UnwindSafe for Row

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.