pub struct EventAttributes { /* private fields */ }Expand description
Implementations§
Source§impl EventAttributes
impl EventAttributes
Sourcepub fn new() -> EventAttributes
pub fn new() -> EventAttributes
Creates a new EventAttributes.
Sourcepub fn tracker(&self) -> Option<usize>
pub fn tracker(&self) -> Option<usize>
Returns a tracking ID (also called a cookie) for related events, if present.
A backend may assign the same ID to multiple events that describe a single operation.
For example, the inotify backend uses a rename cookie to associate RenameMode::From
and RenameMode::To events for the same rename. If it also emits a RenameMode::Both
event, that event has the same ID.
Use this value to match related events from the same watcher. Treat it as an opaque value: its meaning and lifetime depend on the backend, and it is not a persistent file identifier or a globally unique event ID.
Returns None when the backend or event does not provide a tracking ID.
Sourcepub fn flag(&self) -> Option<Flag>
pub fn flag(&self) -> Option<Flag>
Retrieves the Notify flag for an event directly, if present.
Sourcepub fn info(&self) -> Option<&str>
pub fn info(&self) -> Option<&str>
Returns additional, backend-provided information about this event, if present.
This attribute is primarily used to disambiguate the various Other variants in the
EventKind hierarchy (for example EventKind::Other, CreateKind::Other,
ModifyKind::Other, RemoveKind::Other, MetadataKind::Other, …).
When a backend emits an Other kind, it should also set this attribute to a short,
human-readable string explaining what happened. If an event kind indicates Other but
this value is missing, treat it as a backend bug.
Backends may also set this attribute for non-Other kinds, if doing so provides useful
precision. For example, the Modify(Metadata(Extended)) kind suggests using this
attribute when information about what extended metadata changed is available.
§Stability
The exact string values are backend-defined. They are intended as a hint for consumers and may change between notify versions.
§Examples
notify backends and debouncers currently use values such as:
unmount(inotify unmount events)rescan: user dropped/rescan: kernel dropped(FSEvents queue overflow hints)root changed(FSEvents watched root renamed or removed)mount(FSEvents mount or unmount events)is: symlink,is: hardlink,is: clone(FSEvents item type hints)meta: finder info(FSEvents Finder metadata changes)override(a synthetic removal fromnotify-debouncer-fullwhen a rename replaces an existing target)
Sourcepub fn source(&self) -> Option<&str>
pub fn source(&self) -> Option<&str>
Returns a string identifying the backend that produced the event, if present.
This is intended to be a short, unambiguous backend name. A dynamically generated value should include a prefix that identifies the backend.
The built-in notify backends currently leave this attribute unset, so their events return
None. A value can be present in events deserialized with the serde feature.
Sourcepub fn process_id(&self) -> Option<u32>
pub fn process_id(&self) -> Option<u32>
The process ID of the originator of the event.
This attribute is experimental and, while included in Notify itself, is not considered stable or standard enough to be part of the serde, eq, hash, and debug representations.
Sourcepub fn set_tracker(&mut self, tracker: usize)
pub fn set_tracker(&mut self, tracker: usize)
Sets EventAttributes::tracker.
Sourcepub fn set_info(&mut self, info: &str)
pub fn set_info(&mut self, info: &str)
Sets EventAttributes::info.
This should be a short, human-readable string.
Sourcepub fn set_process_id(&mut self, process_id: u32)
pub fn set_process_id(&mut self, process_id: u32)
Sets the process id onto the event.
Trait Implementations§
Source§impl Clone for EventAttributes
impl Clone for EventAttributes
Source§fn clone(&self) -> EventAttributes
fn clone(&self) -> EventAttributes
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more