Skip to content

Commit 478594e

Browse files
authored
Add api to get inner WatchDescriptor id, to work with c code. (#2718)
* Add api to get inner WatchDescriptor id, to work with c code. * changelog * rename WatchDescriptor::inner_id to as_raw
1 parent 5507629 commit 478594e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

changelog/2718.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add WatchDescriptor::as_raw, to get libc id of WatchDescriptor.

src/sys/inotify.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ pub struct Inotify {
113113
pub struct WatchDescriptor {
114114
wd: i32,
115115
}
116+
impl WatchDescriptor {
117+
/// Raw WatchDescriptor, from libc.
118+
pub fn as_raw(self) -> i32 {
119+
self.wd
120+
}
121+
}
116122

117123
/// A single inotify event.
118124
///
@@ -270,4 +276,4 @@ impl From<Inotify> for OwnedFd {
270276
fn from(value: Inotify) -> Self {
271277
value.fd
272278
}
273-
}
279+
}

0 commit comments

Comments
 (0)