[−][src]Struct text_grid::Grid
A builder used to create plain-text table from values.
Examples
use text_grid::*; struct RowData { a: u32, b: u32, } impl RowSource for RowData { fn fmt_row<'a>(w: &mut impl RowWrite<Source=&'a Self>) { w.column("a", |s| s.a); w.column("b", |s| s.b); } } let mut g = Grid::new(); g.push_row(&RowData { a: 300, b: 1 }); g.push_row(&RowData { a: 2, b: 200 }); print!("{}", g);
Output:
a | b |
-----|-----|
300 | 1 |
2 | 200 |
Methods
impl<R: RowSource + ?Sized> Grid<R, RowSourceGridSchema>
[src]
pub fn new() -> Self
[src]
Create a new Grid
with RowSourceGridSchema
and prepare header rows.
impl<R: ?Sized, S: GridSchema<R>> Grid<R, S>
[src]
pub fn new_with_schema(schema: S) -> Self
[src]
Create a new Grid
with specified schema and prepare header rows.
impl<R: ?Sized, S: GridSchema<R>> Grid<R, S>
[src]
pub fn push_row(&mut self, source: &R)
[src]
Append a row to the bottom of the grid.
pub fn push_separator(&mut self)
[src]
Append a row separator to the bottom of the grid.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,