2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
2015-03-22 20:13:15 +00:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-02-20 17:46:56 +00:00
|
|
|
use std::{fs, net};
|
|
|
|
|
|
|
|
fn assert_both<T: Send + Sync>() {}
|
2015-03-31 23:20:09 +00:00
|
|
|
fn assert_send<T: Send>() {}
|
2015-02-20 17:46:56 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_both::<fs::File>();
|
|
|
|
assert_both::<fs::Metadata>();
|
|
|
|
assert_both::<fs::ReadDir>();
|
|
|
|
assert_both::<fs::DirEntry>();
|
|
|
|
assert_both::<fs::OpenOptions>();
|
|
|
|
assert_both::<fs::Permissions>();
|
|
|
|
|
|
|
|
assert_both::<net::TcpStream>();
|
|
|
|
assert_both::<net::TcpListener>();
|
|
|
|
assert_both::<net::UdpSocket>();
|
|
|
|
assert_both::<net::SocketAddr>();
|
std: Stabilize the `net` module
This commit performs a stabilization pass over the std::net module,
incorporating the changes from RFC 923. Specifically, the following actions were
taken:
Stable functionality:
* `net` (the name)
* `Shutdown`
* `Shutdown::{Read, Write, Both}`
* `lookup_host`
* `LookupHost`
* `SocketAddr`
* `SocketAddr::{V4, V6}`
* `SocketAddr::port`
* `SocketAddrV4`
* `SocketAddrV4::{new, ip, port}`
* `SocketAddrV6`
* `SocketAddrV4::{new, ip, port, flowinfo, scope_id}`
* Common trait impls for socket addr structures
* `ToSocketAddrs`
* `ToSocketAddrs::Iter`
* `ToSocketAddrs::to_socket_addrs`
* `ToSocketAddrs for {SocketAddr*, (Ipv*Addr, u16), str, (str, u16)}`
* `Ipv4Addr`
* `Ipv4Addr::{new, octets, to_ipv6_compatible, to_ipv6_mapped}`
* `Ipv6Addr`
* `Ipv6Addr::{new, segments, to_ipv4}`
* `TcpStream`
* `TcpStream::connect`
* `TcpStream::{peer_addr, local_addr, shutdown, try_clone}`
* `{Read,Write} for {TcpStream, &TcpStream}`
* `TcpListener`
* `TcpListener::bind`
* `TcpListener::{local_addr, try_clone, accept, incoming}`
* `Incoming`
* `UdpSocket`
* `UdpSocket::bind`
* `UdpSocket::{recv_from, send_to, local_addr, try_clone}`
Unstable functionality:
* Extra methods on `Ipv{4,6}Addr` for various methods of inspecting the address
and determining qualities of it.
* Extra methods on `TcpStream` to configure various protocol options.
* Extra methods on `UdpSocket` to configure various protocol options.
Deprecated functionality:
* The `socket_addr` method has been renamed to `local_addr`
This commit is a breaking change due to the restructuring of the `SocketAddr`
type as well as the renaming of the `socket_addr` method. Migration should be
fairly straightforward, however, after accounting for the new level of
abstraction in `SocketAddr` (protocol distinction at the socket address level,
not the IP address).
[breaking-change]
2015-03-13 21:22:33 +00:00
|
|
|
assert_both::<net::SocketAddrV4>();
|
|
|
|
assert_both::<net::SocketAddrV6>();
|
|
|
|
assert_both::<net::Ipv4Addr>();
|
|
|
|
assert_both::<net::Ipv6Addr>();
|
2015-02-20 17:46:56 +00:00
|
|
|
}
|