Struct tokio_jsonrpc::server::ServerChain
[−]
[src]
pub struct ServerChain(_);
A server that chains several other servers.
This composes multiple servers into one. When a notification or an rpc comes, it tries one by one and passes the call to each of them. If the server provides an answer, the iteration is stopped and that answer is returned. If the server refuses the given method name, another server in the chain is tried, until one is found or we run out of servers.
Initialization is called on all the servers.
The AbstractServer
is one of the ways to plug servers with
incompatible future and success types inside.
Methods
impl ServerChain
[src]
fn new(subservers: Vec<BoxServer>) -> Self
Construct a new server.
fn into_inner(self) -> Vec<BoxServer>
Consume the server and return the subservers inside.
Trait Implementations
impl Server for ServerChain
[src]
type Success = Value
The successfull result of the RPC call.
type RpcCallResult = BoxRpcCallResult
The result of the RPC call Read more
type NotificationResult = BoxNotificationResult
The result of the RPC call. Read more
fn rpc(
&self,
ctl: &ServerCtl,
method: &str,
params: &Option<Value>
) -> Option<Self::RpcCallResult>
&self,
ctl: &ServerCtl,
method: &str,
params: &Option<Value>
) -> Option<Self::RpcCallResult>
Called when the client requests something. Read more
fn notification(
&self,
ctl: &ServerCtl,
method: &str,
params: &Option<Value>
) -> Option<Self::NotificationResult>
&self,
ctl: &ServerCtl,
method: &str,
params: &Option<Value>
) -> Option<Self::NotificationResult>
Called when the client sends a notification. Read more
fn initialized(&self, ctl: &ServerCtl)
Called when the endpoint is initialized. Read more