MCPcopy Create free account
hub / github.com/Recordscript/recordscript / set_option

Method set_option

libs/hbb_common/src/config.rs:938–952  ·  view source on GitHub ↗
(k: String, v: String)

Source from the content-addressed store, hash-verified

936 }
937
938 pub fn set_option(k: String, v: String) {
939 if !is_option_can_save(&OVERWRITE_SETTINGS, &k) {
940 return;
941 }
942 let mut config = CONFIG2.write().unwrap();
943 let v2 = if v.is_empty() { None } else { Some(&v) };
944 if v2 != config.options.get(&k) {
945 if v2.is_none() {
946 config.options.remove(&k);
947 } else {
948 config.options.insert(k, v);
949 }
950 config.store();
951 }
952 }
953
954 pub fn update_id() {
955 // to-do: how about if one ip register a lot of ids?

Callers

nothing calls this directly

Calls 6

is_option_can_saveFunction · 0.85
writeMethod · 0.80
is_emptyMethod · 0.80
getMethod · 0.80
removeMethod · 0.80
storeMethod · 0.80

Tested by

no test coverage detected