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

Method new

crates/opencode-watcher/src/lib.rs:85–101  ·  view source on GitHub ↗

Create a new file watcher

(config: WatcherConfig)

Source from the content-addressed store, hash-verified

83impl FileWatcher {
84 /// Create a new file watcher
85 pub fn new(config: WatcherConfig) -> Result<Self, WatcherError> {
86 let (event_tx, _) = broadcast::channel(1024);
87
88 let ignore_patterns = config
89 .ignore_patterns
90 .iter()
91 .filter_map(|p| glob::Pattern::new(p).ok())
92 .collect();
93
94 Ok(Self {
95 watcher: RwLock::new(None),
96 watched_paths: DashSet::new(),
97 ignore_patterns,
98 event_tx,
99 debounce_ms: config.debounce_ms,
100 })
101 }
102
103 /// Subscribe to file watcher events
104 pub fn subscribe(&self) -> broadcast::Receiver<WatcherEvent> {

Callers

nothing calls this directly

Calls 1

newFunction · 0.85

Tested by

no test coverage detected