net: implement AsRawSocket on Windows (#2911)

This commit is contained in:
Taiki Endo 2020-10-06 02:22:19 +09:00 committed by GitHub
parent 242ea01189
commit 561a71ad63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 30 deletions

View File

@ -431,14 +431,12 @@ mod sys {
#[cfg(windows)]
mod sys {
// TODO: let's land these upstream with mio and then we can add them here.
//
// use std::os::windows::prelude::*;
// use super::{TcpListener;
//
// impl AsRawHandle for TcpListener {
// fn as_raw_handle(&self) -> RawHandle {
// self.listener.io().as_raw_handle()
// }
// }
use super::TcpListener;
use std::os::windows::prelude::*;
impl AsRawSocket for TcpListener {
fn as_raw_socket(&self) -> RawSocket {
self.io.get_ref().as_raw_socket()
}
}
}

View File

@ -596,14 +596,12 @@ mod sys {
#[cfg(windows)]
mod sys {
// TODO: let's land these upstream with mio and then we can add them here.
//
// use std::os::windows::prelude::*;
// use super::TcpStream;
//
// impl AsRawHandle for TcpStream {
// fn as_raw_handle(&self) -> RawHandle {
// self.io.get_ref().as_raw_handle()
// }
// }
use super::TcpStream;
use std::os::windows::prelude::*;
impl AsRawSocket for TcpStream {
fn as_raw_socket(&self) -> RawSocket {
self.io.get_ref().as_raw_socket()
}
}
}

View File

@ -356,14 +356,12 @@ mod sys {
#[cfg(windows)]
mod sys {
// TODO: let's land these upstream with mio and then we can add them here.
//
// use std::os::windows::prelude::*;
// use super::UdpSocket;
//
// impl AsRawHandle for UdpSocket {
// fn as_raw_handle(&self) -> RawHandle {
// self.io.get_ref().as_raw_handle()
// }
// }
use super::UdpSocket;
use std::os::windows::prelude::*;
impl AsRawSocket for UdpSocket {
fn as_raw_socket(&self) -> RawSocket {
self.io.get_ref().as_raw_socket()
}
}
}