Trait distant_net::common::Transport
source · pub trait Transport: Reconnectable + Send + Sync {
fn try_read(&self, buf: &mut [u8]) -> Result<usize>;
fn try_write(&self, buf: &[u8]) -> Result<usize>;
fn ready<'life0, 'async_trait>(
&'life0 self,
interest: Interest
) -> Pin<Box<dyn Future<Output = Result<Ready>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
}Expand description
Interface representing a transport of raw bytes into and out of the system.
Required Methods
sourcefn try_read(&self, buf: &mut [u8]) -> Result<usize>
fn try_read(&self, buf: &mut [u8]) -> Result<usize>
Tries to read data from the transport into the provided buffer, returning how many bytes were read.
This call may return an error with ErrorKind::WouldBlock in the case that the transport
is not ready to read data.
Trait Implementations
sourceimpl Reconnectable for Box<dyn Transport>
impl Reconnectable for Box<dyn Transport>
sourceimpl Transport for Box<dyn Transport>
impl Transport for Box<dyn Transport>
sourcefn try_read(&self, buf: &mut [u8]) -> Result<usize>
fn try_read(&self, buf: &mut [u8]) -> Result<usize>
Tries to read data from the transport into the provided buffer, returning how many bytes
were read. Read more