Struct cap_async_std::net::TcpStream[][src]

pub struct TcpStream { /* fields omitted */ }

A TCP stream between a local and a remote socket.

This corresponds to async_std::net::TcpStream.

Note that this TcpStream has no connect method. To create a TcpStream, you must first obtain a Catalog permitting the address, and then call Catalog::connect_tcp_stream.

Implementations

impl TcpStream[src]

pub unsafe fn from_std(std: TcpStream) -> Self[src]

Constructs a new instance of Self from the given async_std::net::TcpStream.

Safety

async_std::net::TcpStream is not sandboxed and may access any address that the host process has access to.

pub fn local_addr(&self) -> Result<SocketAddr>[src]

Returns the local socket address of this listener.

This corresponds to async_std::net::TcpStream::local_addr.

pub fn shutdown(&self, how: Shutdown) -> Result<()>[src]

Shuts down the read, write, or both halves of this connection.

This corresponds to async_std::net::TcpStream::shutdown.

pub async fn peek(&self, buf: &mut [u8]) -> Result<usize>[src]

Receives data on the socket from the remote address to which it is connected, without removing that data from the queue.

This corresponds to async_std::net::TcpStream::peek.

pub fn set_nodelay(&self, nodelay: bool) -> Result<()>[src]

Sets the value of the TCP_NODELAY option on this socket.

This corresponds to async_std::net::TcpStream::set_nodelay.

pub fn nodelay(&self) -> Result<bool>[src]

Gets the value of the TCP_NODELAY option on this socket.

This corresponds to async_std::net::TcpStream::nodelay.

pub fn set_ttl(&self, ttl: u32) -> Result<()>[src]

Sets the value for the IP_TTL option on this socket.

This corresponds to async_std::net::TcpStream::set_ttl.

pub fn ttl(&self) -> Result<u32>[src]

Gets the value of the IP_TTL option for this socket.

This corresponds to async_std::net::TcpStream::ttl.

Trait Implementations

impl AsRawFd for TcpStream[src]

fn as_raw_fd(&self) -> RawFd[src]

Extracts the raw file descriptor. Read more

impl AsyncRead for TcpStream[src]

fn poll_read(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    buf: &mut [u8]
) -> Poll<Result<usize>>
[src]

Attempt to read from the AsyncRead into buf. Read more

