Skip to content

Commit

Permalink
Update to windows-sys 0.36
Browse files Browse the repository at this point in the history
Removes the need for the Win32_NetworkManagement_IpHelper feature as
AF_INET and AF_INET6 are now included in the Win32_Networking_WinSock
feature.
  • Loading branch information
Thomasdezeeuw committed Apr 28, 2022
1 parent 831b27b commit 229230c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ log = "0.4.8"
libc = "0.2.121"

[target.'cfg(windows)'.dependencies.windows-sys]
version = ">=0.32, <=0.34"
version = "=0.36"
features = [
"Win32_Storage_FileSystem", # Enables NtCreateFile
"Win32_Foundation", # Basic types eg HANDLE
"Win32_Networking_WinSock", # winsock2 types/functions
"Win32_NetworkManagement_IpHelper", # AF_INET and AF_INET6 constants
"Win32_System_IO", # IO types like OVERLAPPED etc
"Win32_System_WindowsProgramming", # General future used for various types/funcs
]
Expand Down
9 changes: 2 additions & 7 deletions src/sys/windows/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ use std::net::SocketAddr;
use std::sync::Once;

use windows_sys::Win32::Networking::WinSock::{
ioctlsocket, socket, FIONBIO, IN6_ADDR, IN6_ADDR_0, INVALID_SOCKET, IN_ADDR, IN_ADDR_0,
SOCKADDR, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_IN6_0, SOCKET,
ioctlsocket, socket, AF_INET, AF_INET6, FIONBIO, IN6_ADDR, IN6_ADDR_0, INVALID_SOCKET, IN_ADDR,
IN_ADDR_0, SOCKADDR, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_IN6_0, SOCKET,
};
// We need to import a giant feature set for these 2 constants, they will hopefully
// be moved to `Win32::Networking::WinSock` in the future, since this needlessly
// increases compile times for all downstream users
// <https://github.com/microsoft/win32metadata/issues/845>
pub(crate) use windows_sys::Win32::NetworkManagement::IpHelper::{AF_INET, AF_INET6};

/// Initialise the network stack for Windows.
pub(crate) fn init() {
Expand Down
6 changes: 4 additions & 2 deletions src/sys/windows/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ use std::io;
use std::net::{self, SocketAddr};
use std::os::windows::io::AsRawSocket;

use windows_sys::Win32::Networking::WinSock::{self, SOCKET, SOCKET_ERROR, SOCK_STREAM};
use windows_sys::Win32::Networking::WinSock::{
self, AF_INET, AF_INET6, SOCKET, SOCKET_ERROR, SOCK_STREAM,
};

use crate::sys::windows::net::{init, new_socket, socket_addr, AF_INET, AF_INET6};
use crate::sys::windows::net::{init, new_socket, socket_addr};

pub(crate) fn new_for_addr(address: SocketAddr) -> io::Result<SOCKET> {
init();
Expand Down

0 comments on commit 229230c

Please sign in to comment.