pub struct UnixStream { /* private fields */ }
Expand description
UnixStream
Implementations§
Source§impl UnixStream
impl UnixStream
Sourcepub async fn connect_addr(addr: SocketAddr) -> Result<Self>
pub async fn connect_addr(addr: SocketAddr) -> Result<Self>
Connects the socket to an address.
Sourcepub fn pair() -> Result<(Self, Self)>
pub fn pair() -> Result<(Self, Self)>
Creates an unnamed pair of connected sockets.
Returns two UnixStream
s which are connected to each other.
Sourcepub fn peer_cred(&self) -> Result<UCred>
pub fn peer_cred(&self) -> Result<UCred>
Returns effective credentials of the process which called connect
or
pair
.
Sourcepub fn from_std(stream: UnixStream) -> Result<Self>
pub fn from_std(stream: UnixStream) -> Result<Self>
Creates new UnixStream
from a std::os::unix::net::UnixStream
.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Returns the socket address of the local half of this connection.
Sourcepub fn peer_addr(&self) -> Result<SocketAddr>
pub fn peer_addr(&self) -> Result<SocketAddr>
Returns the socket address of the remote half of this connection.
Sourcepub async fn readable(&self, relaxed: bool) -> Result<()>
pub async fn readable(&self, relaxed: bool) -> Result<()>
Wait for read readiness. Note: Do not use it before every io. It is different from other runtimes!
Everytime call to this method may pay a syscall cost. In uring impl, it will push a PollAdd op; in epoll impl, it will use use inner readiness state; if !relaxed, it will call syscall poll after that.
If relaxed, on legacy driver it may return false positive result. If you want to do io by your own, you must maintain io readiness and wait for io ready with relaxed=false.
Sourcepub async fn writable(&self, relaxed: bool) -> Result<()>
pub async fn writable(&self, relaxed: bool) -> Result<()>
Wait for write readiness. Note: Do not use it before every io. It is different from other runtimes!
Everytime call to this method may pay a syscall cost. In uring impl, it will push a PollAdd op; in epoll impl, it will use use inner readiness state; if !relaxed, it will call syscall poll after that.
If relaxed, on legacy driver it may return false positive result. If you want to do io by your own, you must maintain io readiness and wait for io ready with relaxed=false.
Source§impl UnixStream
impl UnixStream
Sourcepub fn try_into_poll_io(self) -> Result<UnixStreamPoll, (Error, UnixStream)>
pub fn try_into_poll_io(self) -> Result<UnixStreamPoll, (Error, UnixStream)>
Convert to poll-io style UnixStreamPoll
Trait Implementations§
Source§impl AsRawFd for UnixStream
impl AsRawFd for UnixStream
Source§impl AsReadFd for UnixStream
impl AsReadFd for UnixStream
Source§fn as_reader_fd(&mut self) -> &SharedFdWrapper
fn as_reader_fd(&mut self) -> &SharedFdWrapper
Source§impl AsWriteFd for UnixStream
impl AsWriteFd for UnixStream
Source§fn as_writer_fd(&mut self) -> &SharedFdWrapper
fn as_writer_fd(&mut self) -> &SharedFdWrapper
Source§impl AsyncReadRent for UnixStream
impl AsyncReadRent for UnixStream
Source§impl AsyncWriteRent for UnixStream
impl AsyncWriteRent for UnixStream
Source§fn write<T: IoBuf>(
&mut self,
buf: T,
) -> impl Future<Output = BufResult<usize, T>>
fn write<T: IoBuf>( &mut self, buf: T, ) -> impl Future<Output = BufResult<usize, T>>
Source§fn writev<T: IoVecBuf>(
&mut self,
buf_vec: T,
) -> impl Future<Output = BufResult<usize, T>>
fn writev<T: IoVecBuf>( &mut self, buf_vec: T, ) -> impl Future<Output = BufResult<usize, T>>
buf_vec
, but the write may not
fully succeed, and it might also result in an error. The bytes will be written starting at
the specified offset. Read moreSource§impl CancelableAsyncReadRent for UnixStream
impl CancelableAsyncReadRent for UnixStream
Source§async fn cancelable_read<T: IoBufMut>(
&mut self,
buf: T,
c: CancelHandle,
) -> BufResult<usize, T>
async fn cancelable_read<T: IoBufMut>( &mut self, buf: T, c: CancelHandle, ) -> BufResult<usize, T>
Source§async fn cancelable_readv<T: IoVecBufMut>(
&mut self,
buf: T,
c: CancelHandle,
) -> BufResult<usize, T>
async fn cancelable_readv<T: IoVecBufMut>( &mut self, buf: T, c: CancelHandle, ) -> BufResult<usize, T>
Source§impl CancelableAsyncWriteRent for UnixStream
impl CancelableAsyncWriteRent for UnixStream
Source§async fn cancelable_write<T: IoBuf>(
&mut self,
buf: T,
c: CancelHandle,
) -> BufResult<usize, T>
async fn cancelable_write<T: IoBuf>( &mut self, buf: T, c: CancelHandle, ) -> BufResult<usize, T>
Source§async fn cancelable_writev<T: IoVecBuf>(
&mut self,
buf_vec: T,
c: CancelHandle,
) -> BufResult<usize, T>
async fn cancelable_writev<T: IoVecBuf>( &mut self, buf_vec: T, c: CancelHandle, ) -> BufResult<usize, T>
Source§async fn cancelable_flush(&mut self, _c: CancelHandle) -> Result<()>
async fn cancelable_flush(&mut self, _c: CancelHandle) -> Result<()>
Source§async fn cancelable_shutdown(&mut self, _c: CancelHandle) -> Result<()>
async fn cancelable_shutdown(&mut self, _c: CancelHandle) -> Result<()>
Source§impl Debug for UnixStream
impl Debug for UnixStream
Source§impl IntoPollIo for UnixStream
impl IntoPollIo for UnixStream
Source§type PollIo = UnixStreamPoll
type PollIo = UnixStreamPoll
Source§fn try_into_poll_io(self) -> Result<Self::PollIo, (Error, Self)>
fn try_into_poll_io(self) -> Result<Self::PollIo, (Error, Self)>
Source§fn into_poll_io(self) -> Result<Self::PollIo>
fn into_poll_io(self) -> Result<Self::PollIo>
Source§impl IntoRawFd for UnixStream
impl IntoRawFd for UnixStream
Source§fn into_raw_fd(self) -> RawFd
fn into_raw_fd(self) -> RawFd
impl Split for UnixStream
UnixStream is safe to split to two parts