From 97492ae8c88efa07aed1f4a9fe463850869a7aa1 Mon Sep 17 00:00:00 2001 From: htrefil <8711792+htrefil@users.noreply.github.com> Date: Wed, 16 Sep 2020 18:16:29 +0200 Subject: [PATCH] Implement AsRawFd for AsyncFile --- input/src/async_file.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/input/src/async_file.rs b/input/src/async_file.rs index d114b84..ae97b08 100644 --- a/input/src/async_file.rs +++ b/input/src/async_file.rs @@ -4,7 +4,7 @@ use mio::{Poll, PollOpt, Ready, Token}; use std::convert::AsRef; use std::fs::{File, OpenOptions}; use std::io::{Error, Read, Write}; -use std::os::unix::io::AsRawFd; +use std::os::unix::io::{AsRawFd, RawFd}; use std::path::Path; use std::pin::Pin; use std::task::{self, Context}; @@ -31,6 +31,12 @@ impl AsyncFile { } } +impl AsRawFd for AsyncFile { + fn as_raw_fd(&self) -> RawFd { + self.file.get_ref().0.as_raw_fd() + } +} + impl AsyncRead for AsyncFile { fn poll_read( mut self: Pin<&mut Self>,