pub type Result<T = ()> = core::result::Result<T, Error>;
pub trait Read {
fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
fn can_read(&self) -> bool;
}
pub trait Write {
fn write(&mut self, buf: &[u8]) -> Result<usize>;
fn can_write(&self) -> bool;
}
#[derive(Debug, Copy, Clone)]
pub struct Error {
pub kind: ErrorKind,
pub message: &'static str,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum ErrorKind {
Other,
NotFound,
PermissionDenied,
ConnectionRefused,
ConnectionReset,
ConnectionAborted,
NotConnected,
AddrInUse,
AddrNotAvailable,
BrokenPipe,
AlreadyExists,
InvalidInput,
InvalidData,
TimedOut,
Interrupted,
Unsupported,
OutOfMemory,
WriteZero,
}