rusmpp/commands/types/
privacy_indicator.rs

1use crate::types::u8::EndeU8;
2
3#[repr(u8)]
4#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
5pub enum PrivacyIndicator {
6    #[default]
7    NotRestricted = 0,
8    Restricted = 1,
9    Confidential = 2,
10    Secret = 3,
11    Other(u8),
12}
13
14impl From<u8> for PrivacyIndicator {
15    fn from(value: u8) -> Self {
16        match value {
17            0 => PrivacyIndicator::NotRestricted,
18            1 => PrivacyIndicator::Restricted,
19            2 => PrivacyIndicator::Confidential,
20            3 => PrivacyIndicator::Secret,
21            value => PrivacyIndicator::Other(value),
22        }
23    }
24}
25
26impl From<PrivacyIndicator> for u8 {
27    fn from(value: PrivacyIndicator) -> Self {
28        match value {
29            PrivacyIndicator::NotRestricted => 0,
30            PrivacyIndicator::Restricted => 1,
31            PrivacyIndicator::Confidential => 2,
32            PrivacyIndicator::Secret => 3,
33            PrivacyIndicator::Other(value) => value,
34        }
35    }
36}
37
38impl EndeU8 for PrivacyIndicator {}