pub struct Server<D: Dispatcher> { /* private fields */ }
Expand description
A JSON-RPC server.
Implementations§
Source§impl<D: Dispatcher> Server<D>
impl<D: Dispatcher> Server<D>
Sourcepub fn new(config: Config, dispatcher: D) -> Self
pub fn new(config: Config, dispatcher: D) -> Self
Creates a new JSON-RPC server.
§Arguments
config
: The server configuration.dispatcher
: The dispatcher that takes a request and executes the requested method. This can be derived using thenimiq_jsonrpc_derive::service
macro.
Sourcepub async fn dispatcher(&self) -> RwLockReadGuard<'_, D>
pub async fn dispatcher(&self) -> RwLockReadGuard<'_, D>
Returns a borrow to the server’s dispatcher.
Sourcepub async fn dispatcher_mut(&self) -> RwLockWriteGuard<'_, D>
pub async fn dispatcher_mut(&self) -> RwLockWriteGuard<'_, D>
Returns a mutable borrow to the server’s dispatcher.
Auto Trait Implementations§
impl<D> Freeze for Server<D>
impl<D> !RefUnwindSafe for Server<D>
impl<D> Send for Server<D>
impl<D> Sync for Server<D>
impl<D> Unpin for Server<D>
impl<D> !UnwindSafe for Server<D>
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