papergrid/records/
into_records.rs

1/// The representation of data, rows and columns of a grid.
2pub trait IntoRecords {
3    /// A string representation of a grid cell.
4    type Cell;
5
6    /// Cell iterator inside a row.
7    type IterColumns: IntoIterator<Item = Self::Cell>;
8
9    /// Rows iterator.
10    type IterRows: IntoIterator<Item = Self::IterColumns>;
11
12    /// Returns an iterator over rows.
13    fn iter_rows(self) -> Self::IterRows;
14}
15
16impl<T> IntoRecords for T
17where
18    T: IntoIterator,
19    <T as IntoIterator>::Item: IntoIterator,
20{
21    type Cell = <<T as IntoIterator>::Item as IntoIterator>::Item;
22    type IterColumns = <T as IntoIterator>::Item;
23    type IterRows = <T as IntoIterator>::IntoIter;
24
25    fn iter_rows(self) -> Self::IterRows {
26        self.into_iter()
27    }
28}