summary refs log tree commit diff
path: root/sys_util/src/descriptor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'sys_util/src/descriptor.rs')
-rw-r--r--sys_util/src/descriptor.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys_util/src/descriptor.rs b/sys_util/src/descriptor.rs
index 1af72fc..9082394 100644
--- a/sys_util/src/descriptor.rs
+++ b/sys_util/src/descriptor.rs
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-use std::os::unix::io::RawFd;
-
-use crate::{errno_result, Result};
 use std::mem;
 use std::ops::Drop;
+use std::os::unix::io::{AsRawFd, RawFd};
+
+use crate::{errno_result, Result};
 
 pub type RawDescriptor = RawFd;
 
@@ -60,6 +60,12 @@ impl FromRawDescriptor for SafeDescriptor {
     }
 }
 
+impl AsRawFd for SafeDescriptor {
+    fn as_raw_fd(&self) -> RawFd {
+        self.as_raw_descriptor()
+    }
+}
+
 impl SafeDescriptor {
     /// Clones this descriptor, internally creating a new descriptor. The new SafeDescriptor will
     /// share the same underlying count within the kernel.