From ae34f8fa10f4daddde3d32cc63773d288253d4d4 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Tue, 23 Nov 2021 11:30:24 +0100 Subject: fix: support "other" event type in FSWatcher (#12836) This commit adds support for "other" events in `FSWatcher`. Flags on events are now exposed via the `flag` property on `FsEvent`. --- runtime/ops/fs_events.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'runtime/ops') diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs index 30c6d3aaa..26ad255fd 100644 --- a/runtime/ops/fs_events.rs +++ b/runtime/ops/fs_events.rs @@ -65,8 +65,9 @@ impl Resource for FsEventsResource { /// the complexity. #[derive(Serialize, Debug)] struct FsEvent { - kind: String, + kind: &'static str, paths: Vec, + flag: Option<&'static str>, } impl From for FsEvent { @@ -77,12 +78,15 @@ impl From for FsEvent { EventKind::Create(_) => "create", EventKind::Modify(_) => "modify", EventKind::Remove(_) => "remove", - EventKind::Other => todo!(), // What's this for? Leaving it out for now. - } - .to_string(); + EventKind::Other => "other", + }; + let flag = e.flag().map(|f| match f { + notify::event::Flag::Rescan => "rescan", + }); FsEvent { kind, paths: e.paths, + flag, } } } -- cgit v1.2.3