Skip to content

Commit 9aea749

Browse files
committed
std: Deprecate the std::old_io::net primitives
The `std::net` primitives should be ready for use now and as a result the old ones are now deprecated and slated for removal. Most TCP/UDP functionality is now available through `std::net` but the `std::old_io::net::pipe` module is removed entirely from the standard library. Unix socket funtionality can be found in sfackler's [`unix_socket`][unix] crate and there is currently no replacement for named pipes on Windows. [unix]: https://crates.io/crates/unix_socket [breaking-change]
1 parent b0746ff commit 9aea749

File tree

7 files changed

+30
-0
lines changed

7 files changed

+30
-0
lines changed

src/libstd/old_io/net/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
//! Networking I/O
1212
13+
#![deprecated(since = "1.0.0",
14+
reason = "replaced with new I/O primitives in `std::net`")]
15+
#![unstable(feature = "old_io")]
16+
1317
use old_io::{IoError, IoResult, InvalidInput};
1418
use ops::FnMut;
1519
use option::Option::None;

src/libstd/old_io/net/pipe.rs

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
//! instances as clients.
2020
2121
#![allow(missing_docs)]
22+
#![deprecated(since = "1.0.0",
23+
reason = "will be removed to be reintroduced at a later date; \
24+
in the meantime consider using the `unix_socket` crate \
25+
for unix sockets; there is currently no replacement \
26+
for named pipes")]
27+
#![unstable(feature = "old_io")]
2228

2329
use prelude::v1::*;
2430

src/libstd/sys/common/net.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![allow(deprecated)]
12+
1113
use prelude::v1::*;
1214
use self::SocketStatus::*;
1315
use self::InAddr::*;

src/libstd/sys/unix/ext.rs

+7
Original file line numberDiff line numberDiff line change
@@ -73,42 +73,49 @@ impl AsRawFd for old_io::pipe::PipeStream {
7373
}
7474
}
7575

76+
#[allow(deprecated)]
7677
impl AsRawFd for old_io::net::pipe::UnixStream {
7778
fn as_raw_fd(&self) -> Fd {
7879
self.as_inner().fd()
7980
}
8081
}
8182

83+
#[allow(deprecated)]
8284
impl AsRawFd for old_io::net::pipe::UnixListener {
8385
fn as_raw_fd(&self) -> Fd {
8486
self.as_inner().fd()
8587
}
8688
}
8789

90+
#[allow(deprecated)]
8891
impl AsRawFd for old_io::net::pipe::UnixAcceptor {
8992
fn as_raw_fd(&self) -> Fd {
9093
self.as_inner().fd()
9194
}
9295
}
9396

97+
#[allow(deprecated)]
9498
impl AsRawFd for old_io::net::tcp::TcpStream {
9599
fn as_raw_fd(&self) -> Fd {
96100
self.as_inner().fd()
97101
}
98102
}
99103

104+
#[allow(deprecated)]
100105
impl AsRawFd for old_io::net::tcp::TcpListener {
101106
fn as_raw_fd(&self) -> Fd {
102107
self.as_inner().fd()
103108
}
104109
}
105110

111+
#[allow(deprecated)]
106112
impl AsRawFd for old_io::net::tcp::TcpAcceptor {
107113
fn as_raw_fd(&self) -> Fd {
108114
self.as_inner().fd()
109115
}
110116
}
111117

118+
#[allow(deprecated)]
112119
impl AsRawFd for old_io::net::udp::UdpSocket {
113120
fn as_raw_fd(&self) -> Fd {
114121
self.as_inner().fd()

src/libstd/sys/unix/tcp.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![allow(deprecated)]
12+
1113
use prelude::v1::*;
1214

1315
use old_io::net::ip;

src/libstd/sys/windows/ext.rs

+7
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,21 @@ impl AsRawHandle for old_io::pipe::PipeStream {
5858
}
5959
}
6060

61+
#[allow(deprecated)]
6162
impl AsRawHandle for old_io::net::pipe::UnixStream {
6263
fn as_raw_handle(&self) -> Handle {
6364
self.as_inner().handle()
6465
}
6566
}
6667

68+
#[allow(deprecated)]
6769
impl AsRawHandle for old_io::net::pipe::UnixListener {
6870
fn as_raw_handle(&self) -> Handle {
6971
self.as_inner().handle()
7072
}
7173
}
7274

75+
#[allow(deprecated)]
7376
impl AsRawHandle for old_io::net::pipe::UnixAcceptor {
7477
fn as_raw_handle(&self) -> Handle {
7578
self.as_inner().handle()
@@ -81,24 +84,28 @@ pub trait AsRawSocket {
8184
fn as_raw_socket(&self) -> Socket;
8285
}
8386

87+
#[allow(deprecated)]
8488
impl AsRawSocket for old_io::net::tcp::TcpStream {
8589
fn as_raw_socket(&self) -> Socket {
8690
self.as_inner().fd()
8791
}
8892
}
8993

94+
#[allow(deprecated)]
9095
impl AsRawSocket for old_io::net::tcp::TcpListener {
9196
fn as_raw_socket(&self) -> Socket {
9297
self.as_inner().socket()
9398
}
9499
}
95100

101+
#[allow(deprecated)]
96102
impl AsRawSocket for old_io::net::tcp::TcpAcceptor {
97103
fn as_raw_socket(&self) -> Socket {
98104
self.as_inner().socket()
99105
}
100106
}
101107

108+
#[allow(deprecated)]
102109
impl AsRawSocket for old_io::net::udp::UdpSocket {
103110
fn as_raw_socket(&self) -> Socket {
104111
self.as_inner().fd()

src/libstd/sys/windows/tcp.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![allow(deprecated)]
12+
1113
use old_io::net::ip;
1214
use old_io::IoResult;
1315
use libc;

0 commit comments

Comments
 (0)