MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / setup_watcher

Function setup_watcher

aiscript-runtime/src/lib.rs:114–130  ·  view source on GitHub ↗
(mut callback: F)

Source from the content-addressed store, hash-verified

112}
113
114fn setup_watcher<F>(mut callback: F) -> notify::Result<RecommendedWatcher>
115where
116 F: FnMut(notify::Event) + Send + 'static,
117{
118 let watcher = notify::recommended_watcher(move |res: notify::Result<notify::Event>| {
119 match res {
120 Ok(event) => {
121 // Only trigger on write/create/remove events
122 if event.kind.is_modify() || event.kind.is_create() || event.kind.is_remove() {
123 callback(event);
124 }
125 }
126 Err(e) => println!("Watch error: {:?}", e),
127 }
128 })?;
129 Ok(watcher)
130}
131
132pub async fn get_pg_connection() -> Option<PgPool> {
133 let config = Config::get();

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected