pub struct MessageHandler<T: Transport + 'static> { /* private fields */ }
Implementations§
Source§impl<T: Transport + 'static> MessageHandler<T>
impl<T: Transport + 'static> MessageHandler<T>
pub fn new( transport: Arc<T>, pending_requests: Arc<Mutex<HashMap<u64, Sender<JsonRpcResponse>>>>, sampling_handler: Option<Arc<Box<dyn SamplingHandler + Send>>>, notification_handler: Option<Arc<Box<dyn NotificationHandler + Send>>>, ) -> Self
pub fn handle_message(&self, message: JsonRpcMessage) -> Result<(), McpError>
pub fn handle_request(&self, request: JsonRpcRequest) -> Result<(), McpError>
pub fn handle_sampling_request( &self, handler: &Arc<Box<dyn SamplingHandler + Send>>, request: &JsonRpcRequest, ) -> Result<(), McpError>
pub fn handle_response(&self, response: JsonRpcResponse) -> Result<(), McpError>
pub fn handle_notification( &self, notification: JsonRpcNotification, ) -> Result<(), McpError>
Auto Trait Implementations§
impl<T> Freeze for MessageHandler<T>
impl<T> !RefUnwindSafe for MessageHandler<T>
impl<T> Send for MessageHandler<T>
impl<T> Sync for MessageHandler<T>
impl<T> Unpin for MessageHandler<T>
impl<T> !UnwindSafe for MessageHandler<T>
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