Trait Socket
Source pub trait Socket:
Send
+ Sync
+ Unpin
+ 'static {
// Required methods
fn try_read(&mut self, buf: &mut dyn ReadBuf) -> Result<usize, Error>;
fn try_write(&mut self, buf: &[u8]) -> Result<usize, Error>;
fn poll_read_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>;
fn poll_write_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>;
fn poll_shutdown(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>;
// Provided methods
fn poll_flush(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Error>> { ... }
fn read<'a, B>(&'a mut self, buf: &'a mut B) -> Read<'a, Self, B>
where B: ReadBuf,
Self: Sized { ... }
fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>
where Self: Sized { ... }
fn flush(&mut self) -> Flush<'_, Self>
where Self: Sized { ... }
fn shutdown(&mut self) -> Shutdown<'_, Self>
where Self: Sized { ... }
}