[−][src]Trait essrpc::RPCServer
Trait implemented by all RPC servers generated by the essrpc
macro. For a trait named Foo
, the macro will generate
FooRPCServer
which implements RPCServer
. An RPCServer
generated for a trait 'Foo' will have a new
method
ⓘThis example is not tested
fn new(imp: impl Foo, transport: impl essrpc::ServerTransport)
Unfortunately, new
is not specified as part of the RPC trait
as traits cannot be type parameters.
Required methods
fn serve_single_call(&mut self) -> Result<(), RPCError>
Serve a single RPC call.
Provided methods
fn serve_until(
&mut self,
cond: impl FnMut() -> bool
) -> Result<(), RPCError>
&mut self,
cond: impl FnMut() -> bool
) -> Result<(), RPCError>
Serve RPC calls until cond() returns false
. The condition is
checked after serving a single call. It does not provide a
mechanism to interrupt a server which is waiting for more data
or for a connection to be established. If you need that
capability, you must build it into a
Transport
fn serve(&mut self) -> Result<(), RPCError>
Serve RPC calls indefinitely. The result will always be an error, as it attempts to serve forever.