Trait distant_net::common::Transport
source · pub trait Transport: Reconnectable + Debug + Send + Sync {
// Required methods
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 Self: 'async_trait,
'life0: '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§
source§impl Reconnectable for Box<dyn Transport>
impl Reconnectable for Box<dyn Transport>
source§impl Transport for Box<dyn Transport>
impl Transport for Box<dyn Transport>
source§fn 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