Enum hotwatch::EventKind

source ·
pub enum EventKind {
    Any,
    Access(AccessKind),
    Create(CreateKind),
    Modify(ModifyKind),
    Remove(RemoveKind),
    Other,
}
Expand description

Top-level event kind.

This is arguably the most important classification for events. All subkinds below this one represent details that may or may not be available for any particular backend, but most tools and Notify systems will only care about which of these four general kinds an event is about.

Variants§

§

Any

The catch-all event kind, for unsupported/unknown events.

This 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.

This variant is also the default variant used when Notify is in “imprecise” mode.

§

Access(AccessKind)

An event describing non-mutating access operations on files.

This event is about opening and closing file handles, as well as executing files, and any other such event that is about accessing files, folders, or other structures rather than mutating them.

Only some platforms are capable of generating these.

§

Create(CreateKind)

An event describing creation operations on files.

This event is about the creation of files, folders, or other structures but not about e.g. writing new content into them.

§

Modify(ModifyKind)

An event describing mutation of content, name, or metadata.

This event is about the mutation of files’, folders’, or other structures’ content, name (path), or associated metadata (attributes).

§

Remove(RemoveKind)

An event describing removal operations on files.

This event is about the removal of files, folders, or other structures but not e.g. erasing content from them. This may also be triggered for renames/moves that move files out of the watched subpath.

Some editors also trigger Remove events when saving files as they may opt for removing (or renaming) the original then creating a new file in-place.

§

Other

An event not fitting in any of the above four categories.

This may be used for meta-events about the watch itself.

Implementations§

source§

impl EventKind

source

pub fn is_access(&self) -> bool

Indicates whether an event is an Access variant.

source

pub fn is_create(&self) -> bool

Indicates whether an event is a Create variant.

source

pub fn is_modify(&self) -> bool

Indicates whether an event is a Modify variant.

source

pub fn is_remove(&self) -> bool

Indicates whether an event is a Remove variant.

source

pub fn is_other(&self) -> bool

Indicates whether an event is an Other variant.

Trait Implementations§

source§

impl Clone for EventKind

source§

fn clone(&self) -> EventKind

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for EventKind

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for EventKind

source§

fn default() -> EventKind

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

impl Hash for EventKind

source§

fn hash<__H>(&self, state: &mut __H)where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

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

impl PartialEq<EventKind> for EventKind

source§

fn eq(&self, other: &EventKind) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for EventKind

source§

impl Eq for EventKind

source§

impl StructuralEq for EventKind

source§

impl StructuralPartialEq for EventKind

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.