xref: /third_party/rust/crates/rustix/tests/net/main.rs (revision b8a62b91)
1//! Tests for [`rustix::net`].
2
3#![cfg(feature = "net")]
4#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
5#![cfg(not(any(target_os = "redox", target_os = "wasi")))]
6#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
7#![cfg_attr(core_c_str, feature(core_c_str))]
8
9mod addr;
10mod connect_bind_send;
11mod poll;
12mod sockopt;
13#[cfg(unix)]
14mod unix;
15mod v4;
16mod v6;
17
18/// Windows requires us to call a setup function before using any of the
19/// socket APIs.
20#[cfg(windows)]
21#[ctor::ctor]
22fn windows_startup() {
23    let _ = rustix::net::wsa_startup().unwrap();
24}
25
26/// Windows requires us to call a cleanup function after using any of the
27/// socket APIs.
28#[cfg(windows)]
29#[ctor::dtor]
30fn windows_shutdown() {
31    rustix::net::wsa_cleanup().unwrap();
32}
33