Struct prettytable::TableSlice [−][src]
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);
Implementations
impl<'a> TableSlice<'a>
[src]
pub fn to_csv<W: Write>(&self, w: W) -> Result<Writer<W>>
[src]
Write the table to the specified writer.
pub fn to_csv_writer<W: Write>(&self, writer: Writer<W>) -> Result<Writer<W>>
[src]
Write the table to the specified writer.
This allows for format customisation.
impl<'a> TableSlice<'a>
[src]
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
pub fn column_iter(&self, column: usize) -> ColumnIter<'_>ⓘNotable traits for ColumnIter<'a>
impl<'a> Iterator for ColumnIter<'a> type Item = &'a Cell;
[src]
Notable traits for ColumnIter<'a>
impl<'a> Iterator for ColumnIter<'a> type Item = &'a Cell;
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<usize, Error>
[src]
Print the table to out
and returns the number of
line printed, or an error
pub fn print_term<T: Terminal + ?Sized>(
&self,
out: &mut T
) -> Result<usize, Error>
[src]
&self,
out: &mut T
) -> Result<usize, Error>
Print the table to terminal out
, applying styles when needed and returns the number of
line printed, or an error
pub fn print_tty(&self, force_colorize: bool) -> Result<usize, Error>
[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
.
Returns
A Result
holding the number of lines printed, or an io::Error
if any failure happens
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.
Any failure to print is ignored. For better control, use print_tty()
.
Calling printstd()
is equivalent to calling print_tty(false)
and ignoring the result.
pub fn print_html<T: Write + ?Sized>(&self, out: &mut T) -> Result<(), Error>
[src]
Print table in HTML format to out
.
Trait Implementations
impl<'a> AsRef<TableSlice<'a>> for TableSlice<'a>
[src]
fn as_ref(&self) -> &TableSlice<'a>
[src]
impl<'a> AsRef<TableSlice<'a>> for Table
[src]
fn as_ref(&self) -> &TableSlice<'a>
[src]
impl<'a> Clone for TableSlice<'a>
[src]
fn clone(&self) -> TableSlice<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Debug for TableSlice<'a>
[src]
impl<'a> Display for TableSlice<'a>
[src]
impl<'a> Eq for TableSlice<'a>
[src]
impl<'a> Hash for TableSlice<'a>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a> Index<usize> for TableSlice<'a>
[src]
type Output = Row
The returned type after indexing.
fn index(&self, idx: usize) -> &Self::Output
[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?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a> PartialEq<TableSlice<'a>> for TableSlice<'a>
[src]
fn eq(&self, other: &TableSlice<'a>) -> bool
[src]
fn ne(&self, other: &TableSlice<'a>) -> bool
[src]
impl<'a> StructuralEq for TableSlice<'a>
[src]
impl<'a> StructuralPartialEq for TableSlice<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for TableSlice<'a>
impl<'a> Send for TableSlice<'a>
impl<'a> Sync for TableSlice<'a>
impl<'a> Unpin for TableSlice<'a>
impl<'a> UnwindSafe for TableSlice<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'a, T, E> Slice<'a, E> for T where
T: AsRef<TableSlice<'a>>,
[Row]: Index<E>,
<[Row] as Index<E>>::Output == [Row],
[src]
T: AsRef<TableSlice<'a>>,
[Row]: Index<E>,
<[Row] as Index<E>>::Output == [Row],
type Output = TableSlice<'a>
Type output after slicing
pub fn slice(&'a Self, E) -> <T as Slice<'a, E>>::Output
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,