diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-05-22 01:18:42 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-05-22 01:18:42 +0000 |
commit | 460406d10bbfaa890d56d616b4610813da63a312 (patch) | |
tree | 889af76de40dfca7228a22a38f6b65b9562946f9 /sys_util/src | |
parent | eb223862bd19827cc15d74b8af75b8c45a79b4d0 (diff) | |
parent | 56520c27224579640da9d3e8e4964b0f27dc9bdc (diff) | |
download | crosvm-460406d10bbfaa890d56d616b4610813da63a312.tar crosvm-460406d10bbfaa890d56d616b4610813da63a312.tar.gz crosvm-460406d10bbfaa890d56d616b4610813da63a312.tar.bz2 crosvm-460406d10bbfaa890d56d616b4610813da63a312.tar.lz crosvm-460406d10bbfaa890d56d616b4610813da63a312.tar.xz crosvm-460406d10bbfaa890d56d616b4610813da63a312.tar.zst crosvm-460406d10bbfaa890d56d616b4610813da63a312.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'sys_util/src')
-rw-r--r-- | sys_util/src/descriptor.rs | 12 |
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. |