|
7 | 7 | //! files or directories.
|
8 | 8 | //!
|
9 | 9 | //! The [`Inotify`] struct is the main entry point into the API.
|
| 10 | +//! The [`EventStream`] struct is designed to be used with async streams. |
10 | 11 | //!
|
11 |
| -//! #Example |
| 12 | +//! #Examples |
12 | 13 | //!
|
| 14 | +//! If you just want to synchronously retrieve events |
13 | 15 | //! ```
|
14 | 16 | //! use inotify::{
|
15 | 17 | //! Inotify,
|
|
47 | 49 | //! // Handle event
|
48 | 50 | //! }
|
49 | 51 | //! ```
|
50 |
| -//! |
| 52 | +//! When you want to read events asynchronously, you need to convert it to [`EventStream`]. |
| 53 | +//! The transform function is [`Inotify::into_event_stream`] |
| 54 | +//! ``` |
| 55 | +//! let mut stream = inotify.into_event_stream(&mut buffer)?; |
| 56 | +//! // Read events from async stream |
| 57 | +//! while let Some(event_or_error) = stream.next().await { |
| 58 | +//! println!("event: {:?}", event_or_error?); |
| 59 | +//! } |
| 60 | +//! ``` |
51 | 61 | //! # Attention: inotify gotchas
|
52 | 62 | //!
|
53 | 63 | //! inotify (as in, the Linux API, not this wrapper) has many edge cases, making
|
|