Debian Codegraph @

debian/patches/add-v3-v4-feature-gates.patch

raw
1 diff --git a/src/cvss.rs b/src/cvss.rs
2 index 529a66e..4292ca4 100644
3 --- a/src/cvss.rs
4 +++ b/src/cvss.rs
5 @@ -154,7 +154,9 @@ impl fmt::Display for Cvss {
6 #[non_exhaustive]
7 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
8 pub enum MetricType {
9 + #[cfg(feature = "v3")]
10 V3(v3::MetricType),
11 + #[cfg(feature = "v4")]
12 V4(v4::MetricType),
13 }
14
15 @@ -162,7 +164,9 @@ impl MetricType {
16 /// Get the name of this metric (i.e. acronym)
17 pub fn name(self) -> &'static str {
18 match self {
19 + #[cfg(feature = "v3")]
20 Self::V3(m) => m.name(),
21 + #[cfg(feature = "v4")]
22 Self::V4(m) => m.name(),
23 }
24 }
25 @@ -170,7 +174,9 @@ impl MetricType {
26 /// Get a description of this metric.
27 pub fn description(self) -> &'static str {
28 match self {
29 + #[cfg(feature = "v3")]
30 Self::V3(m) => m.description(),
31 + #[cfg(feature = "v4")]
32 Self::V4(m) => m.description(),
33 }
34 }