UnixStream

Trait UnixStream 

Source
pub trait UnixStream: Sized {
    type SocketAddr: UnixSocketAddr;

    // Required methods
    fn connect<'async_trait, P>(
        path: P,
    ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
       where P: 'async_trait + AsRef<Path> + Send,
             Self: 'async_trait;
    fn pair() -> Result<(Self, Self)>;
    fn peer_addr(&self) -> Result<Self::SocketAddr>;
    fn local_addr(&self) -> Result<Self::SocketAddr>;
}
Available on Unix only.
Expand description

An async abstraction over std::os::unix::net::UnixStream.

Required Associated Types§

Required Methods§

Source

fn connect<'async_trait, P>( path: P, ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where P: 'async_trait + AsRef<Path> + Send, Self: 'async_trait,

Connects to the socket to the specified address.

Source

fn pair() -> Result<(Self, Self)>

Creates an unnamed pair of connected sockets.

Returns two streams which are connected to each other.

Source

fn peer_addr(&self) -> Result<Self::SocketAddr>

Returns the socket address of the local half of this connection.

Source

fn local_addr(&self) -> Result<Self::SocketAddr>

Returns the socket address of the remote half of this connection.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl UnixStream for UnixStream

Available on crate feature async-std-rt only.
Source§

type SocketAddr = SocketAddr

Source§

fn connect<'async_trait, P>( path: P, ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where P: 'async_trait + AsRef<Path> + Send, Self: 'async_trait,

Source§

fn pair() -> Result<(Self, Self)>

Source§

fn peer_addr(&self) -> Result<Self::SocketAddr>

Source§

fn local_addr(&self) -> Result<Self::SocketAddr>

Source§

impl UnixStream for UnixStream

Available on crate feature tokio-rt only.
Source§

type SocketAddr = SocketAddr

Source§

fn connect<'async_trait, P>( path: P, ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where P: 'async_trait + AsRef<Path> + Send, Self: 'async_trait,

Source§

fn pair() -> Result<(Self, Self)>

Source§

fn peer_addr(&self) -> Result<Self::SocketAddr>

Source§

fn local_addr(&self) -> Result<Self::SocketAddr>

Implementors§

Source§

impl UnixStream for TokioCompat<UnixStream>

Available on crate feature tokio-rt only.