Implement AsRawFd for AsyncFile

This commit is contained in:
htrefil 2020-09-16 18:16:29 +02:00
parent 82c01ecfe4
commit 97492ae8c8

View file

@ -4,7 +4,7 @@ use mio::{Poll, PollOpt, Ready, Token};
use std::convert::AsRef; use std::convert::AsRef;
use std::fs::{File, OpenOptions}; use std::fs::{File, OpenOptions};
use std::io::{Error, Read, Write}; 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::path::Path;
use std::pin::Pin; use std::pin::Pin;
use std::task::{self, Context}; 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 { impl AsyncRead for AsyncFile {
fn poll_read( fn poll_read(
mut self: Pin<&mut Self>, mut self: Pin<&mut Self>,