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