parallel_disk_usage/visualizer/
column_width_distribution.rs

1/// Specify distribution and total number of characters/blocks can be placed
2/// in a line.
3#[derive(Debug, Clone, Copy)]
4pub enum ColumnWidthDistribution {
5    /// Specify total number of characters/blocks can be placed in a line.
6    Total {
7        /// Total number of characters/blocks can be placed in a line.
8        width: usize,
9    },
10    /// Specify (maximum) number of characters/blocks can be placed in a line
11    /// for each individual component of the visualization.
12    Components {
13        /// Maximum number of characters/blocks can be placed in a line
14        /// for the filesystem tree visualization.
15        tree_column_max_width: usize,
16        /// Number of characters/blocks can be placed in a line
17        /// for the proportion bar.
18        bar_column_width: usize,
19    },
20}
21
22pub use ColumnWidthDistribution::*;
23
24impl ColumnWidthDistribution {
25    /// Specify total number of characters/blocks can be placed in a line.
26    #[inline]
27    pub const fn total(width: usize) -> Self {
28        Total { width }
29    }
30
31    /// Specify maximum number of characters/blocks can be placed in a line
32    /// for each individual component of the visualization.
33    #[inline]
34    pub const fn components(tree_column_max_width: usize, bar_column_width: usize) -> Self {
35        Components {
36            tree_column_max_width,
37            bar_column_width,
38        }
39    }
40
41    pub(super) fn set_components(&mut self, tree_column_max_width: usize, bar_column_width: usize) {
42        *self = Self::components(tree_column_max_width, bar_column_width);
43    }
44}