pub trait ResourceHandler: Send + Sync {
// Required methods
fn uri_template(&self) -> &str;
fn list(&self, cursor: Option<&str>) -> Result<ResourceList, ResourceError>;
fn read(&self, uri: &str) -> Result<ResourceContent, ResourceError>;
// Provided methods
fn supports_subscribe(&self) -> bool { ... }
fn matches(&self, uri: &str) -> bool { ... }
}Expand description
Resource handler trait
Required Methods§
Sourcefn uri_template(&self) -> &str
fn uri_template(&self) -> &str
Get the URI template for this handler
Sourcefn list(&self, cursor: Option<&str>) -> Result<ResourceList, ResourceError>
fn list(&self, cursor: Option<&str>) -> Result<ResourceList, ResourceError>
List available resources
Sourcefn read(&self, uri: &str) -> Result<ResourceContent, ResourceError>
fn read(&self, uri: &str) -> Result<ResourceContent, ResourceError>
Read a specific resource
Provided Methods§
Sourcefn supports_subscribe(&self) -> bool
fn supports_subscribe(&self) -> bool
Check if this handler supports subscriptions
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".