pub struct Server<I, O, S = Nothing> { /* private fields */ }
Expand description

Server for processing requests and responses on standard I/O or TCP.

Implementations

Creates a new Server with the given stdin and stdout handles.

Examples

Initialize with a standard I/O transport:

let stdin = tokio::io::stdin();
let stdout = tokio::io::stdout();
let server = Server::new(stdin, stdout);

Initialize with a TCP transport:

let mut listener = tokio::net::TcpListener::bind("127.0.0.1:9257").await?;
let (stream, _) = listener.accept().await?;
let (read, write) = tokio::io::split(stream);
let server = Server::new(read, write);

Interleaves the given stream of messages into stdout together with the responses.

Spawns the service with messages read through stdin and responses written to stdout.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.