Struct notify::event::Event[][src]

pub struct Event {
    pub kind: EventKind,
    pub paths: Vec<PathBuf>,
    pub attrs: EventAttributes,
}
Expand description

Notify event.

Fields

kind: EventKind

Kind 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, Any and Other, accompanied by one or more specific variants.

Any should be used when more detail about the event is not known beyond the variant already selected. For example, AccessMode::Any means a file has been accessed, but that’s all we know.

Other should be used when more detail is available, but cannot be encoded as one of the defined variants. When specifying Other, the event attributes should contain an Info entry 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::Other with an Info("mount") may indicate the binding of a mount. The documentation of the particular backend should indicate if any Other events are generated, and what their description means.

The EventKind::Any variant 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 the Tracker attr 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: EventAttributes

Additional attributes of the event.

Arbitrary data may be added to this field, without restriction beyond the Sync and Clone properties. Some data added here is considered for comparing and hashing, but not all: at this writing this is Tracker, Flag, Info, and Source.

Implementations

Retrieves the tracker ID for an event directly, if present.

Retrieves the Notify flag for an event directly, if present.

Retrieves the additional info for an event directly, if present.

Retrieves the source for an event directly, if present.

Creates a new Event given a kind.

Sets the kind.

Adds a path to the event.

Adds a path to the event if the argument is Some.

Sets the tracker.

Sets additional info onto the event.

Sets the Notify flag onto the event.

Sets the process id onto the event.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.