diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-07-05 10:42:52 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-05 10:42:52 +0530 |
| commit | d26ccf7067ef5e18154db6e16f6285e2f62371dc (patch) | |
| tree | 73464a1fb998ee87ace188b8e21c3eb6c56214cf | |
| parent | 4008dd8c6d92a0b81528fd138c6130d784e5958e (diff) | |
| parent | 76c0429d86041665dcf05682cd6579d8d2ab153c (diff) | |
| download | rust-d26ccf7067ef5e18154db6e16f6285e2f62371dc.tar.gz rust-d26ccf7067ef5e18154db6e16f6285e2f62371dc.zip | |
Rollup merge of #97300 - ChayimFriedman2:patch-1, r=dtolnay
Implement `FusedIterator` for `std::net::[Into]Incoming` They never return `None`, so they trivially fulfill the contract. What should I put for the stability attribute of `Incoming`?
| -rw-r--r-- | library/std/src/net/tcp.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/std/src/net/tcp.rs b/library/std/src/net/tcp.rs index 06300035633..69b72a81c5b 100644 --- a/library/std/src/net/tcp.rs +++ b/library/std/src/net/tcp.rs @@ -7,6 +7,7 @@ use crate::io::prelude::*; use crate::fmt; use crate::io::{self, IoSlice, IoSliceMut}; +use crate::iter::FusedIterator; use crate::net::{Shutdown, SocketAddr, ToSocketAddrs}; use crate::sys_common::net as net_imp; use crate::sys_common::{AsInner, FromInner, IntoInner}; @@ -1009,6 +1010,9 @@ impl<'a> Iterator for Incoming<'a> { } } +#[stable(feature = "tcp_listener_incoming_fused_iterator", since = "1.64.0")] +impl FusedIterator for Incoming<'_> {} + #[unstable(feature = "tcplistener_into_incoming", issue = "88339")] impl Iterator for IntoIncoming { type Item = io::Result<TcpStream>; @@ -1017,6 +1021,9 @@ impl Iterator for IntoIncoming { } } +#[unstable(feature = "tcplistener_into_incoming", issue = "88339")] +impl FusedIterator for IntoIncoming {} + impl AsInner<net_imp::TcpListener> for TcpListener { fn as_inner(&self) -> &net_imp::TcpListener { &self.0 |
