fix windows traits

master
dignifiedquire 5 years ago
parent 92532612b7
commit e0928463b1

@ -230,7 +230,6 @@ cfg_unix! {
cfg_windows! { cfg_windows! {
use crate::os::windows::io::{ use crate::os::windows::io::{
AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle,
AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket, AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket,
}; };
@ -242,7 +241,7 @@ cfg_windows! {
impl FromRawSocket for TcpListener { impl FromRawSocket for TcpListener {
unsafe fn from_raw_socket(handle: RawSocket) -> TcpListener { unsafe fn from_raw_socket(handle: RawSocket) -> TcpListener {
net::TcpListener::from_raw_socket(handle).try_into().unwrap() std::net::TcpListener::from_raw_socket(handle).into()
} }
} }

@ -388,17 +388,19 @@ cfg_unix! {
} }
cfg_windows! { cfg_windows! {
use crate::os::windows::io::{AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle, RawSocket, AsRawSocket, FromRawSocket, IntoRawSocket}; use crate::os::windows::io::{
RawSocket, AsRawSocket, FromRawSocket, IntoRawSocket
};
impl AsRawSocket for TcpStream { impl AsRawSocket for TcpStream {
fn as_raw_socket(&self) -> RawSocket { fn as_raw_socket(&self) -> RawSocket {
self.raw_socket self.watcher.get_ref().as_raw_socket()
} }
} }
impl FromRawSocket for TcpStream { impl FromRawSocket for TcpStream {
unsafe fn from_raw_socket(handle: RawSocket) -> TcpStream { unsafe fn from_raw_socket(handle: RawSocket) -> TcpStream {
net::TcpStream::from_raw_socket(handle).try_into().unwrap() std::net::TcpStream::from_raw_socket(handle).into()
} }
} }

@ -482,17 +482,19 @@ cfg_unix! {
} }
cfg_windows! { cfg_windows! {
use crate::os::windows::io::{AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle, RawSocket, AsRawSocket, IntoRawSocket, FromRawSocket}; use crate::os::windows::io::{
RawSocket, AsRawSocket, IntoRawSocket, FromRawSocket
};
impl AsRawSocket for UdpSocket { impl AsRawSocket for UdpSocket {
fn as_raw_socket(&self) -> RawSocket { fn as_raw_socket(&self) -> RawSocket {
self.watcher.as_raw_socket() self.watcher.get_ref().as_raw_socket()
} }
} }
impl FromRawSocket for UdpSocket { impl FromRawSocket for UdpSocket {
unsafe fn from_raw_socket(handle: RawSocket) -> UdpSocket { unsafe fn from_raw_socket(handle: RawSocket) -> UdpSocket {
net::UdpSocket::from_raw_socket(handle).into() std::net::UdpSocket::from_raw_socket(handle).into()
} }
} }

Loading…
Cancel
Save