pub struct StatefulMethodRegistry<C: ServiceContext> { /* private fields */ }
Expand description
Registry for organizing stateful JSON-RPC methods
Implementations§
Source§impl<C: ServiceContext> StatefulMethodRegistry<C>
impl<C: ServiceContext> StatefulMethodRegistry<C>
Sourcepub fn register<H>(self, method: impl Into<String>, handler: H) -> Selfwhere
H: StatefulMethodHandler<C> + 'static,
pub fn register<H>(self, method: impl Into<String>, handler: H) -> Selfwhere
H: StatefulMethodHandler<C> + 'static,
Register a method handler
Sourcepub fn register_fn<F>(self, method: impl Into<String>, handler: F) -> Self
pub fn register_fn<F>(self, method: impl Into<String>, handler: F) -> Self
Register a method using a closure
Trait Implementations§
Source§impl<C: ServiceContext> Default for StatefulMethodRegistry<C>
impl<C: ServiceContext> Default for StatefulMethodRegistry<C>
Source§impl<C: ServiceContext> StatefulHandler<C> for StatefulMethodRegistry<C>
impl<C: ServiceContext> StatefulHandler<C> for StatefulMethodRegistry<C>
Source§fn handle_request(
&self,
context: &C,
request: Request,
) -> Result<Response, C::Error>
fn handle_request( &self, context: &C, request: Request, ) -> Result<Response, C::Error>
Handle a JSON-RPC request with access to shared context
Source§fn handle_notification(
&self,
context: &C,
notification: Notification,
) -> Result<(), C::Error>
fn handle_notification( &self, context: &C, notification: Notification, ) -> Result<(), C::Error>
Handle a JSON-RPC notification with access to shared context
Auto Trait Implementations§
impl<C> Freeze for StatefulMethodRegistry<C>
impl<C> !RefUnwindSafe for StatefulMethodRegistry<C>
impl<C> Send for StatefulMethodRegistry<C>
impl<C> Sync for StatefulMethodRegistry<C>
impl<C> Unpin for StatefulMethodRegistry<C>
impl<C> !UnwindSafe for StatefulMethodRegistry<C>
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