# [−][src]Crate inotify

Idiomatic inotify wrapper for the Rust programming language

# About

inotify-rs is an idiomatic wrapper around the Linux kernel's inotify API for the Rust programming language. It can be used for monitoring changes to files or directories.

The `Inotify` struct is the main entry point into the API.

# Example

    use inotify::{
        Inotify,
        WatchMask,
    };

    let mut inotify = Inotify::init()
        .expect("Error while initializing inotify instance");

    // Watch for modify and close events.
    inotify
        .add_watch(
            "/tmp/inotify-rs-test-file",
            WatchMask::MODIFY | WatchMask::CLOSE,
        )
        .expect("Failed to add file watch");

    // Read events that were added with `add_watch` above.
    let mut buffer = [0; 1024];
    let events = inotify.read_events_blocking(&mut buffer)
        .expect("Error while reading events");

    for event in events {
        // Handle event
    }

# Attention: inotify gotchas

inotify (as in, the Linux API, not this wrapper) has many edge cases, making it hard to use correctly. This can lead to weird and hard to find bugs in applications that are based on it. inotify-rs does its best to fix these issues, but sometimes this would require an amount of runtime overhead that is just unacceptable for a low-level wrapper such as this.

We've documented any issues that inotify-rs has inherited from inotify, as far as we are aware of them. Please watch out for any further warnings throughout this documentation. If you want to be on the safe side, in case we have missed something, please read the inotify man pages carefully.

## Structs

Event | An inotify event
EventMask | Indicates the type of an event
Events | Iterator over inotify events
Inotify | Idiomatic Rust wrapper around Linux's inotify API
WatchDescriptor | Represents a watch on an inode
WatchMask | Describes a file system watch

## Type Definitions

EventOwned | An owned version of `Event`

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)