1use crate::ffi;
7
8#[derive(Clone, Copy, Debug, Default)]
11pub struct LoadSaveFlags(pub u32);
12
13impl LoadSaveFlags {
14 pub const PUBLIC: Self = Self(ffi::RNP_LOAD_SAVE_PUBLIC_KEYS as u32);
15 pub const SECRET: Self = Self(ffi::RNP_LOAD_SAVE_SECRET_KEYS as u32);
16 pub const PERMISSIVE: Self = Self(ffi::RNP_LOAD_SAVE_PERMISSIVE as u32);
17 pub const SINGLE: Self = Self(ffi::RNP_LOAD_SAVE_SINGLE as u32);
18 pub const BASE64: Self = Self(ffi::RNP_LOAD_SAVE_BASE64 as u32);
19
20 pub fn bits(self) -> u32 {
21 self.0
22 }
23}
24
25impl std::ops::BitOr for LoadSaveFlags {
26 type Output = Self;
27 fn bitor(self, rhs: Self) -> Self {
28 Self(self.0 | rhs.0)
29 }
30}
31
32#[derive(Clone, Copy, Debug, Default)]
34pub struct ExportFlags(pub u32);
35
36impl ExportFlags {
37 pub const ARMORED: Self = Self(ffi::RNP_KEY_EXPORT_ARMORED as u32);
38 pub const PUBLIC: Self = Self(ffi::RNP_KEY_EXPORT_PUBLIC as u32);
39 pub const SECRET: Self = Self(ffi::RNP_KEY_EXPORT_SECRET as u32);
40 pub const SUBKEYS: Self = Self(ffi::RNP_KEY_EXPORT_SUBKEYS as u32);
41 pub const BASE64: Self = Self(ffi::RNP_KEY_EXPORT_BASE64 as u32);
42
43 pub fn bits(self) -> u32 {
44 self.0
45 }
46}
47
48impl std::ops::BitOr for ExportFlags {
49 type Output = Self;
50 fn bitor(self, rhs: Self) -> Self {
51 Self(self.0 | rhs.0)
52 }
53}
54
55#[derive(Clone, Copy, Debug, Default)]
57pub struct RemoveFlags(pub u32);
58
59impl RemoveFlags {
60 pub const PUBLIC: Self = Self(ffi::RNP_KEY_REMOVE_PUBLIC as u32);
61 pub const SECRET: Self = Self(ffi::RNP_KEY_REMOVE_SECRET as u32);
62 pub const SUBKEYS: Self = Self(ffi::RNP_KEY_REMOVE_SUBKEYS as u32);
63
64 pub fn bits(self) -> u32 {
65 self.0
66 }
67}
68
69impl std::ops::BitOr for RemoveFlags {
70 type Output = Self;
71 fn bitor(self, rhs: Self) -> Self {
72 Self(self.0 | rhs.0)
73 }
74}
75
76#[derive(Clone, Copy, Debug, Default)]
79pub struct RemoveSignaturesFlags(pub u32);
80
81impl RemoveSignaturesFlags {
82 pub const INVALID: Self = Self(ffi::RNP_KEY_SIGNATURE_INVALID as u32);
83 pub const UNKNOWN_KEY: Self = Self(ffi::RNP_KEY_SIGNATURE_UNKNOWN_KEY as u32);
84 pub const NON_SELF_SIG: Self = Self(ffi::RNP_KEY_SIGNATURE_NON_SELF_SIG as u32);
85
86 pub fn bits(self) -> u32 {
87 self.0
88 }
89}
90
91impl std::ops::BitOr for RemoveSignaturesFlags {
92 type Output = Self;
93 fn bitor(self, rhs: Self) -> Self {
94 Self(self.0 | rhs.0)
95 }
96}
97
98#[derive(Clone, Copy, Debug, Default)]
100pub struct UnloadFlags(pub u32);
101
102impl UnloadFlags {
103 pub const PUBLIC: Self = Self(ffi::RNP_KEY_UNLOAD_PUBLIC as u32);
104 pub const SECRET: Self = Self(ffi::RNP_KEY_UNLOAD_SECRET as u32);
105
106 pub fn bits(self) -> u32 {
107 self.0
108 }
109}
110
111impl std::ops::BitOr for UnloadFlags {
112 type Output = Self;
113 fn bitor(self, rhs: Self) -> Self {
114 Self(self.0 | rhs.0)
115 }
116}