Skip to content

Commit

Permalink
Clarify that types are Send/Sync
Browse files Browse the repository at this point in the history
Also remove some `&mut self` methods as only `&self` is necessary.
  • Loading branch information
alexcrichton committed Feb 3, 2015
1 parent 9ba9437 commit cb10c25
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions text/0517-io-os-reform.md
Original file line number Diff line number Diff line change
Expand Up @@ -1253,9 +1253,9 @@ following interface:

impl TcpStream {
fn connect<A: ToSocketAddrs>(addr: &A) -> io::Result<TcpStream>;
fn peer_addr(&mut self) -> io::Result<SocketAddr>;
fn socket_addr(&mut self) -> io::Result<SocketAddr>;
fn shutdown(&mut self, how: Shutdown) -> io::Result<()>;
fn peer_addr(&self) -> io::Result<SocketAddr>;
fn socket_addr(&self) -> io::Result<SocketAddr>;
fn shutdown(&self, how: Shutdown) -> io::Result<()>;
fn duplicate(&self) -> io::Result<TcpStream>;
}

Expand Down Expand Up @@ -1284,15 +1284,16 @@ impl<'a> Write for &'a TcpStream { ... }
write from a `TcpStream`

Various other options such as `nodelay` and `keepalive` will be left
`#[unstable]` for now.
`#[unstable]` for now. The `TcpStream` structure will also adhere to both `Send`
and `Sync`.

The `TcpAcceptor` struct will be removed and all functionality will be folded
into the `TcpListener` structure. Specifically, this will be the resulting API:

```rust
impl TcpListener {
fn bind<A: ToSocketAddrs>(addr: &A) -> io::Result<TcpListener>;
fn socket_addr(&mut self) -> io::Result<SocketAddr>;
fn socket_addr(&self) -> io::Result<SocketAddr>;
fn duplicate(&self) -> io::Result<TcpListener>;
fn accept(&self) -> io::Result<(TcpStream, SocketAddr)>;
fn incoming(&self) -> Incoming;
Expand Down Expand Up @@ -1323,11 +1324,13 @@ Some major changes from today's API include:
happen concurrently.
* For convenience the iterator does not yield the `SocketAddr` from `accept`.

The `TcpListener` type will also adhere to `Send` and `Sync`.

#### UDP
[UDP]: #udp

The UDP infrastructre will receive a similar face-lift as the TCP infrastructure
will:
The UDP infrastructure will receive a similar face-lift as the TCP
infrastructure will:

```rust
impl UdpSocket {
Expand All @@ -1352,6 +1355,8 @@ Some important points of note are:
(as with TCP streams) or with a more general implementation of `select`.
* `clone` functionality has been replaced with `duplicate`.

The `UdpSocket` type will adhere to both `Send` and `Sync`.

#### Sockets
[Sockets]: #sockets

Expand Down

0 comments on commit cb10c25

Please sign in to comment.