[][src]Struct prettytable::TableSlice

pub struct TableSlice<'a> { /* fields omitted */ }

A borrowed immutable Table slice A TableSlice is obtained by slicing a Table with the Slice::slice method.

Examples

use prettytable::{Table, Slice};
let table = table![[1, 2, 3], [4, 5, 6], [7, 8, 9]];
let slice = table.slice(1..);
slice.printstd(); // Prints only rows 1 and 2

//Also supports other syntax :
table.slice(..);
table.slice(..2);
table.slice(1..3);

Methods

impl<'a> TableSlice<'a>[src]

pub fn get_column_num(&self) -> usize[src]

Compute and return the number of column

pub fn len(&self) -> usize[src]

Get the number of rows

pub fn is_empty(&self) -> bool[src]

Check if the table slice is empty

pub fn get_row(&self, row: usize) -> Option<&Row>[src]

Get an immutable reference to a row

Important traits for ColumnIter<'a>
pub fn column_iter(&self, column: usize) -> ColumnIter[src]

Returns an iterator over the immutable cells of the column specified by column

pub fn row_iter(&self) -> Iter<Row>[src]

Returns an iterator over immutable rows

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

Print the table to out

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

Print the table to terminal out, applying styles when needed

pub fn print_tty(&self, force_colorize: bool)[src]

Print the table to standard output. Colors won't be displayed unless stdout is a tty terminal, or force_colorize is set to true. In ANSI terminals, colors are displayed using ANSI escape characters. When for example the output is redirected to a file, or piped to another program, the output is considered as not beeing tty, and ANSI escape characters won't be displayed unless force colorize is set to true.

Panic

Panic if writing to standard output fails

pub fn printstd(&self)[src]

Print the table to standard output. Colors won't be displayed unless stdout is a tty terminal. This means that if stdout is redirected to a file, or piped to another program, no color will be displayed. To force colors rendering, use print_tty() method. Calling printstd() is equivalent to calling print_tty(false)

Panic

Panic if writing to standard output fails

Trait Implementations

impl<'a> PartialEq<TableSlice<'a>> for TableSlice<'a>[src]

impl<'a> AsRef<TableSlice<'a>> for TableSlice<'a>[src]

impl<'a> AsRef<TableSlice<'a>> for Table[src]

impl<'a> IntoIterator for &'a TableSlice<'a>[src]

type Item = &'a Row

The type of the elements being iterated over.

type IntoIter = Iter<'a, Row>

Which kind of iterator are we turning this into?

impl<'a> Clone for TableSlice<'a>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a> Eq for TableSlice<'a>[src]

impl<'a> Debug for TableSlice<'a>[src]

impl<'a> Display for TableSlice<'a>[src]

impl<'a> Hash for TableSlice<'a>[src]

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

Feeds a slice of this type into the given [Hasher]. Read more

impl<'a> Index<usize> for TableSlice<'a>[src]

type Output = Row

The returned type after indexing.

Auto Trait Implementations

impl<'a> Send for TableSlice<'a>

impl<'a> Sync for TableSlice<'a>

Blanket Implementations

impl<'a, T, E> Slice for T where
    T: AsRef<TableSlice<'a>>,
    [Row]: Index<E>,
    <[Row] as Index<E>>::Output == [Row]
[src]

type Output = TableSlice<'a>

Type output after slicing

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]