pub struct TcpTransport { /* private fields */ }
Expand description
Represents a Transport
that leverages a TCP stream
Implementations§
Source§impl TcpTransport
impl TcpTransport
Sourcepub async fn connect(addrs: impl ToSocketAddrs) -> Result<Self>
pub async fn connect(addrs: impl ToSocketAddrs) -> Result<Self>
Creates a new stream by connecting to a remote machine at the specified IP address and port
Trait Implementations§
Source§impl Debug for TcpTransport
impl Debug for TcpTransport
Source§impl Reconnectable for TcpTransport
impl Reconnectable for TcpTransport
Source§impl Transport for TcpTransport
impl Transport for TcpTransport
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
Auto Trait Implementations§
impl !Freeze for TcpTransport
impl RefUnwindSafe for TcpTransport
impl Send for TcpTransport
impl Sync for TcpTransport
impl Unpin for TcpTransport
impl UnwindSafe for TcpTransport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> TransportExt for Twhere
T: Transport,
impl<T> TransportExt for Twhere
T: Transport,
Source§fn readable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn readable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Waits for the transport to be readable to follow up with
try_read
.Source§fn writeable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn writeable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Waits for the transport to be writeable to follow up with
try_write
.Source§fn readable_or_writeable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn readable_or_writeable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Waits for the transport to be either readable or writeable.
Source§fn read_exact<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn read_exact<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Source§fn read_to_end<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn read_to_end<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Reads all bytes until EOF in this source, placing them into
buf
. Read moreSource§fn read_to_string<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut String,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn read_to_string<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut String,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Reads all bytes until EOF in this source, placing them into
buf
. Read moreSource§fn write_all<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn write_all<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Writes all of
buf
by continuing to call try_write
until completed. Calls to
[writeable
] are made to ensure the transport is ready.