Struct Event
struct Event { ... }
Notify event.
You might want to check Event::need_rescan to make sure no event was missed before you
received this one.
Fields
kind: EventKindKind or type of the event.
This is a hierarchy of enums describing the event as precisely as possible. All enums in the hierarchy have two variants always present,
AnyandOther, accompanied by one or more specific variants.Anyshould be used when more detail about the event is not known beyond the variant already selected. For example,AccessMode::Anymeans a file has been accessed, but that's all we know.Othershould be used when more detail is available, but cannot be encoded as one of the defined variants. When specifyingOther, the event attributes should contain anInfoentry with a short string identifying this detail. That string is to be considered part of the interface of the backend (i.e. a change should probably be breaking).For example,
CreateKind::Otherwith anInfo("mount")may indicate the binding of a mount. The documentation of the particular backend should indicate if anyOtherevents are generated, and what their description means.The
EventKind::Anyvariant should be used as the "else" case when mapping native kernel bitmasks or bitmaps, such that if the mask is ever extended with new event types the backend will not gain bugs due to not matching new unknown event types.paths: Vec<PathBuf>Paths the event is about, if known.
If an event concerns two or more paths, and the paths are known at the time of event creation, they should all go in this
Vec. Otherwise, using theTrackerattr may be more appropriate.The order of the paths is likely to be significant! For example, renames where both ends of the name change are known will have the "source" path first, and the "target" path last.
attrs: EventAttributesAdditional attributes of the event.
Arbitrary data may be added to this field, without restriction beyond the
SyncandCloneproperties. Some data added here is considered for comparing and hashing, but not all: at this writing this isTracker,Flag,Info, andSource.
Implementations
impl Event
fn need_rescan(self: &Self) -> boolReturns whether some events may have been missed. If true, you should assume any file or folder might have been modified.
See
Flag::Rescanfor more information.fn tracker(self: &Self) -> Option<usize>Retrieves the tracker ID for an event directly, if present.
fn flag(self: &Self) -> Option<Flag>Retrieves the Notify flag for an event directly, if present.
fn info(self: &Self) -> Option<&str>Retrieves the additional info for an event directly, if present.
fn source(self: &Self) -> Option<&str>Retrieves the source for an event directly, if present.
fn new(kind: EventKind) -> SelfCreates a new
Eventgiven a kind.fn set_kind(self: Self, kind: EventKind) -> SelfSets the kind.
fn add_path(self: Self, path: PathBuf) -> SelfAdds a path to the event.
fn add_some_path(self: Self, path: Option<PathBuf>) -> SelfAdds a path to the event if the argument is Some.
fn set_tracker(self: Self, tracker: usize) -> SelfSets the tracker.
fn set_info(self: Self, info: &str) -> SelfSets additional info onto the event.
fn set_flag(self: Self, flag: Flag) -> SelfSets the Notify flag onto the event.
fn set_process_id(self: Self, process_id: u32) -> SelfSets the process id onto the event.
impl Clone for Event
fn clone(self: &Self) -> Event
impl Debug for Event
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Default for Event
fn default() -> Self
impl Eq for Event
impl Freeze for Event
impl Hash for Event
fn hash<H: Hasher>(self: &Self, state: &mut H)
impl PartialEq for Event
fn eq(self: &Self, other: &Self) -> bool
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
impl<T> Any for Event
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Event
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Event
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Event
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Event
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Event
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Event
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Event
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Event
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>