pub struct MethodRegistry { /* private fields */ }
Expand description
Registry for organizing and dispatching JSON-RPC methods
Implementations§
Source§impl MethodRegistry
impl MethodRegistry
Sourcepub fn register<F>(self, method: impl Into<String>, handler: F) -> Self
pub fn register<F>(self, method: impl Into<String>, handler: F) -> Self
Register a method with a handler function
Sourcepub fn register_with_info<F>(
self,
method: impl Into<String>,
info: MethodInfo,
handler: F,
) -> Self
pub fn register_with_info<F>( self, method: impl Into<String>, info: MethodInfo, handler: F, ) -> Self
Register a method with detailed information and handler
Sourcepub fn call(
&self,
method: &str,
params: Option<Value>,
id: Option<RequestId>,
) -> Response
pub fn call( &self, method: &str, params: Option<Value>, id: Option<RequestId>, ) -> Response
Call a registered method
Sourcepub fn has_method(&self, method: &str) -> bool
pub fn has_method(&self, method: &str) -> bool
Check if a method is registered
Sourcepub fn get_methods(&self) -> Vec<String>
pub fn get_methods(&self) -> Vec<String>
Get list of all registered methods
Sourcepub fn method_count(&self) -> usize
pub fn method_count(&self) -> usize
Get the number of registered methods
Sourcepub fn remove_method(&mut self, method: &str) -> bool
pub fn remove_method(&mut self, method: &str) -> bool
Remove a method from the registry
Sourcepub fn render_docs(&mut self) -> Value
pub fn render_docs(&mut self) -> Value
Generate a Swagger/OpenAPI JSON object describing all registered methods Results are cached until the registry is modified
Trait Implementations§
Source§impl Default for MethodRegistry
impl Default for MethodRegistry
Source§impl Handler for MethodRegistry
impl Handler for MethodRegistry
Source§fn handle_request(&self, request: Request) -> Response
fn handle_request(&self, request: Request) -> Response
Handle a JSON-RPC request and return a response
Source§fn handle_notification(&self, notification: Notification)
fn handle_notification(&self, notification: Notification)
Handle a JSON-RPC notification (no response expected)
Source§fn supports_method(&self, method: &str) -> bool
fn supports_method(&self, method: &str) -> bool
Check if a method is supported
Source§fn get_supported_methods(&self) -> Vec<String>
fn get_supported_methods(&self) -> Vec<String>
Get list of supported methods
Source§fn get_method_info(&self, method: &str) -> Option<MethodInfo>
fn get_method_info(&self, method: &str) -> Option<MethodInfo>
Get method information for documentation
Source§impl MessageProcessor for MethodRegistry
impl MessageProcessor for MethodRegistry
Source§fn process_message(&self, message: Message) -> Option<Response>
fn process_message(&self, message: Message) -> Option<Response>
Process a single JSON-RPC message
Source§fn get_capabilities(&self) -> ProcessorCapabilities
fn get_capabilities(&self) -> ProcessorCapabilities
Get processor capabilities
Source§fn process_batch(&self, messages: Vec<Message>) -> Vec<Response>
fn process_batch(&self, messages: Vec<Message>) -> Vec<Response>
Process a batch of JSON-RPC messages
Source§fn supports_batching(&self) -> bool
fn supports_batching(&self) -> bool
Check if batch processing is supported
Auto Trait Implementations§
impl Freeze for MethodRegistry
impl !RefUnwindSafe for MethodRegistry
impl Send for MethodRegistry
impl Sync for MethodRegistry
impl Unpin for MethodRegistry
impl !UnwindSafe for MethodRegistry
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