1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::feature::Feature;

/// A required feature with a requirement level.
///
/// A required feature is either mandatory or optional.
#[derive(Debug, Clone)]
pub struct Require {
    pub(crate) optional: bool,
    pub(crate) feature: Feature,
}

impl Require {
    pub fn feature(&self) -> &Feature {
        &self.feature
    }

    pub fn optional(&self) -> bool {
        self.optional
    }
}

impl From<Feature> for Require {
    fn from(feature: Feature) -> Self {
        Self {
            optional: false,
            feature,
        }
    }
}