MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / get_watcher

Function get_watcher

crates/opencode-watcher/src/lib.rs:209–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

207static FILE_WATCHER: std::sync::OnceLock<Arc<FileWatcher>> = std::sync::OnceLock::new();
208
209pub fn get_watcher() -> Arc<FileWatcher> {
210 FILE_WATCHER
211 .get_or_init(|| {
212 Arc::new(
213 FileWatcher::new(WatcherConfig::default()).expect("Failed to create file watcher"),
214 )
215 })
216 .clone()
217}
218
219pub fn init_watcher(config: WatcherConfig) -> Arc<FileWatcher> {
220 let watcher = Arc::new(FileWatcher::new(config).expect("Failed to create file watcher"));

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected