1 | use crate::grid::{ |
2 | config::SpannedConfig, |
3 | dimension::SpannedGridDimension, |
4 | records::{ExactRecords, Records}, |
5 | }; |
6 | |
7 | pub(crate) fn get_table_height<R: Records + ExactRecords>( |
8 | records: R, |
9 | cfg: &SpannedConfig, |
10 | ) -> (usize, Vec<usize>) { |
11 | let count_horizontals: usize = cfg.count_horizontal(records.count_rows()); |
12 | |
13 | let margin: Sides = cfg.get_margin(); |
14 | let margin_size: usize = margin.top.size + margin.bottom.size; |
15 | |
16 | let list: Vec = SpannedGridDimension::height(records, cfg); |
17 | let total: usize = list.iter().sum::<usize>(); |
18 | |
19 | let total: usize = total + count_horizontals + margin_size; |
20 | |
21 | (total, list) |
22 | } |
23 | |