Struct cap_std::net::TcpStream [−][src]
pub struct TcpStream { /* fields omitted */ }A TCP stream between a local and a remote socket.
This corresponds to 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]
impl TcpStream[src]pub unsafe fn from_std(std: TcpStream) -> Self[src]
pub unsafe fn from_std(std: TcpStream) -> Self[src]Constructs a new instance of Self from the given std::net::TcpStream.
Safety
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]
pub fn local_addr(&self) -> Result<SocketAddr>[src]Returns the local socket address of this listener.
This corresponds to std::net::TcpStream::local_addr.
pub fn shutdown(&self, how: Shutdown) -> Result<()>[src]
pub fn shutdown(&self, how: Shutdown) -> Result<()>[src]Shuts down the read, write, or both halves of this connection.
This corresponds to std::net::TcpStream::shutdown.
pub fn try_clone(&self) -> Result<Self>[src]
pub fn try_clone(&self) -> Result<Self>[src]Creates a new independently owned handle to the underlying socket.
This corresponds to std::net::TcpStream::try_clone.
pub fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>[src]
pub fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>[src]Sets the read timeout to the timeout specified.
This corresponds to std::net::TcpStream::set_read_timeout.
pub fn set_write_timeout(&self, dur: Option<Duration>) -> Result<()>[src]
pub fn set_write_timeout(&self, dur: Option<Duration>) -> Result<()>[src]Sets the write timeout to the timeout specified.
This corresponds to std::net::TcpStream::set_write_timeout.
pub fn read_timeout(&self) -> Result<Option<Duration>>[src]
pub fn read_timeout(&self) -> Result<Option<Duration>>[src]Returns the read timeout of this socket.
This corresponds to std::net::TcpStream::read_timeout.
pub fn write_timeout(&self) -> Result<Option<Duration>>[src]
pub fn write_timeout(&self) -> Result<Option<Duration>>[src]Returns the write timeout of this socket.
This corresponds to std::net::TcpStream::write_timeout.
pub fn peek(&self, buf: &mut [u8]) -> Result<usize>[src]
pub 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 std::net::TcpStream::peek.
pub fn set_nodelay(&self, nodelay: bool) -> Result<()>[src]
pub fn set_nodelay(&self, nodelay: bool) -> Result<()>[src]Sets the value of the TCP_NODELAY option on this socket.
This corresponds to std::net::TcpStream::set_nodelay.
pub fn nodelay(&self) -> Result<bool>[src]
pub fn nodelay(&self) -> Result<bool>[src]Gets the value of the TCP_NODELAY option on this socket.
This corresponds to std::net::TcpStream::nodelay.
pub fn set_ttl(&self, ttl: u32) -> Result<()>[src]
pub fn set_ttl(&self, ttl: u32) -> Result<()>[src]Sets the value for the IP_TTL option on this socket.
This corresponds to std::net::TcpStream::set_ttl.
pub fn ttl(&self) -> Result<u32>[src]
pub fn ttl(&self) -> Result<u32>[src]Gets the value of the IP_TTL option for this socket.
This corresponds to std::net::TcpStream::ttl.
pub fn take_error(&self) -> Result<Option<Error>>[src]
pub fn take_error(&self) -> Result<Option<Error>>[src]Gets the value of the SO_ERROR option on this socket.
This corresponds to std::net::TcpStream::take_error.
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>[src]
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>[src]Moves this TCP stream into or out of nonblocking mode.
This corresponds to std::net::TcpStream::set_nonblocking.
Trait Implementations
impl AsRawHandleOrSocket for TcpStream[src]
impl AsRawHandleOrSocket for TcpStream[src]fn as_raw_handle_or_socket(&self) -> RawHandleOrSocket[src]
fn as_raw_handle_or_socket(&self) -> RawHandleOrSocket[src]Like AsRawHandle::as_raw_handle and AsRawSocket::as_raw_socket
but can return either type. Read more
impl AsRawSocket for TcpStream[src]
impl AsRawSocket for TcpStream[src]fn as_raw_socket(&self) -> RawSocket[src]
fn as_raw_socket(&self) -> RawSocket[src]Extracts the underlying raw socket from this object.
impl FromRawSocket for TcpStream[src]
impl FromRawSocket for TcpStream[src]unsafe fn from_raw_socket(socket: RawSocket) -> Self[src]
unsafe fn from_raw_socket(socket: RawSocket) -> Self[src]Creates a new I/O object from the given raw socket. Read more
impl IntoRawHandleOrSocket for TcpStream[src]
impl IntoRawHandleOrSocket for TcpStream[src]fn into_raw_handle_or_socket(self) -> RawHandleOrSocket[src]
fn into_raw_handle_or_socket(self) -> RawHandleOrSocket[src]Like IntoRawHandle::into_raw_handle and
IntoRawSocket::into_raw_socket but can return either type. Read more
impl IntoRawSocket for TcpStream[src]
impl IntoRawSocket for TcpStream[src]fn into_raw_socket(self) -> RawSocket[src]
fn into_raw_socket(self) -> RawSocket[src]Consumes this object, returning the raw underlying socket. Read more
impl Read for TcpStream[src]
impl Read for TcpStream[src]fn read(&mut self, buf: &mut [u8]) -> Result<usize>[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>[src]Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]Like read, except that it reads into a slice of buffers. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>[src]Read the exact number of bytes required to fill buf. Read more
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>[src]Read all bytes until EOF in this source, placing them into buf. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>[src]Read all bytes until EOF in this source, appending them to buf. Read more
fn is_read_vectored(&self) -> bool[src]
fn is_read_vectored(&self) -> bool[src]can_vector)Determines if this Reader has an efficient read_vectored
implementation. Read more
unsafe fn initializer(&self) -> Initializer[src]
unsafe fn initializer(&self) -> Initializer[src]read_initializer)Determines if this Reader can work with buffers of uninitialized
memory. Read more
fn by_ref(&mut self) -> &mut Self1.0.0[src]
fn by_ref(&mut self) -> &mut Self1.0.0[src]Creates a “by reference” adaptor for this instance of Read. Read more
impl Read for &TcpStream[src]
impl Read for &TcpStream[src]fn read(&mut self, buf: &mut [u8]) -> Result<usize>[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>[src]Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]Like read, except that it reads into a slice of buffers. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>[src]Read the exact number of bytes required to fill buf. Read more
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>[src]Read all bytes until EOF in this source, placing them into buf. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>[src]Read all bytes until EOF in this source, appending them to buf. Read more
fn is_read_vectored(&self) -> bool[src]
fn is_read_vectored(&self) -> bool[src]can_vector)Determines if this Reader has an efficient read_vectored
implementation. Read more
unsafe fn initializer(&self) -> Initializer[src]
unsafe fn initializer(&self) -> Initializer[src]read_initializer)Determines if this Reader can work with buffers of uninitialized
memory. Read more
fn by_ref(&mut self) -> &mut Self1.0.0[src]
fn by_ref(&mut self) -> &mut Self1.0.0[src]Creates a “by reference” adaptor for this instance of Read. Read more
impl Write for TcpStream[src]
impl Write for TcpStream[src]fn write(&mut self, buf: &[u8]) -> Result<usize>[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>[src]Write a buffer into this writer, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>[src]
fn flush(&mut self) -> Result<()>[src]Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<()>[src]
fn write_all(&mut self, buf: &[u8]) -> Result<()>[src]Attempts to write an entire buffer into this writer. Read more
fn is_write_vectored(&self) -> bool[src]
fn is_write_vectored(&self) -> bool[src]can_vector)Determines if this Writer has an efficient write_vectored
implementation. Read more
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>[src]write_all_vectored)Attempts to write multiple buffers into this writer. Read more
impl Write for &TcpStream[src]
impl Write for &TcpStream[src]fn write(&mut self, buf: &[u8]) -> Result<usize>[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>[src]Write a buffer into this writer, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>[src]
fn flush(&mut self) -> Result<()>[src]Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<()>[src]
fn write_all(&mut self, buf: &[u8]) -> Result<()>[src]Attempts to write an entire buffer into this writer. Read more
fn is_write_vectored(&self) -> bool[src]
fn is_write_vectored(&self) -> bool[src]can_vector)Determines if this Writer has an efficient write_vectored
implementation. Read more
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>[src]write_all_vectored)Attempts to write multiple buffers into this writer. Read more
impl OwnsRaw for TcpStream[src]
Auto Trait Implementations
impl RefUnwindSafe for TcpStream
impl Send for TcpStream
impl Sync for TcpStream
impl Unpin for TcpStream
impl UnwindSafe for TcpStream
Blanket Implementations
impl<T> AsUnsafeHandle for T where
T: AsRawHandleOrSocket + OwnsRaw, [src]
impl<T> AsUnsafeHandle for T where
T: AsRawHandleOrSocket + OwnsRaw, [src]pub fn as_unsafe_handle(&self) -> UnsafeHandle[src]
pub fn as_unsafe_handle(&self) -> UnsafeHandle[src]Return the contained unsafe handle.
impl<T> AsUnsafeSocket for T where
T: AsRawSocket + AsUnsafeHandle + OwnsRaw, [src]
impl<T> AsUnsafeSocket for T where
T: AsRawSocket + AsUnsafeHandle + OwnsRaw, [src]pub fn as_unsafe_socket(&self) -> UnsafeSocket[src]
pub fn as_unsafe_socket(&self) -> UnsafeSocket[src]Return the contained unsafe socket.
fn as_tcp_stream_view(&self) -> View<'_, TcpStream>[src]
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]
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]
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]
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]
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]
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
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> FromUnsafeSocket for T where
T: FromRawSocket + OwnsRaw, [src]
impl<T> FromUnsafeSocket for T where
T: FromRawSocket + OwnsRaw, [src]pub unsafe fn from_unsafe_socket(unsafe_socket: UnsafeSocket) -> T[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]
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> IntoUnsafeHandle for T where
T: IntoRawHandleOrSocket + OwnsRaw, [src]
impl<T> IntoUnsafeHandle for T where
T: IntoRawHandleOrSocket + OwnsRaw, [src]pub fn into_unsafe_handle(self) -> UnsafeHandle[src]
pub fn into_unsafe_handle(self) -> UnsafeHandle[src]Convert self into an unsafe handle.
impl<T> IntoUnsafeSocket for T where
T: IntoRawSocket + IntoUnsafeHandle + OwnsRaw, [src]
impl<T> IntoUnsafeSocket for T where
T: IntoRawSocket + IntoUnsafeHandle + OwnsRaw, [src]pub fn into_unsafe_socket(self) -> UnsafeSocket[src]
pub fn into_unsafe_socket(self) -> UnsafeSocket[src]Convert self into an unsafe socket.