Function ump_ng::channel

source ·
pub fn channel<P, S, R, E>() -> (Server<P, S, R, E>, Client<P, S, R, E>)
Expand description

Create a pair of linked Server and Client objects.

The Server object is used to wait for incoming messages from connected clients. Once a message arrives it must reply to it using a ReplyContext that’s returned to it in the same call that returned the message.

The Client object can be used to send messages to the Server. The Client::req() call will not return until the server has replied.

Clients can be cloned; each clone will create a new client object that is connected to the same server object, but is completely independent of the original client.

The S type parameter is the “send” data type that clients will transfer to the server. The R type parameter is the “receive” data type that clients will receive from the server. The E type parameter can be used to return application specific errors from the server to the client.