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