/rust/registry/src/index.crates.io-1949cf8c6b5b557f/papergrid-0.17.0/src/dimension/mod.rs
Line | Count | Source |
1 | | //! The module contains an [`Dimension`] trait and its implementations. |
2 | | |
3 | | #[cfg(feature = "std")] |
4 | | pub mod compact; |
5 | | #[cfg(feature = "std")] |
6 | | pub mod iterable; |
7 | | #[cfg(feature = "std")] |
8 | | pub mod peekable; |
9 | | |
10 | | /// Dimension of a grid. |
11 | | /// |
12 | | /// It's a friend trait of [`Estimate`]. |
13 | | pub trait Dimension { |
14 | | /// Get a column width by index. |
15 | | fn get_width(&self, column: usize) -> usize; |
16 | | |
17 | | /// Get a row height by index. |
18 | | fn get_height(&self, row: usize) -> usize; |
19 | | } |
20 | | |
21 | | impl<T> Dimension for &T |
22 | | where |
23 | | T: Dimension, |
24 | | { |
25 | 0 | fn get_height(&self, row: usize) -> usize { |
26 | 0 | T::get_height(self, row) |
27 | 0 | } Unexecuted instantiation: <&papergrid::dimension::peekable::PeekableGridDimension as papergrid::dimension::Dimension>::get_height Unexecuted instantiation: <&&papergrid::dimension::peekable::PeekableGridDimension as papergrid::dimension::Dimension>::get_height Unexecuted instantiation: <&tabled::grid::dimension::complete_dimension::CompleteDimension as papergrid::dimension::Dimension>::get_height Unexecuted instantiation: <&&tabled::grid::dimension::complete_dimension::CompleteDimension as papergrid::dimension::Dimension>::get_height Unexecuted instantiation: <&_ as papergrid::dimension::Dimension>::get_height |
28 | | |
29 | 0 | fn get_width(&self, column: usize) -> usize { |
30 | 0 | T::get_width(self, column) |
31 | 0 | } Unexecuted instantiation: <&papergrid::dimension::peekable::PeekableGridDimension as papergrid::dimension::Dimension>::get_width Unexecuted instantiation: <&&papergrid::dimension::peekable::PeekableGridDimension as papergrid::dimension::Dimension>::get_width Unexecuted instantiation: <&tabled::grid::dimension::complete_dimension::CompleteDimension as papergrid::dimension::Dimension>::get_width Unexecuted instantiation: <&&tabled::grid::dimension::complete_dimension::CompleteDimension as papergrid::dimension::Dimension>::get_width Unexecuted instantiation: <&_ as papergrid::dimension::Dimension>::get_width |
32 | | } |
33 | | |
34 | | /// Dimension estimation of a grid. |
35 | | /// |
36 | | /// It's a friend trait of [`Dimension`]. |
37 | | pub trait Estimate<R, C> { |
38 | | /// Estimates a metric. |
39 | | fn estimate(&mut self, records: R, config: &C); |
40 | | } |
41 | | |
42 | | impl<T, R, C> Estimate<R, C> for &mut T |
43 | | where |
44 | | T: Estimate<R, C>, |
45 | | { |
46 | 0 | fn estimate(&mut self, records: R, config: &C) { |
47 | 0 | T::estimate(self, records, config) |
48 | 0 | } |
49 | | } |