MCPcopy Create free account
hub / github.com/GCWing/BitFun / register_search

Function register_search

src/apps/desktop/src/api/commands.rs:95–111  ·  view source on GitHub ↗
(
    state: &State<'_, AppState>,
    search_id: Option<&str>,
)

Source from the content-addressed store, hash-verified

93}
94
95fn register_search(
96 state: &State<'_, AppState>,
97 search_id: Option<&str>,
98) -> Option<Arc<AtomicBool>> {
99 let Some(search_id) = search_id.filter(|value| !value.is_empty()) else {
100 return None;
101 };
102
103 let cancel_flag = Arc::new(AtomicBool::new(false));
104 let mut active_searches = lock_active_searches(state);
105 if let Some(previous_flag) = active_searches.insert(search_id.to_string(), cancel_flag.clone())
106 {
107 previous_flag.store(true, Ordering::Relaxed);
108 }
109
110 Some(cancel_flag)
111}
112
113fn unregister_search(state: &State<'_, AppState>, search_id: Option<&str>) {
114 let Some(search_id) = search_id.filter(|value| !value.is_empty()) else {

Callers 5

search_filesFunction · 0.85
search_filenamesFunction · 0.85
search_file_contentsFunction · 0.85

Calls 5

lock_active_searchesFunction · 0.85
is_emptyMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected