File: add-v3-v4-feature-gates.patch

package info (click to toggle)
rust-cvss 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 580 kB
  • sloc: makefile: 4
file content (34 lines) | stat: -rw-r--r-- 975 bytes parent folder | download
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
30
31
32
33
34
diff --git a/src/cvss.rs b/src/cvss.rs
index 529a66e..4292ca4 100644
--- a/src/cvss.rs
+++ b/src/cvss.rs
@@ -154,7 +154,9 @@ impl fmt::Display for Cvss {
 #[non_exhaustive]
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
 pub enum MetricType {
+    #[cfg(feature = "v3")]
     V3(v3::MetricType),
+    #[cfg(feature = "v4")]
     V4(v4::MetricType),
 }
 
@@ -162,7 +164,9 @@ impl MetricType {
     /// Get the name of this metric (i.e. acronym)
     pub fn name(self) -> &'static str {
         match self {
+	    #[cfg(feature = "v3")]
             Self::V3(m) => m.name(),
+	    #[cfg(feature = "v4")]
             Self::V4(m) => m.name(),
         }
     }
@@ -170,7 +174,9 @@ impl MetricType {
     /// Get a description of this metric.
     pub fn description(self) -> &'static str {
         match self {
+	    #[cfg(feature = "v3")]
             Self::V3(m) => m.description(),
+	    #[cfg(feature = "v4")]
             Self::V4(m) => m.description(),
         }
     }