use std::io;
use std::net::{TcpStream, Shutdown};
#[cfg(unix)]
use std::os::unix::net::UnixStream;
pub trait Stream: Sized + Send + Sync + io::Read + io::Write {
fn try_clone(&self) -> io::Result<Self>;
fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()>;
fn shutdown(&self, how: Shutdown) -> io::Result<()>;
}
impl Stream for TcpStream {
fn try_clone(&self) -> io::Result<Self> {
self.try_clone()
}
fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
self.set_nonblocking(nonblocking)
}
fn shutdown(&self, how: Shutdown) -> io::Result<()> {
self.shutdown(how)
}
}
#[cfg(unix)]
impl Stream for UnixStream {
fn try_clone(&self) -> io::Result<Self> {
self.try_clone()
}
fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
self.set_nonblocking(nonblocking)
}
fn shutdown(&self, how: Shutdown) -> io::Result<()> {
self.shutdown(how)
}
}