@@ -20,6 +20,11 @@ pub struct RegistryHelper {
20
20
}
21
21
22
22
impl RegistryHelper {
23
+ /// Create a new `RegistryHelper`.
24
+ ///
25
+ /// # Arguments
26
+ ///
27
+ /// * `config` - The string with registry configuration information.
23
28
pub fn new ( config : & str ) -> Result < Self , RegistryError > {
24
29
let registry: Registry = match serde_json:: from_str ( config) {
25
30
Ok ( config) => config,
@@ -42,6 +47,15 @@ impl RegistryHelper {
42
47
self . what_if = true ;
43
48
}
44
49
50
+ /// Get from registry.
51
+ ///
52
+ /// # Returns
53
+ ///
54
+ /// * `Registry` - The registry struct.
55
+ ///
56
+ /// # Errors
57
+ ///
58
+ /// * `RegistryError` - The error that occurred.
45
59
pub fn get ( & self ) -> Result < Registry , RegistryError > {
46
60
let exist: bool ;
47
61
let ( reg_key, _subkey) = match self . open ( Security :: Read ) {
@@ -88,6 +102,15 @@ impl RegistryHelper {
88
102
}
89
103
}
90
104
105
+ /// Set in registry.
106
+ ///
107
+ /// # Returns
108
+ ///
109
+ /// * `Registry` - The registry struct.
110
+ ///
111
+ /// # Errors
112
+ ///
113
+ /// * `RegistryError` - The error that occurred.
91
114
pub fn set ( & self ) -> Result < Option < Registry > , RegistryError > {
92
115
let mut what_if_metadata: Vec < String > = Vec :: new ( ) ;
93
116
let reg_key = match self . open ( Security :: Write ) {
@@ -194,6 +217,15 @@ impl RegistryHelper {
194
217
Ok ( None )
195
218
}
196
219
220
+ /// Delete from registry.
221
+ ///
222
+ /// # Returns
223
+ ///
224
+ /// Nothing on success.
225
+ ///
226
+ /// # Errors
227
+ ///
228
+ /// * `RegistryError` - The error that occurred.
197
229
pub fn remove ( & self ) -> Result < ( ) , RegistryError > {
198
230
let ( reg_key, _subkey) = match self . open ( Security :: AllAccess ) {
199
231
Ok ( reg_key) => reg_key,
0 commit comments