tokio_uds/incoming.rs
1use {UnixListener, UnixStream};
2
3use futures::{Poll, Stream};
4
5use std::io;
6
7/// Stream of listeners
8#[derive(Debug)]
9pub struct Incoming {
10 inner: UnixListener,
11}
12
13impl Incoming {
14 pub(crate) fn new(listener: UnixListener) -> Incoming {
15 Incoming { inner: listener }
16 }
17}
18
19impl Stream for Incoming {
20 type Item = UnixStream;
21 type Error = io::Error;
22
23 fn poll(&mut self) -> Poll<Option<Self::Item>, io::Error> {
24 Ok(Some(try_ready!(self.inner.poll_accept()).0).into())
25 }
26}