1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/// Chooses if price is flexible (i.e. it depends on some factor).
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
#[must_use]
pub enum Flexibility {
    /// The price is flexible.
    Flexible,
    /// The price is not flexible.
    Inflexible,
}

impl Flexibility {
    /// Checks if `self` is `Flexible`.
    #[must_use]
    pub fn is_flexible(self) -> bool {
        self == Self::Flexible
    }

    /// Checks if `self` is `Inflexible`.
    #[must_use]
    pub fn is_inflexible(self) -> bool {
        self == Self::Inflexible
    }
}