Skip to main content

DynService

Trait DynService 

Source
pub trait DynService<R: ServiceRole>: Send + Sync {
    // Required methods
    fn handle_request(
        &self,
        request: R::PeerReq,
        context: RequestContext<R>,
    ) -> BoxFuture<'_, Result<R::Resp, McpError>>;
    fn handle_notification(
        &self,
        notification: R::PeerNot,
        context: NotificationContext<R>,
    ) -> BoxFuture<'_, Result<(), McpError>>;
    fn get_info(&self) -> R::Info;
}
Available on (crate features client or server) and non-crate feature local only.

Required Methods§

Source

fn handle_request( &self, request: R::PeerReq, context: RequestContext<R>, ) -> BoxFuture<'_, Result<R::Resp, McpError>>

Source

fn handle_notification( &self, notification: R::PeerNot, context: NotificationContext<R>, ) -> BoxFuture<'_, Result<(), McpError>>

Source

fn get_info(&self) -> R::Info

Trait Implementations§

Source§

impl<R: ServiceRole> Service<R> for Box<dyn DynService<R>>

Source§

fn handle_request( &self, request: R::PeerReq, context: RequestContext<R>, ) -> impl Future<Output = Result<R::Resp, McpError>> + MaybeSendFuture + '_

Available on non-crate feature local only.
Source§

fn handle_notification( &self, notification: R::PeerNot, context: NotificationContext<R>, ) -> impl Future<Output = Result<(), McpError>> + MaybeSendFuture + '_

Available on non-crate feature local only.
Source§

fn get_info(&self) -> R::Info

Available on non-crate feature local only.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<R: ServiceRole, S: Service<R>> DynService<R> for S