1 | /// A trait which is responsible for configuration of a [`Table`]. |
2 | /// |
3 | /// [`Table`]: crate::Table |
4 | pub trait TableOption<R, D, C> { |
5 | /// The function allows modification of records and a grid configuration. |
6 | fn change(self, records: &mut R, cfg: &mut C, dimension: &mut D); |
7 | } |
8 | |
9 | impl<T, R, D, C> TableOption<R, D, C> for &[T] |
10 | where |
11 | for<'a> &'a T: TableOption<R, D, C>, |
12 | { |
13 | fn change(self, records: &mut R, cfg: &mut C, dimension: &mut D) { |
14 | for opt: &T in self { |
15 | opt.change(records, cfg, dimension) |
16 | } |
17 | } |
18 | } |
19 | |
20 | #[cfg (feature = "std" )] |
21 | impl<T, R, D, C> TableOption<R, D, C> for Vec<T> |
22 | where |
23 | T: TableOption<R, D, C>, |
24 | { |
25 | fn change(self, records: &mut R, cfg: &mut C, dimension: &mut D) { |
26 | for opt: T in self { |
27 | opt.change(records, cfg, dimension) |
28 | } |
29 | } |
30 | } |
31 | |