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§
Sourcefn list_resources<'a>(
&'a self,
ctx: &'a Context<'_>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Resource>, McpError>> + Send + 'a>>
fn list_resources<'a>( &'a self, ctx: &'a Context<'_>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Resource>, McpError>> + Send + 'a>>
Sourcefn list_resource_templates<'a>(
&'a self,
ctx: &'a Context<'_>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceTemplate>, McpError>> + Send + 'a>>
fn list_resource_templates<'a>( &'a self, ctx: &'a Context<'_>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceTemplate>, McpError>> + Send + 'a>>
Sourcefn read_resource<'a>(
&'a self,
uri: &'a str,
ctx: &'a Context<'_>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ResourceContents>, 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>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".