File tree 7 files changed +35
-3
lines changed
7 files changed +35
-3
lines changed Original file line number Diff line number Diff line change
1
+ Implements ` Into<OwnedFd> ` for ` PtyMaster/Fanotify/Inotify/SignalFd/TimerFd `
Original file line number Diff line number Diff line change @@ -64,6 +64,12 @@ impl AsFd for PtyMaster {
64
64
}
65
65
}
66
66
67
+ impl From < PtyMaster > for OwnedFd {
68
+ fn from ( value : PtyMaster ) -> Self {
69
+ value. 0
70
+ }
71
+ }
72
+
67
73
impl IntoRawFd for PtyMaster {
68
74
fn into_raw_fd ( self ) -> RawFd {
69
75
let fd = self . 0 ;
Original file line number Diff line number Diff line change @@ -101,8 +101,9 @@ impl AsRawFd for EventFd {
101
101
self . 0 . as_raw_fd ( )
102
102
}
103
103
}
104
+
104
105
impl From < EventFd > for OwnedFd {
105
- fn from ( x : EventFd ) -> OwnedFd {
106
- x . 0
106
+ fn from ( value : EventFd ) -> Self {
107
+ value . 0
107
108
}
108
- }
109
+ }
Original file line number Diff line number Diff line change @@ -418,3 +418,9 @@ impl AsFd for Fanotify {
418
418
self . fd . as_fd ( )
419
419
}
420
420
}
421
+
422
+ impl From < Fanotify > for OwnedFd {
423
+ fn from ( value : Fanotify ) -> Self {
424
+ value. fd
425
+ }
426
+ }
Original file line number Diff line number Diff line change @@ -254,3 +254,9 @@ impl AsFd for Inotify {
254
254
self . fd . as_fd ( )
255
255
}
256
256
}
257
+
258
+ impl From < Inotify > for OwnedFd {
259
+ fn from ( value : Inotify ) -> Self {
260
+ value. fd
261
+ }
262
+ }
Original file line number Diff line number Diff line change @@ -147,6 +147,12 @@ impl AsRawFd for SignalFd {
147
147
}
148
148
}
149
149
150
+ impl From < SignalFd > for OwnedFd {
151
+ fn from ( value : SignalFd ) -> Self {
152
+ value. 0
153
+ }
154
+ }
155
+
150
156
impl Iterator for SignalFd {
151
157
type Item = siginfo ;
152
158
Original file line number Diff line number Diff line change @@ -58,6 +58,12 @@ impl FromRawFd for TimerFd {
58
58
}
59
59
}
60
60
61
+ impl From < TimerFd > for OwnedFd {
62
+ fn from ( value : TimerFd ) -> Self {
63
+ value. fd
64
+ }
65
+ }
66
+
61
67
libc_enum ! {
62
68
/// The type of the clock used to mark the progress of the timer. For more
63
69
/// details on each kind of clock, please refer to [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html).
You can’t perform that action at this time.
0 commit comments