tabled/grid/dimension/pool_table_dimension.rs
1// TODO: Move it out.
2
3/// PoolTableDimension is a dimension resolve strategy for [`PoolTable`]
4///
5/// [`PoolTable`]: crate::tables::PoolTable
6#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
7pub struct PoolTableDimension {
8 width: DimensionPriority,
9 height: DimensionPriority,
10}
11
12impl PoolTableDimension {
13 /// Creates a new object.
14 pub fn new(width: DimensionPriority, height: DimensionPriority) -> Self {
15 Self { width, height }
16 }
17
18 /// Return a width priority.
19 pub fn width(&self) -> DimensionPriority {
20 self.width
21 }
22
23 /// Return a height priority.
24 pub fn height(&self) -> DimensionPriority {
25 self.height
26 }
27}
28
29/// A control of width/height logic for situations where we must increase some cell to align columns/row.
30#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
31pub enum DimensionPriority {
32 /// Increase first cell width/height in a row/column.
33 First,
34 /// Increase last cell width/height in a row/column.
35 Last,
36 /// Increase cells width/height 1 by 1 in a row/column.
37 List,
38}