@@ -1608,7 +1608,7 @@ impl TcpStream {
1608
1608
fn peer_addr (& self ) -> io :: Result <SocketAddr >;
1609
1609
fn local_addr (& self ) -> io :: Result <SocketAddr >;
1610
1610
fn shutdown (& self , how : Shutdown ) -> io :: Result <()>;
1611
- fn duplicate (& self ) -> io :: Result <TcpStream >;
1611
+ fn try_clone (& self ) -> io :: Result <TcpStream >;
1612
1612
}
1613
1613
1614
1614
impl Read for TcpStream { ... }
@@ -1619,8 +1619,8 @@ impl<'a> Write for &'a TcpStream { ... }
1619
1619
#[cfg(windows)] impl AsRawSocket for TcpStream { ... }
1620
1620
```
1621
1621
1622
- * ` clone ` has been replaced with a ` duplicate ` function. The implementation of
1623
- ` duplicate ` will map to using ` dup ` on Unix platforms and
1622
+ * ` clone ` has been replaced with a ` try_clone ` function. The implementation of
1623
+ ` try_clone ` will map to using ` dup ` on Unix platforms and
1624
1624
` WSADuplicateSocket ` on Windows platforms. The ` TcpStream ` itself will no
1625
1625
longer be reference counted itself under the hood.
1626
1626
* ` close_{read,write} ` are both removed in favor of binding the ` shutdown `
@@ -1646,7 +1646,7 @@ into the `TcpListener` structure. Specifically, this will be the resulting API:
1646
1646
impl TcpListener {
1647
1647
fn bind <A : ToSocketAddrs >(addr : & A ) -> io :: Result <TcpListener >;
1648
1648
fn local_addr (& self ) -> io :: Result <SocketAddr >;
1649
- fn duplicate (& self ) -> io :: Result <TcpListener >;
1649
+ fn try_clone (& self ) -> io :: Result <TcpListener >;
1650
1650
fn accept (& self ) -> io :: Result <(TcpStream , SocketAddr )>;
1651
1651
fn incoming (& self ) -> Incoming ;
1652
1652
}
@@ -1663,7 +1663,7 @@ Some major changes from today's API include:
1663
1663
1664
1664
* The static distinction between ` TcpAcceptor ` and ` TcpListener ` has been
1665
1665
removed (more on this in the [ socket] [ Sockets ] section).
1666
- * The ` clone ` functionality has been removed in favor of ` duplicate ` (same
1666
+ * The ` clone ` functionality has been removed in favor of ` try_clone ` (same
1667
1667
caveats as ` TcpStream ` ).
1668
1668
* The ` close_accept ` functionality is removed entirely. This is not currently
1669
1669
implemented via ` shutdown ` (not supported well across platforms) and is
@@ -1690,7 +1690,7 @@ impl UdpSocket {
1690
1690
fn recv_from (& self , buf : & mut [u8 ]) -> io :: Result <(usize , SocketAddr )>;
1691
1691
fn send_to <A : ToSocketAddrs >(& self , buf : & [u8 ], addr : & A ) -> io :: Result <usize >;
1692
1692
fn local_addr (& self ) -> io :: Result <SocketAddr >;
1693
- fn duplicate (& self ) -> io :: Result <UdpSocket >;
1693
+ fn try_clone (& self ) -> io :: Result <UdpSocket >;
1694
1694
}
1695
1695
1696
1696
#[cfg(unix)] impl AsRawFd for UdpSocket { ... }
@@ -1705,7 +1705,7 @@ Some important points of note are:
1705
1705
` #[unstable] ` for now.
1706
1706
* All timeout support is removed. This may come back in the form of ` setsockopt `
1707
1707
(as with TCP streams) or with a more general implementation of ` select ` .
1708
- * ` clone ` functionality has been replaced with ` duplicate ` .
1708
+ * ` clone ` functionality has been replaced with ` try_clone ` .
1709
1709
1710
1710
The ` UdpSocket ` type will adhere to both ` Send ` and ` Sync ` .
1711
1711
0 commit comments