cap_std/os/unix/net/
incoming.rs1use crate::os::unix::net::UnixStream;
2use std::os::unix;
3use std::{fmt, io};
4
5pub struct Incoming<'a> {
12 std: unix::net::Incoming<'a>,
13}
14
15impl<'a> Incoming<'a> {
16 #[inline]
22 pub fn from_std(std: unix::net::Incoming<'a>) -> Self {
23 Self { std }
24 }
25}
26
27impl<'a> Iterator for Incoming<'a> {
28 type Item = io::Result<UnixStream>;
29
30 #[inline]
31 fn next(&mut self) -> Option<Self::Item> {
32 self.std.next().map(|result| {
33 let unix_stream = result?;
34 Ok(UnixStream::from_std(unix_stream))
35 })
36 }
37
38 #[inline]
39 fn size_hint(&self) -> (usize, Option<usize>) {
40 self.std.size_hint()
41 }
42}
43
44impl<'a> fmt::Debug for Incoming<'a> {
45 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
46 self.std.fmt(f)
47 }
48}