MCPcopy Create free account
hub / github.com/Moosync/Moosync / load_selective

Method load_selective

src-tauri/preferences/src/preferences.rs:120–136  ·  view source on GitHub ↗
(&self, key: String)

Source from the content-addressed store, hash-verified

118
119 #[tracing::instrument(level = "debug", skip(self, key))]
120 pub fn load_selective<T>(&self, key: String) -> Result<T>
121 where
122 T: DeserializeOwned,
123 {
124 let prefs = self.memcache.lock().unwrap();
125
126 let key = format!("prefs.{}", key);
127 tracing::debug!("Loading selective {}", key);
128
129 let val: Option<T> = prefs.dot_get(key.as_str())?;
130 drop(prefs);
131 if val.is_none() {
132 return Err(format!("No value found for {}", key).into());
133 }
134
135 Ok(val.unwrap())
136 }
137
138 #[tracing::instrument(level = "debug", skip(self, key, value))]
139 pub fn save_selective<T>(&self, key: String, value: Option<T>) -> Result<()>

Callers 11

test_save_and_load_arrayFunction · 0.80
test_update_preferencesFunction · 0.80
load_selective_arrayMethod · 0.80
get_secureMethod · 0.80
initializeMethod · 0.80
initializeMethod · 0.80
update_zoomMethod · 0.80
get_scan_pathsFunction · 0.80
start_scan_innerFunction · 0.80
get_preferencesMethod · 0.80

Calls

no outgoing calls

Tested by 3

test_save_and_load_arrayFunction · 0.64
test_update_preferencesFunction · 0.64