Skip to main content

Inotify

Struct Inotify 

Source
pub struct Inotify { /* private fields */ }
Expand description

Instance inotify : possède un [OwnedFd], fermé au Drop.

Implementations§

Source§

impl Inotify

Source

pub fn as_fd(&self) -> BorrowedFd<'_>

FD emprunté (intégration dans une boucle d’événements — poll/io_uring).

Source

pub fn into_fd(self) -> OwnedFd

Consomme l’instance et rend l’[OwnedFd] (transfert d’ownership).

Source

pub fn add_watch( &self, path: &CStr, mask: InotifyEventMask, ) -> Result<WatchDescriptor, Errno>

Ajoute (ou met à jour, avec [InotifyEventMask::MASK_ADD]) un watch sur path pour les événements mask. path : &CStr (octets terminés NUL, convention couche 0).

§Errors
  • [Errno::ENOSPC] : limite max_user_watches atteinte.
  • [Errno::ENOENT] : path n’existe pas.
  • [Errno::EACCES] : accès en lecture refusé sur path.
  • [Errno::ENOTDIR] : [InotifyEventMask::ONLYDIR] posé et path n’est pas un répertoire.
Source

pub fn remove_watch(&self, wd: WatchDescriptor) -> Result<(), Errno>

Retire le watch wd.

§Errors
  • [Errno::EINVAL] : wd n’est pas un descripteur de watch valide.
Source

pub fn read_events<'b>( &self, buffer: &'b mut [u8], ) -> Result<InotifyEvents<'b>, Errno>

Lit un lot d’événements dans buffer (fourni par l’appelant, zéro allocation) et le décode. Le [InotifyEvents] retourné emprunte buffer ; l’appelant l’itère puis peut consulter [InotifyEvents::truncated] (ADR-032 : un événement coupé est signalé, jamais avalé).

§Errors
  • [Errno::EAGAIN] : FD [InotifyFlags::NONBLOCK] et aucun événement prêt.
  • [Errno::EINVAL] : buffer trop petit pour le prochain événement (l’appelant agrandit — recommandé : INOTIFY_RECOMMENDED_BUFFER_SIZE).

Trait Implementations§

Source§

impl Debug for Inotify

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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