[][src]Module romio::uds

Async UDS (Unix Domain Sockets) bindings.

Example

use romio::uds::{UnixListener, UnixStream};
use futures::prelude::*;

async fn say_hello(mut stream: UnixStream) {
    stream.write_all(b"Shall I hear more, or shall I speak at this?!").await;
}

async fn listen() -> Result<(), Box<dyn std::error::Error + 'static>> {
    let listener = UnixListener::bind("/tmp/sock")?;
    let mut incoming = listener.incoming();

    // accept connections and process them serially
    while let Some(stream) = incoming.next().await {
        say_hello(stream?).await;
    }
    Ok(())
}

Structs

ConnectFuture

Future returned by UnixStream::connect which will resolve to a UnixStream when the stream is connected.

Incoming

Stream of listeners

UCred

Credentials of a process

UnixDatagram

An I/O object representing a Unix datagram socket.

UnixListener

A Unix socket which can accept connections from other Unix sockets.

UnixStream

A structure representing a connected Unix socket.