Server

Trait Server 

Source
pub trait Server<H>
where H: Handler,
{ type Error; // Required methods fn start(&mut self) -> Result<(), Self::Error>; fn stop(&mut self) -> Result<(), Self::Error>; fn add_method<F>(&mut self, name: &str, method: F) where F: RpcMethodSimple; fn add_subscription<F, G>( &mut self, notification: &str, subscribe: (&str, F), unsubscribe: (&str, G), ) where F: SubscribeRpcMethod<H::Metadata>, G: UnsubscribeRpcMethod<H::Metadata>; fn describe_api(&self) -> Vec<String>; }
Expand description

Trait defining a JSON-RPC server.

Required Associated Types§

Source

type Error

The type to use as the error type within the Results used by an implementation of this trait.

Required Methods§

Source

fn start(&mut self) -> Result<(), Self::Error>

Start the server.

This is expexted to be highly side effected, i.e. this is where sockets and listeners are started.

Source

fn stop(&mut self) -> Result<(), Self::Error>

Stop the server.

Source

fn add_method<F>(&mut self, name: &str, method: F)
where F: RpcMethodSimple,

Add a JSON-RPC method to the server.

Source

fn add_subscription<F, G>( &mut self, notification: &str, subscribe: (&str, F), unsubscribe: (&str, G), )

Add a JSON-RPC subscription so the server.

Source

fn describe_api(&self) -> Vec<String>

Get a list of all the supported JSON-RPC methods.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§