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
35
36
37
use crate::asn1::Version;
/// Version capability methods.
/// This is the single source of truth for version-to-field mapping.
/// The specification lives here with Version, and builders use these methods.
/// All methods are const to enable compile-time evaluation.
impl Version {
/// Whether this version allows integrity (V1+)
pub const fn allows_integrity(self) -> bool {
matches!(self, Version::V1 | Version::V2 | Version::V3)
}
/// Whether this version allows confidentiality (V1+)
pub const fn allows_confidentiality(self) -> bool {
matches!(self, Version::V1 | Version::V2 | Version::V3)
}
/// Whether this version allows priority (V2+)
pub const fn allows_priority(self) -> bool {
matches!(self, Version::V2 | Version::V3)
}
/// Whether this version allows lifetime (V2+)
pub const fn allows_lifetime(self) -> bool {
matches!(self, Version::V2 | Version::V3)
}
/// Whether this version allows previous_frame (V2+)
pub const fn allows_previous_frame(self) -> bool {
matches!(self, Version::V2 | Version::V3)
}
/// Whether this version allows matrix (V3+)
pub const fn allows_matrix(self) -> bool {
matches!(self, Version::V3)
}
}