use embedded_io_async::ErrorType;
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum Close {
Read,
Write,
Both,
}
pub trait TcpShutdown: ErrorType {
async fn close(&mut self, what: Close) -> Result<(), Self::Error>;
async fn abort(&mut self) -> Result<(), Self::Error>;
}
impl<T> TcpShutdown for &mut T
where
T: TcpShutdown,
{
async fn close(&mut self, what: Close) -> Result<(), Self::Error> {
(**self).close(what).await
}
async fn abort(&mut self) -> Result<(), Self::Error> {
(**self).abort().await
}
}