pub struct TcpStream { /* private fields */ }Expand description
Native async TCP stream with statistics tracking
Implementations§
Source§impl TcpStream
impl TcpStream
Sourcepub async fn connect(addr: &str) -> Result<TcpStream, Error>
pub async fn connect(addr: &str) -> Result<TcpStream, Error>
Connect to a remote address asynchronously
Sourcepub fn from_std(stream: TcpStream) -> Result<TcpStream, Error>
pub fn from_std(stream: TcpStream) -> Result<TcpStream, Error>
Wrap an existing TCP stream in the Moirai TCP facade.
Sourcepub fn peer_addr(&self) -> Result<SocketAddr, Error>
pub fn peer_addr(&self) -> Result<SocketAddr, Error>
Get the peer address
Sourcepub fn local_addr(&self) -> Result<SocketAddr, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
Get the local address
Trait Implementations§
Source§impl AsyncWrite for TcpStream
impl AsyncWrite for TcpStream
Source§fn poll_write(
self: Pin<&mut TcpStream>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize, Error>>
fn poll_write( self: Pin<&mut TcpStream>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize, Error>>
Attempt to write bytes from the buffer to the destination.
Auto Trait Implementations§
impl Freeze for TcpStream
impl RefUnwindSafe for TcpStream
impl Send for TcpStream
impl Sync for TcpStream
impl Unpin for TcpStream
impl UnsafeUnpin for TcpStream
impl UnwindSafe for TcpStream
Blanket Implementations§
Source§impl<R> AsyncReadExt for R
impl<R> AsyncReadExt for R
Source§impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
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