Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3ca58c8

Browse files
authored
Merge pull request#228 from jokemanfire/dev
Add async doc in top doc
2 parents5e05dd7 +c7c7333 commit3ca58c8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

‎src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
//! files or directories.
88
//!
99
//! The [`Inotify`] struct is the main entry point into the API.
10+
//! The [`EventStream`] struct is designed to be used with async streams.
1011
//!
11-
//! #Example
12+
//! #Examples
1213
//!
14+
//! If you just want to synchronously retrieve events
1315
//! ```
1416
//! use inotify::{
1517
//! Inotify,
@@ -47,7 +49,15 @@
4749
//! // Handle event
4850
//! }
4951
//! ```
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+
//! ```
5161
//! # Attention: inotify gotchas
5262
//!
5363
//! inotify (as in, the Linux API, not this wrapper) has many edge cases, making

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp