File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
9
9
- Added ` SockaddrStorage::{as_unix_addr, as_unix_addr_mut} `
10
10
([ #1871 ] ( https://github.com/nix-rust/nix/pull/1871 ) )
11
11
- Added ` MntFlags ` and ` unmount ` on all of the BSDs.
12
+ - Added ` any() ` and ` all() ` to ` poll::PollFd ` .
13
+ ([ #1877 ] ( https://github.com/nix-rust/nix/pull/1877 ) )
14
+ - Add ` MntFlags ` and ` unmount ` on all of the BSDs.
12
15
([ #1849 ] ( https://github.com/nix-rust/nix/pull/1849 ) )
13
16
- Added a 'Statfs::flags' method.
14
17
([ #1849 ] ( https://github.com/nix-rust/nix/pull/1849 ) )
Original file line number Diff line number Diff line change @@ -37,6 +37,26 @@ impl PollFd {
37
37
PollFlags :: from_bits ( self . pollfd . revents )
38
38
}
39
39
40
+ /// Returns if any of the events of interest occured in the last call to `poll` or `ppoll`. Will
41
+ /// only return `None` if the kernel provides status flags that Nix does not know about.
42
+ ///
43
+ /// Equivalent to `x.revents()? != PollFlags::empty()`.
44
+ ///
45
+ /// This is marginally more efficient than [`PollFd::all`].
46
+ pub fn any ( self ) -> Option < bool > {
47
+ Some ( self . revents ( ) ? != PollFlags :: empty ( ) )
48
+ }
49
+
50
+ /// Returns if all the events of interest occured in the last call to `poll` or `ppoll`. Will
51
+ /// only return `None` if the kernel provides status flags that Nix does not know about.
52
+ ///
53
+ /// Equivalent to `x.revents()? & x.events() == x.events()`.
54
+ ///
55
+ /// This is marginally less efficient than [`PollFd::any`].
56
+ pub fn all ( self ) -> Option < bool > {
57
+ Some ( self . revents ( ) ? & self . events ( ) == self . events ( ) )
58
+ }
59
+
40
60
/// The events of interest for this `PollFd`.
41
61
pub fn events ( self ) -> PollFlags {
42
62
PollFlags :: from_bits ( self . pollfd . events ) . unwrap ( )
You can’t perform that action at this time.
0 commit comments