fn poll_read_vectored(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    bufs: &mut [IoSliceMut<'_>]
) -> Poll<Result<usize>>
[src]

Attempt to read from the AsyncRead into bufs using vectored IO operations. Read more

impl AsyncRead for &TcpStream[src]

fn poll_read(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    buf: &mut [u8]
) -> Poll<Result<usize>>
[src]

Attempt to read from the AsyncRead into buf. Read more

fn poll_read_vectored(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    bufs: &mut [IoSliceMut<'_>]
) -> Poll<Result<usize>>
[src]

Attempt to read from the AsyncRead into bufs using vectored IO operations. Read more

impl AsyncWrite for TcpStream[src]

fn poll_write(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    buf: &[u8]
) -> Poll<Result<usize>>
[src]

Attempt to write bytes from buf into the object. Read more

fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>[src]

Attempt to flush the object, ensuring that any buffered data reach their destination. Read more

fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>[src]

Attempt to close the object. Read more

fn poll_write_vectored(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    bufs: &[IoSlice<'_>]
) -> Poll<Result<usize>>
[src]

Attempt to write bytes from bufs into the object using vectored IO operations. Read more

impl AsyncWrite for &TcpStream[src]

fn poll_write(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    buf: &[u8]
) -> Poll<Result<usize>>
[src]

Attempt to write bytes from buf into the object. Read more

fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>[src]

Attempt to flush the object, ensuring that any buffered data reach their destination. Read more

fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>[src]

Attempt to close the object. Read more

fn poll_write_vectored(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    bufs: &[IoSlice<'_>]
) -> Poll<Result<usize>>
[src]

Attempt to write bytes from bufs into the object using vectored IO operations. Read more

impl FromRawFd for TcpStream[src]

unsafe fn from_raw_fd(fd: RawFd) -> Self[src]

Constructs a new instance of Self from the given raw file descriptor. Read more

impl IntoRawFd for TcpStream[src]

fn into_raw_fd(self) -> RawFd[src]

Consumes this object, returning the raw underlying file descriptor. Read more

impl OwnsRaw for TcpStream[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> AsUnsafeFile for T where
    T: AsRawFd + OwnsRaw
[src]

pub fn as_unsafe_file(&self) -> UnsafeFile[src]

Return the contained unsafe file.

fn as_file_view(&self) -> View<'_, File>[src]

Utility for returning a value which dereferences to a &File or &mut File. Read more

unsafe fn as_unscoped_file_view(&self) -> View<'static, File>[src]

Like as_file_view, but returns a value which is not explicitly tied to the lifetime of self. Read more

fn eq_file<Filelike>(&self, other: &Filelike) -> bool where
    Filelike: AsUnsafeFile
[src]

Test whether self.as_unsafe_file().as_unsafe_handle() is equal to other.as_unsafe_file().as_unsafe_handle(). Read more

impl<T> AsUnsafeHandle for T where
    T: AsRawFd + OwnsRaw
[src]

pub fn as_unsafe_handle(&self) -> UnsafeHandle[src]

Return the contained unsafe handle.

fn eq_handle<Handlelike>(&self, other: &Handlelike) -> bool where
    Handlelike: AsUnsafeHandle
[src]

Test whether self.as_unsafe_handle() is equal to other.as_unsafe_handle(). Read more

impl<T> AsUnsafeSocket for T where
    T: AsRawFd + OwnsRaw
[src]

pub fn as_unsafe_socket(&self) -> UnsafeSocket[src]

Return the contained unsafe socket.

fn as_tcp_stream_view(&self) -> View<'_, TcpStream>[src]

Utility for returning a value which dereferences to a &TcpStream or &mut TcpStream. Read more

unsafe fn as_unscoped_tcp_stream_view(&self) -> View<'static, TcpStream>[src]

Like as_tcp_stream_view, but returns a value which is not explicitly tied to the lifetime of self. Read more

fn as_tcp_listener_view(&self) -> View<'_, TcpListener>[src]

Utility for returning a value which dereferences to a &TcpListener or &mut TcpListener. Read more

unsafe fn as_unscoped_tcp_listener_view(&self) -> View<'static, TcpListener>[src]

Like as_tcp_listener_view, but returns a value which is not explicitly tied to the lifetime of self. Read more

fn as_udp_socket_view(&self) -> View<'_, UdpSocket>[src]

Utility for returning a value which dereferences to a &UdpSocket or &mut UdpSocket. Read more

unsafe fn as_unscoped_udp_socket_view(&self) -> View<'static, UdpSocket>[src]

Like as_udp_socket_view, but returns a value which is not explicitly tied to the lifetime of self. Read more

fn as_unix_stream_view(&self) -> View<'_, UnixStream>[src]

Utility for returning a value which dereferences to a &UnixStream or &mut UnixStream. Read more

unsafe fn as_unscoped_unix_stream_view(&self) -> View<'static, UnixStream>[src]

Like as_unix_stream_view, but returns a value which is not explicitly tied to the lifetime of self. Read more

fn eq_socket<Socketlike>(&self, other: &Socketlike) -> bool where
    Socketlike: AsUnsafeSocket
[src]

Test whether self.as_unsafe_socket().as_unsafe_handle() is equal to other.as_unsafe_socket().as_unsafe_handle(). Read more

impl<R> AsyncReadExt for R where
    R: AsyncRead + ?Sized

fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
    Self: Unpin

Reads some bytes from the byte stream. Read more

fn read_vectored(
    &'a mut self,
    bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
    Self: Unpin

Like [read()][AsyncReadExt::read()], except it reads into a slice of buffers. Read more

fn read_to_end(
    &'a mut self,
    buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
    Self: Unpin

Reads the entire contents and appends them to a Vec. Read more

fn read_to_string(
    &'a mut self,
    buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
    Self: Unpin

Reads the entire contents and appends them to a String. Read more

fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
    Self: Unpin

Reads the exact number of bytes required to fill buf. Read more

fn take(self, limit: u64) -> Take<Self>

Creates an adapter which will read at most limit bytes from it. Read more

fn bytes(self) -> Bytes<Self>

Converts this [AsyncRead] into a [Stream] of bytes. Read more

fn chain<R>(self, next: R) -> Chain<Self, R> where
    R: AsyncRead, 

Creates an adapter which will chain this stream with another. Read more

fn boxed_reader<'a>(self) -> Pin<Box<dyn AsyncRead + 'a + Send, Global>> where
    Self: Send + 'a, 

Boxes the reader and changes its type to dyn AsyncRead + Send + 'a. Read more

impl<W> AsyncWriteExt for W where
    W: AsyncWrite + ?Sized

fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
    Self: Unpin

Writes some bytes into the byte stream. Read more

fn write_vectored(
    &'a mut self,
    bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
    Self: Unpin

Like [write()][AsyncWriteExt::write()], except that it writes a slice of buffers. Read more

fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self> where
    Self: Unpin

Writes an entire buffer into the byte stream. Read more

fn flush(&mut self) -> FlushFuture<'_, Self> where
    Self: Unpin

Flushes the stream to ensure that all buffered contents reach their destination. Read more

fn close(&mut self) -> CloseFuture<'_, Self> where
    Self: Unpin

Closes the writer. Read more

fn boxed_writer<'a>(self) -> Pin<Box<dyn AsyncWrite + 'a + Send, Global>> where
    Self: Send + 'a, 

Boxes the writer and changes its type to dyn AsyncWrite + Send + 'a. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> FromUnsafeFile for T where
    T: FromRawFd + OwnsRaw
[src]

pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T[src]

Convert an unsafe file into a Self. Read more

fn from_filelike<Filelike>(filelike: Filelike) -> Self where
    Filelike: IntoUnsafeFile
[src]

Convert from a type which implements IntoUnsafeFile into a type that implements FromUnsafeFile. Read more

impl<T> FromUnsafeSocket for T where
    T: FromRawFd + OwnsRaw
[src]

pub unsafe fn from_unsafe_socket(unsafe_socket: UnsafeSocket) -> T[src]

Convert an unsafe socket into a Self. Read more

fn from_socketlike<Socketlike>(socketlike: Socketlike) -> Self where
    Socketlike: IntoUnsafeSocket
[src]

Convert from a type which implements IntoUnsafeSocket into a type that implements FromUnsafeSocket. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> IntoUnsafeFile for T where
    T: IntoRawFd + OwnsRaw
[src]

pub fn into_unsafe_file(self) -> UnsafeFile[src]

Convert self into an unsafe file.

impl<T> IntoUnsafeHandle for T where
    T: IntoRawFd + OwnsRaw
[src]

pub fn into_unsafe_handle(self) -> UnsafeHandle[src]

Convert self into an unsafe handle.

impl<T> IntoUnsafeSocket for T where
    T: IntoRawFd + OwnsRaw
[src]

pub fn into_unsafe_socket(self) -> UnsafeSocket[src]

Convert self into an unsafe socket.

impl<T> ReadExt for T where
    T: AsyncRead + ?Sized
[src]

fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
    Self: Unpin
[src]

Reads some bytes from the byte stream. Read more

fn read_vectored(
    &'a mut self,
    bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
    Self: Unpin
[src]

Like read, except that it reads into a slice of buffers. Read more

fn read_to_end(
    &'a mut self,
    buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
    Self: Unpin
[src]

Reads all bytes from the byte stream. Read more

fn read_to_string(
    &'a mut self,
    buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
    Self: Unpin
[src]

Reads all bytes from the byte stream and appends them into a string. Read more

fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
    Self: Unpin
[src]

Reads the exact number of bytes required to fill buf. Read more

fn take(self, limit: u64) -> Take<Self>[src]

Creates an adaptor which will read at most limit bytes from it. Read more

fn by_ref(&mut self) -> &mut Self[src]

Creates a “by reference” adaptor for this instance of Read. Read more

fn bytes(self) -> Bytes<Self>[src]

Transforms this Read instance to a Stream over its bytes. Read more

fn chain<R>(self, next: R) -> Chain<Self, R> where
    R: AsyncRead, 
[src]

Creates an adaptor which will chain this stream with another. Read more

impl<T> SetTimes for T where
    T: AsUnsafeFile

pub fn set_times(
    &self,
    atime: Option<SystemTimeSpec>,
    mtime: Option<SystemTimeSpec>
) -> Result<(), Error>

Set the last access and last modification timestamps of an open file handle. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> WriteExt for T where
    T: AsyncWrite + ?Sized
[src]

fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
    Self: Unpin
[src]

Writes some bytes into the byte stream. Read more

fn flush(&mut self) -> FlushFuture<'_, Self> where
    Self: Unpin
[src]

Flushes the stream to ensure that all buffered contents reach their destination. Read more

fn write_vectored(
    &'a mut self,
    bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
    Self: Unpin
[src]

Like write, except that it writes from a slice of buffers. Read more

fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self> where
    Self: Unpin
[src]

Writes an entire buffer into the byte stream. Read more

fn write_fmt(&'a mut self, fmt: Arguments<'_>) -> WriteFmtFuture<'a, Self> where
    Self: Unpin
[src]

Writes a formatted string into this writer, returning any error encountered. Read more