[][src]Module romio::uds

Async UDS (Unix Domain Sockets) bindings.

Example

#![feature(async_await, await_macro, futures_api)]
use romio::uds::{UnixListener, UnixStream};
use futures::prelude::*;

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

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) = await!(incoming.next()) {
        await!(say_hello(stream?));
    }
    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.