let mut watcher = notify::recommended_watcher(|res: Result<_>| {
match res {
Ok(event) => {
match event.kind {
EventKind::Modify(ModifyKind::Metadata(_)) => { /* deal with metadata */ }
EventKind::Create(CreateKind::File) => { /* deal with new files */ }
EventKind::Other => { /* ignore meta events */ }
_ => { /* something else changed */ }
}
},
Err(e) => println!("watch error: {:?}", e)
}
})
This code block gives me the error:
error[E0282]: type annotations needed
--> src/main.rs:13:23
|
13 | match event.kind {
| ^^^^^ cannot infer type
Which doesn't make sense to me because the docs for notify use the same code without specifying a type in the match.
Can anyone help explain what is going on and where I should specify which type to get this to work?