Skip to main content

DynResourceHandler

Trait DynResourceHandler 

Source
pub trait DynResourceHandler: Send + Sync {
    // Required methods
    fn list_resources<'a>(
        &'a self,
        ctx: &'a Context<'_>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Resource>, McpError>> + Send + 'a>>;
    fn list_resource_templates<'a>(
        &'a self,
        ctx: &'a Context<'_>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceTemplate>, McpError>> + Send + 'a>>;
    fn read_resource<'a>(
        &'a self,
        uri: &'a str,
        ctx: &'a Context<'_>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceContents>, McpError>> + Send + 'a>>;
    fn subscribe<'a>(
        &'a self,
        uri: &'a str,
        ctx: &'a Context<'_>,
    ) -> Pin<Box<dyn Future<Output = Result<bool, McpError>> + Send + 'a>>;
    fn unsubscribe<'a>(
        &'a self,
        uri: &'a str,
        ctx: &'a Context<'_>,
    ) -> Pin<Box<dyn Future<Output = Result<bool, McpError>> + Send + 'a>>;
}
Expand description

Object-safe form of ResourceHandler (only the dispatched methods).

Required Methods§

Source

fn list_resources<'a>( &'a self, ctx: &'a Context<'_>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Resource>, McpError>> + Send + 'a>>

Source

fn list_resource_templates<'a>( &'a self, ctx: &'a Context<'_>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceTemplate>, McpError>> + Send + 'a>>

Source

fn read_resource<'a>( &'a self, uri: &'a str, ctx: &'a Context<'_>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceContents>, McpError>> + Send + 'a>>

Source

fn subscribe<'a>( &'a self, uri: &'a str, ctx: &'a Context<'_>, ) -> Pin<Box<dyn Future<Output = Result<bool, McpError>> + Send + 'a>>

Source

fn unsubscribe<'a>( &'a self, uri: &'a str, ctx: &'a Context<'_>, ) -> Pin<Box<dyn Future<Output = Result<bool, McpError>> + Send + 'a>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§