pub struct AbstractServer<S: Server>(/* private fields */);Expand description
An RPC server wrapper with dynamic dispatch.
This server wraps another server and converts it into a common ground, so multiple different
servers can be used as trait objects. Basically, it boxes the futures it returns and converts
the result into serde_json::Value. It can then be used together with
ServerChain easilly. Note that this conversion incurs
runtime costs.
Implementations§
Source§impl<S: Server> AbstractServer<S>
impl<S: Server> AbstractServer<S>
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Unwraps the abstract server and provides the one inside back.
Trait Implementations§
Source§impl<S: Server> Server for AbstractServer<S>
impl<S: Server> Server for AbstractServer<S>
Source§type RpcCallResult = Box<dyn Future<Item = Value, Error = RpcError>>
type RpcCallResult = Box<dyn Future<Item = Value, Error = RpcError>>
The result of the RPC call Read more
Source§type NotificationResult = Box<dyn Future<Item = (), Error = ()>>
type NotificationResult = Box<dyn Future<Item = (), Error = ()>>
The result of the RPC call. Read more
Source§fn rpc(
&self,
ctl: &ServerCtl,
method: &str,
params: &Option<Value>,
) -> Option<Self::RpcCallResult>
fn rpc( &self, ctl: &ServerCtl, method: &str, params: &Option<Value>, ) -> Option<Self::RpcCallResult>
Called when the client requests something. Read more
Source§fn notification(
&self,
ctl: &ServerCtl,
method: &str,
params: &Option<Value>,
) -> Option<Self::NotificationResult>
fn notification( &self, ctl: &ServerCtl, method: &str, params: &Option<Value>, ) -> Option<Self::NotificationResult>
Called when the client sends a notification. Read more
Source§fn initialized(&self, ctl: &ServerCtl)
fn initialized(&self, ctl: &ServerCtl)
Called when the endpoint is initialized. Read more
Auto Trait Implementations§
impl<S> Freeze for AbstractServer<S>where
S: Freeze,
impl<S> RefUnwindSafe for AbstractServer<S>where
S: RefUnwindSafe,
impl<S> Send for AbstractServer<S>where
S: Send,
impl<S> Sync for AbstractServer<S>where
S: Sync,
impl<S> Unpin for AbstractServer<S>where
S: Unpin,
impl<S> UnwindSafe for AbstractServer<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more