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