async_os_pipe/sys/
unix.rs

1use std::io::Result;
2use std::os::fd::{AsFd, AsRawFd, BorrowedFd, RawFd};
3
4pub use tokio::net::UnixStream;
5
6use crate::{EitherStream, Stream};
7
8pub(super) type LeftStream = UnixStream;
9pub(super) type RightStream = UnixStream;
10
11pub async fn pipe() -> Result<(LeftStream, RightStream)> {
12    UnixStream::pair()
13}
14
15impl AsFd for Stream {
16    fn as_fd(&self) -> BorrowedFd<'_> {
17        multiplex!(self.as_fd())
18    }
19}
20
21impl AsRawFd for Stream {
22    fn as_raw_fd(&self) -> RawFd {
23        multiplex!(self.as_raw_fd())
24    }
25}