| 1 | //! The module contains a [Records] abstraction of a [`Grid`] trait and its implementers. |
| 2 | //! |
| 3 | //! [`Grid`]: crate::grid::iterable::Grid |
| 4 | |
| 5 | mod exact_records; |
| 6 | mod into_records; |
| 7 | mod iter_records; |
| 8 | mod peekable_records; |
| 9 | |
| 10 | pub use exact_records::ExactRecords; |
| 11 | pub use into_records::IntoRecords; |
| 12 | pub use iter_records::IterRecords; |
| 13 | pub use peekable_records::PeekableRecords; |
| 14 | |
| 15 | #[cfg (feature = "std" )] |
| 16 | pub mod vec_records; |
| 17 | |
| 18 | /// Records represents table data. |
| 19 | pub trait Records { |
| 20 | /// Iterator which goes over rows. |
| 21 | type Iter: IntoRecords; |
| 22 | |
| 23 | /// Returns a iterator over rows. |
| 24 | fn iter_rows(self) -> <Self::Iter as IntoRecords>::IterRows; |
| 25 | |
| 26 | /// Returns count of columns in the records. |
| 27 | fn count_columns(&self) -> usize; |
| 28 | |
| 29 | /// Hint amount of rows in the records. |
| 30 | fn hint_count_rows(&self) -> Option<usize>; |
| 31 | } |
| 32 | |
| 33 | // todo: Provide a convinient way to iter over columns |
| 34 | // |
| 35 | // probably fn iter_columns(self) -> Option<Self::Iter2> |
| 36 | // |
| 37 | // it'll likely speed up some algos |
| 38 | |
| 39 | // note: |
| 40 | // Maybe simplify IntoRecords; we know count columns any way.... |
| 41 | // and sometimes buffering and stuff hard to implement with this laye of abstraction |
| 42 | |