We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 714d692 commit 9b3854bCopy full SHA for 9b3854b
src/lib.rs
@@ -21,6 +21,7 @@ use libc::{self, c_void};
21
use nix::errno::Errno;
22
use nix::unistd::read;
23
use std::mem;
24
+use std::os::fd::{AsFd, BorrowedFd};
25
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
26
27
/// Represents an opaque buffer where userfaultfd events are stored.
@@ -53,6 +54,12 @@ impl Drop for Uffd {
53
54
}
55
56
57
+impl AsFd for Uffd {
58
+ fn as_fd(&self) -> BorrowedFd<'_> {
59
+ unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) }
60
+ }
61
+}
62
+
63
impl AsRawFd for Uffd {
64
fn as_raw_fd(&self) -> RawFd {
65
self.fd
0 commit comments