[−][src]Struct romio::uds::UnixStream
A structure representing a connected Unix socket.
This socket can be connected directly with UnixStream::connect
or accepted
from a listener with UnixListener::incoming
. Additionally, a pair of
anonymous Unix sockets can be created with UnixStream::pair
.
Methods
impl UnixStream
[src]
ⓘImportant traits for ConnectFuturepub fn connect(path: impl AsRef<Path>) -> ConnectFuture
[src]
Connects to the socket named by path
.
This function will create a new Unix socket and connect to the path specified, associating the returned stream with the default event loop's handle.
Examples
use romio::uds::UnixStream; let stream = UnixStream::connect("/tmp/sock").await;
pub fn pair() -> Result<(UnixStream, UnixStream)>
[src]
Creates an unnamed pair of connected sockets.
This function will create a pair of interconnected Unix sockets for communicating back and forth between one another. Each socket will be associated with the event loop whose handle is also provided.
Examples
use romio::uds::UnixStream; let (sock1, sock2) = UnixStream::pair()?;
pub fn local_addr(&self) -> Result<SocketAddr>
[src]
Returns the socket address of the local half of this connection.
Examples
use romio::uds::UnixStream; let stream = UnixStream::connect("/tmp/sock").await?; let addr = stream.local_addr()?;
pub fn peer_addr(&self) -> Result<SocketAddr>
[src]
Returns the socket address of the remote half of this connection.
Examples
use romio::uds::UnixStream; let stream = UnixStream::connect("/tmp/sock").await?; let addr = stream.peer_addr()?;
pub fn peer_cred(&self) -> Result<UCred>
[src]
Returns effective credentials of the process which called connect
or socketpair
.
Examples
use romio::uds::UnixStream; let stream = UnixStream::connect("/tmp/sock").await?; let cred = stream.peer_cred()?;
pub fn shutdown(&self, how: Shutdown) -> Result<()>
[src]
Shuts down the read, write, or both halves of this connection.
This function will cause all pending and future I/O calls on the
specified portions to immediately return with an appropriate value
(see the documentation of Shutdown
).
use romio::uds::UnixStream; use std::net::Shutdown; let stream = UnixStream::connect("/tmp/sock").await?; stream.shutdown(Shutdown::Both)?;
Trait Implementations
impl Unpin for UnixStream
[src]
impl Debug for UnixStream
[src]
impl AsRawFd for UnixStream
[src]
impl AsyncWriteReady for UnixStream
[src]
type Ok = Ready
The type of successful values yielded by this trait.
type Err = Error
The type of failures yielded by this trait.
fn poll_write_ready(
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<Self::Ok, Self::Err>>
[src]
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<Self::Ok, Self::Err>>
Test whether this socket is ready to be written to or not.
fn poll_write_ready_unpin(
&mut self,
cx: &mut Context
) -> Poll<Result<Self::Ok, Self::Err>> where
Self: Unpin,
[src]
&mut self,
cx: &mut Context
) -> Poll<Result<Self::Ok, Self::Err>> where
Self: Unpin,
impl AsyncReadReady for UnixStream
[src]
type Ok = Ready
The type of successful values yielded by this trait.
type Err = Error
The type of failures yielded by this trait.
fn poll_read_ready(
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<Self::Ok, Self::Err>>
[src]
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<Self::Ok, Self::Err>>
Test whether this socket is ready to be read or not.
fn poll_read_ready_unpin(
&mut self,
cx: &mut Context
) -> Poll<Result<Self::Ok, Self::Err>> where
Self: Unpin,
[src]
&mut self,
cx: &mut Context
) -> Poll<Result<Self::Ok, Self::Err>> where
Self: Unpin,
impl TakeError for UnixStream
[src]
type Ok = Error
The type of successful values yielded by this trait.
type Err = Error
The type of failures yielded by this trait.
fn take_error(&self) -> Result<Option<Self::Ok>, Self::Err>
[src]
Returns the value of the SO_ERROR
option.
Examples
use romio::uds::UnixStream; use romio::raw::TakeError; let stream = UnixStream::connect("/tmp/sock").await?; if let Ok(Some(err)) = stream.take_error() { println!("Got error: {:?}", err); }
impl AsyncRead for UnixStream
[src]
fn poll_read(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize>>
unsafe fn initializer(&self) -> Initializer
[src]
fn poll_read_vectored(
self: Pin<&mut Self>,
cx: &mut Context,
bufs: &mut [IoSliceMut]
) -> Poll<Result<usize, Error>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
bufs: &mut [IoSliceMut]
) -> Poll<Result<usize, Error>>
impl AsyncWrite for UnixStream
[src]
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &[u8]
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &[u8]
) -> Poll<Result<usize>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<()>>
[src]
fn poll_close(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<()>>
[src]
fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context,
bufs: &[IoSlice]
) -> Poll<Result<usize, Error>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
bufs: &[IoSlice]
) -> Poll<Result<usize, Error>>
Auto Trait Implementations
impl Sync for UnixStream
impl Send for UnixStream
impl !UnwindSafe for UnixStream
impl !RefUnwindSafe for UnixStream
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
[src]
W: AsyncWrite + ?Sized,
fn flush(&mut self) -> Flush<Self> where
Self: Unpin,
[src]
Self: Unpin,
fn close(&mut self) -> Close<Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> Write<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self> where
Self: Unpin,
[src]
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self> where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAll<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn into_sink<Item>(self) -> IntoSink<Self, Item> where
Item: AsRef<[u8]>,
[src]
Item: AsRef<[u8]>,
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
[src]
R: AsyncRead + ?Sized,
fn copy_into<W>(self, writer: &mut W) -> CopyInto<Self, W> where
W: AsyncWrite + Unpin + ?Sized,
[src]
W: AsyncWrite + Unpin + ?Sized,
fn read(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectored<'a, Self> where
Self: Unpin,
[src]
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectored<'a, Self> where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_to_end(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_to_string(&'a mut self, buf: &'a mut String) -> ReadToString<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>) where
Self: AsyncWrite,
[src]
Self: AsyncWrite,