pub struct TcpStream { /* private fields */ }Expand description
Implementations§
Source§impl TcpStream
impl TcpStream
Sourcepub fn connect<A: ToSocketAddrs>(addr: A) -> Result<Self>
pub fn connect<A: ToSocketAddrs>(addr: A) -> Result<Self>
Connect to addr.
Parks the goroutine until the connection completes if it does not
complete immediately (which is typical for non-blocking connect).
Equivalent to net.Dial("tcp", addr) in Go.
Sourcepub fn read(&mut self, buf: &mut [u8]) -> Result<usize>
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Read bytes from the stream into buf.
Parks the goroutine if no data is immediately available.
Trait Implementations§
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<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