inotify::events

Struct Event

source
pub struct Event<S> {
    pub wd: WatchDescriptor,
    pub mask: EventMask,
    pub cookie: u32,
    pub name: Option<S>,
}
Expand description

An inotify event

A file system event that describes a change that the user previously registered interest in. To watch for events, call Watches::add. To retrieve events, call Inotify::read_events_blocking or Inotify::read_events.

Fields§

§wd: WatchDescriptor

Identifies the watch this event originates from

This WatchDescriptor is equal to the one that Watches::add returned when interest for this event was registered. The WatchDescriptor can be used to remove the watch using Watches::remove, thereby preventing future events of this type from being created.

§mask: EventMask

Indicates what kind of event this is

§cookie: u32

Connects related events to each other

When a file is renamed, this results two events: MOVED_FROM and MOVED_TO. The cookie field will be the same for both of them, thereby making is possible to connect the event pair.

§name: Option<S>

The name of the file the event originates from

This field is set only if the subject of the event is a file or directory in a watched directory. If the event concerns a file or directory that is watched directly, name will be None.

Implementations§

source§

impl<'a> Event<&'a OsStr>

source

fn new(fd: Weak<FdGuard>, event: &inotify_event, name: &'a OsStr) -> Self

source

pub(crate) fn from_buffer(fd: Weak<FdGuard>, buffer: &'a [u8]) -> (usize, Self)

Create an Event from a buffer

Assumes that a full inotify_event plus its name is located at the beginning of buffer.

Returns the number of bytes used from the buffer, and the event.

§Panics

Panics if the buffer does not contain a full event, including its name.

source

pub fn into_owned(&self) -> EventOwned

👎Deprecated: use to_owned() instead; methods named into_owned() usually take self by value

Returns an owned copy of the event.

source

pub fn to_owned(&self) -> EventOwned

Returns an owned copy of the event.

Trait Implementations§

source§

impl<S: Clone> Clone for Event<S>

source§

fn clone(&self) -> Event<S>

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<S: Debug> Debug for Event<S>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for Event<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for Event<S>
where S: RefUnwindSafe,

§

impl<S> Send for Event<S>
where S: Send,

§

impl<S> Sync for Event<S>
where S: Sync,

§

impl<S> Unpin for Event<S>
where S: Unpin,

§

impl<S> UnwindSafe for Event<S>
where S: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where T: Clone,

source§

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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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.