Struct cap_std::os::unix::net::UnixStream [−][src]
pub struct UnixStream { /* fields omitted */ }
A Unix stream socket.
This corresponds to std::os::unix::net::UnixStream
.
Note that this UnixStream
has no connect
method. To create a UnixStream
,
you must first obtain a Dir
containing the path, and then call
Dir::connect_unix_stream
.
Implementations
impl UnixStream
[src]
impl UnixStream
[src]pub unsafe fn from_std(std: UnixStream) -> Self
[src]
pub unsafe fn from_std(std: UnixStream) -> Self
[src]Constructs a new instance of Self
from the given std::os::unix::net::UnixStream
.
Safety
std::os::unix::net::UnixStream
is not sandboxed and may access any address that
the host process has access to.
pub fn pair() -> Result<(Self, Self)>
[src]
pub fn pair() -> Result<(Self, Self)>
[src]Creates an unnamed pair of connected sockets.
This corresponds to std::os::unix::net::UnixStream::pair
.
TODO: should this require a capability?
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::os::unix::net::UnixStream::try_clone
.
pub fn local_addr(&self) -> Result<SocketAddr>
[src]
pub fn local_addr(&self) -> Result<SocketAddr>
[src]Returns the socket address of the local half of this connection.
This corresponds to std::os::unix::net::UnixStream::local_addr
.
pub fn peer_addr(&self) -> Result<SocketAddr>
[src]
pub fn peer_addr(&self) -> Result<SocketAddr>
[src]Returns the socket address of the remote half of this connection.
This corresponds to std::os::unix::net::UnixStream::peer_addr
.
pub fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()>
[src]
pub fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()>
[src]Sets the read timeout for the socket.
This corresponds to std::os::unix::net::UnixStream::set_read_timeout
.
pub fn set_write_timeout(&self, timeout: Option<Duration>) -> Result<()>
[src]
pub fn set_write_timeout(&self, timeout: Option<Duration>) -> Result<()>
[src]Sets the write timeout for the socket.
This corresponds to std::os::unix::net::UnixStream::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::os::unix::net::UnixStream::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::os::unix::net::UnixStream::write_timeout
.
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
[src]
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
[src]Moves the socket into or out of nonblocking mode.
This corresponds to std::os::unix::net::UnixStream::set_nonblocking
.
pub fn take_error(&self) -> Result<Option<Error>>
[src]
pub fn take_error(&self) -> Result<Option<Error>>
[src]Returns the value of the SO_ERROR
option.
This corresponds to std::os::unix::net::UnixStream::take_error
.
Trait Implementations
impl AsRawFd for UnixStream
[src]
impl AsRawFd for UnixStream
[src]impl FromRawFd for UnixStream
[src]
impl FromRawFd for UnixStream
[src]unsafe fn from_raw_fd(fd: RawFd) -> Self
[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 UnixStream
[src]
impl IntoRawFd for UnixStream
[src]fn into_raw_fd(self) -> RawFd
[src]
fn into_raw_fd(self) -> RawFd
[src]Consumes this object, returning the raw underlying file descriptor. Read more
impl Read for UnixStream
[src]
impl Read for UnixStream
[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 Read
er 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 Read
er can work with buffers of uninitialized
memory. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]Creates a “by reference” adaptor for this instance of Read
. Read more
impl Read for &UnixStream
[src]
impl Read for &UnixStream
[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 Read
er 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 Read
er can work with buffers of uninitialized
memory. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]Creates a “by reference” adaptor for this instance of Read
. Read more
impl Write for UnixStream
[src]
impl Write for UnixStream
[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 Write
r 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 &UnixStream
[src]
impl Write for &UnixStream
[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 Write
r 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 UnixStream
[src]
Auto Trait Implementations
impl RefUnwindSafe for UnixStream
impl Send for UnixStream
impl Sync for UnixStream
impl Unpin for UnixStream
impl UnwindSafe for UnixStream
Blanket Implementations
impl<T> AsUnsafeFile for T where
T: AsRawFd + OwnsRaw,
[src]
impl<T> AsUnsafeFile for T where
T: AsRawFd + OwnsRaw,
[src]pub fn as_unsafe_file(&self) -> UnsafeFile
[src]
pub fn as_unsafe_file(&self) -> UnsafeFile
[src]Return the contained unsafe file.
fn as_file_view(&self) -> View<'_, File>
[src]
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]
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
impl<T> AsUnsafeHandle for T where
T: AsRawFd + OwnsRaw,
[src]
impl<T> AsUnsafeHandle for T where
T: AsRawFd + 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: AsRawFd + OwnsRaw,
[src]
impl<T> AsUnsafeSocket for T where
T: AsRawFd + 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
fn as_unix_stream_view(&self) -> View<'_, UnixStream>
[src]
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]
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
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> FromUnsafeFile for T where
T: FromRawFd + OwnsRaw,
[src]
impl<T> FromUnsafeFile for T where
T: FromRawFd + OwnsRaw,
[src]pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T
[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]
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]
impl<T> FromUnsafeSocket for T where
T: FromRawFd + 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> IntoUnsafeFile for T where
T: IntoRawFd + OwnsRaw,
[src]
impl<T> IntoUnsafeFile for T where
T: IntoRawFd + OwnsRaw,
[src]pub fn into_unsafe_file(self) -> UnsafeFile
[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]
impl<T> IntoUnsafeHandle for T where
T: IntoRawFd + 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: IntoRawFd + OwnsRaw,
[src]
impl<T> IntoUnsafeSocket for T where
T: IntoRawFd + OwnsRaw,
[src]pub fn into_unsafe_socket(self) -> UnsafeSocket
[src]
pub fn into_unsafe_socket(self) -> UnsafeSocket
[src]Convert self
into an unsafe socket.
impl<T> SetTimes for T where
T: AsUnsafeFile,
impl<T> SetTimes for T where
T: AsUnsafeFile,