Struct tokio_jsonrpc::endpoint::ServerCtl [] [src]

pub struct ServerCtl(_);

A handle to control the server.

An instance is provided to each Server callback and it can be used to manipulate the server (currently only to terminate the server) or to create a client for the use of the server.

Methods

impl ServerCtl
[src]

[src]

Stop answering RPCs and calling notifications.

Also terminate the connection if the client handle has been dropped and all ongoing RPC answers were received.

[src]

Kill the connection.

Like, right now. Without a goodbye.

[src]

Create a new client for the current endpoint.

This is a way in which the server may access the other endpoint (eg. call RPCs or send notifications to the other side).

If the server got terminated by some means (calling kill, terminate, dropping all endpoints or by losing the connection), it returns Err(AlreadyTerminated).

Note that it's generally safe to unwrap the result, unless you clone the ServerCtl and store it somewhere. If you do clone and keep it, there's a chance for race conditions and you should check for the error conditions.

Trait Implementations

impl Clone for ServerCtl
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more