parallel_disk_usage/args/
quantity.rs

1#[cfg(feature = "cli")]
2use clap::ValueEnum;
3
4/// Quantity to be measured.
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6#[cfg_attr(feature = "cli", derive(ValueEnum))]
7pub enum Quantity {
8    /// Measure apparent sizes.
9    #[cfg_attr(feature = "cli", clap(alias = "len"))]
10    ApparentSize,
11    /// Measure block sizes (block-count * 512B).
12    #[cfg(unix)]
13    #[cfg_attr(feature = "cli", clap(alias = "blksize"))]
14    BlockSize,
15    /// Count numbers of blocks.
16    #[cfg(unix)]
17    #[cfg_attr(feature = "cli", clap(alias = "blocks"))]
18    BlockCount,
19}
20
21impl Quantity {
22    /// Default value of the `--quantity` flag.
23    #[cfg(unix)]
24    pub(crate) const DEFAULT: Self = Quantity::BlockSize;
25    /// Default value of the `--quantity` flag.
26    #[cfg(not(unix))]
27    pub(crate) const DEFAULT: Self = Quantity::ApparentSize;
28}