1use std::fmt::{Display, Formatter};
4
5use crate::ffi;
6
7bitflags::bitflags! {
8 #[repr(C)]
10 pub struct StreamFlags: u32 {
11 const NONE = ffi::kFSEventStreamEventFlagNone;
12 const MUST_SCAN_SUBDIRS = ffi::kFSEventStreamEventFlagMustScanSubDirs;
13 const USER_DROPPED = ffi::kFSEventStreamEventFlagUserDropped;
14 const KERNEL_DROPPED = ffi::kFSEventStreamEventFlagKernelDropped;
15 const IDS_WRAPPED = ffi::kFSEventStreamEventFlagEventIdsWrapped;
16 const HISTORY_DONE = ffi::kFSEventStreamEventFlagHistoryDone;
17 const ROOT_CHANGED = ffi::kFSEventStreamEventFlagRootChanged;
18 const MOUNT = ffi::kFSEventStreamEventFlagMount;
19 const UNMOUNT = ffi::kFSEventStreamEventFlagUnmount;
20 const ITEM_CREATED = ffi::kFSEventStreamEventFlagItemCreated;
21 const ITEM_REMOVED = ffi::kFSEventStreamEventFlagItemRemoved;
22 const INODE_META_MOD = ffi::kFSEventStreamEventFlagItemInodeMetaMod;
23 const ITEM_RENAMED = ffi::kFSEventStreamEventFlagItemRenamed;
24 const ITEM_MODIFIED = ffi::kFSEventStreamEventFlagItemModified;
25 const FINDER_INFO_MOD = ffi::kFSEventStreamEventFlagItemFinderInfoMod;
26 const ITEM_CHANGE_OWNER = ffi::kFSEventStreamEventFlagItemChangeOwner;
27 const ITEM_XATTR_MOD = ffi::kFSEventStreamEventFlagItemXattrMod;
28 const IS_FILE = ffi::kFSEventStreamEventFlagItemIsFile;
29 const IS_DIR = ffi::kFSEventStreamEventFlagItemIsDir;
30 const IS_SYMLINK = ffi::kFSEventStreamEventFlagItemIsSymlink;
31 const OWN_EVENT = ffi::kFSEventStreamEventFlagOwnEvent;
32 const IS_HARDLINK = ffi::kFSEventStreamEventFlagItemIsHardlink;
33 const IS_LAST_HARDLINK = ffi::kFSEventStreamEventFlagItemIsLastHardlink;
34 const ITEM_CLONED = ffi::kFSEventStreamEventFlagItemCloned;
35 }
36}
37
38impl Display for StreamFlags {
39 fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
40 if self.contains(Self::MUST_SCAN_SUBDIRS) {
41 let _d = write!(f, "MUST_SCAN_SUBDIRS ");
42 }
43 if self.contains(Self::USER_DROPPED) {
44 let _d = write!(f, "USER_DROPPED ");
45 }
46 if self.contains(Self::KERNEL_DROPPED) {
47 let _d = write!(f, "KERNEL_DROPPED ");
48 }
49 if self.contains(Self::IDS_WRAPPED) {
50 let _d = write!(f, "IDS_WRAPPED ");
51 }
52 if self.contains(Self::HISTORY_DONE) {
53 let _d = write!(f, "HISTORY_DONE ");
54 }
55 if self.contains(Self::ROOT_CHANGED) {
56 let _d = write!(f, "ROOT_CHANGED ");
57 }
58 if self.contains(Self::MOUNT) {
59 let _d = write!(f, "MOUNT ");
60 }
61 if self.contains(Self::UNMOUNT) {
62 let _d = write!(f, "UNMOUNT ");
63 }
64 if self.contains(Self::ITEM_CREATED) {
65 let _d = write!(f, "ITEM_CREATED ");
66 }
67 if self.contains(Self::ITEM_REMOVED) {
68 let _d = write!(f, "ITEM_REMOVED ");
69 }
70 if self.contains(Self::INODE_META_MOD) {
71 let _d = write!(f, "INODE_META_MOD ");
72 }
73 if self.contains(Self::ITEM_RENAMED) {
74 let _d = write!(f, "ITEM_RENAMED ");
75 }
76 if self.contains(Self::ITEM_MODIFIED) {
77 let _d = write!(f, "ITEM_MODIFIED ");
78 }
79 if self.contains(Self::FINDER_INFO_MOD) {
80 let _d = write!(f, "FINDER_INFO_MOD ");
81 }
82 if self.contains(Self::ITEM_CHANGE_OWNER) {
83 let _d = write!(f, "ITEM_CHANGE_OWNER ");
84 }
85 if self.contains(Self::ITEM_XATTR_MOD) {
86 let _d = write!(f, "ITEM_XATTR_MOD ");
87 }
88 if self.contains(Self::IS_FILE) {
89 let _d = write!(f, "IS_FILE ");
90 }
91 if self.contains(Self::IS_DIR) {
92 let _d = write!(f, "IS_DIR ");
93 }
94 if self.contains(Self::IS_SYMLINK) {
95 let _d = write!(f, "IS_SYMLINK ");
96 }
97 if self.contains(Self::OWN_EVENT) {
98 let _d = write!(f, "OWN_EVENT ");
99 }
100 if self.contains(Self::IS_LAST_HARDLINK) {
101 let _d = write!(f, "IS_LAST_HARDLINK ");
102 }
103 if self.contains(Self::IS_HARDLINK) {
104 let _d = write!(f, "IS_HARDLINK ");
105 }
106 if self.contains(Self::ITEM_CLONED) {
107 let _d = write!(f, "ITEM_CLONED ");
108 }
109 write!(f, "")
110 }
111}