Skip to content

Commit 369555c

Browse files
Implement FusedIterator for std::net::[Into]Incoming
They never return `None`, so they trivially fulfill the contract.
1 parent 07e7b43 commit 369555c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/std/src/net/tcp.rs

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::io::prelude::*;
77

88
use crate::fmt;
99
use crate::io::{self, IoSlice, IoSliceMut};
10+
use crate::iter::FusedIterator;
1011
use crate::net::{Shutdown, SocketAddr, ToSocketAddrs};
1112
use crate::sys_common::net as net_imp;
1213
use crate::sys_common::{AsInner, FromInner, IntoInner};
@@ -1009,6 +1010,9 @@ impl<'a> Iterator for Incoming<'a> {
10091010
}
10101011
}
10111012

1013+
#[stable(feature = "tcp_listener_incoming_fused_iterator", since = "1.63.0")]
1014+
impl FusedIterator for Incoming<'_> {}
1015+
10121016
#[unstable(feature = "tcplistener_into_incoming", issue = "88339")]
10131017
impl Iterator for IntoIncoming {
10141018
type Item = io::Result<TcpStream>;
@@ -1017,6 +1021,9 @@ impl Iterator for IntoIncoming {
10171021
}
10181022
}
10191023

1024+
#[unstable(feature = "tcplistener_into_incoming", issue = "88339")]
1025+
impl FusedIterator for IntoIncoming {}
1026+
10201027
impl AsInner<net_imp::TcpListener> for TcpListener {
10211028
fn as_inner(&self) -> &net_imp::TcpListener {
10221029
&self.0

0 commit comments

Comments
 (0)