Struct Reader
struct Reader<'buf, Fd: AsFd> { ... }
An inotify event iterator implemented with the read syscall.
See the RawDir API for more details and usage examples as this API is
based on it.
Implementations
impl<'buf, Fd: AsFd> Reader<'buf, Fd>
fn next(self: &mut Self) -> Result<Event<'_>>Read the next inotify event.
This is similar to
Iterator::nextexcept that it doesn't return anOption, because the stream doesn't have an ending. It always returns events or errors.If there are no events in the buffer and none ready to be read:
- If the file descriptor was opened with
inotify::CreateFlags::NONBLOCK, this will fail withErrno::AGAIN. - Otherwise this will block until at least one event is ready or an error occurs.
- If the file descriptor was opened with
fn is_buffer_empty(self: &Self) -> boolReturns true if the internal buffer is empty and will be refilled when calling
next. This is useful to avoid further blocking reads.
impl<'buf, Fd: AsFd> Reader<'buf, Fd>
fn new(fd: Fd, buf: &'buf mut [MaybeUninit<u8>]) -> SelfCreate a new iterator from the given file descriptor and buffer.
impl<'buf, Fd> Freeze for Reader<'buf, Fd>
impl<'buf, Fd> RefUnwindSafe for Reader<'buf, Fd>
impl<'buf, Fd> Send for Reader<'buf, Fd>
impl<'buf, Fd> Sync for Reader<'buf, Fd>
impl<'buf, Fd> Unpin for Reader<'buf, Fd>
impl<'buf, Fd> UnsafeUnpin for Reader<'buf, Fd>
impl<'buf, Fd> UnwindSafe for Reader<'buf, Fd>
impl<T> Any for Reader<'buf, Fd>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Reader<'buf, Fd>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Reader<'buf, Fd>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for Reader<'buf, Fd>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for Reader<'buf, Fd>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Reader<'buf, Fd>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Reader<'buf, Fd>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>