pub trait RustResource: Send + Sync {
type Params: DeserializeOwned + Send;
const URI_TEMPLATE: &'static str;
const NAME: &'static str;
const DESCRIPTION: &'static str;
const MIME_TYPE: Option<&'static str>;
// Required method
fn read(
&self,
uri: &str,
params: Self::Params,
) -> impl Future<Output = Result<ResourceOutput, ToolError>> + Send;
// Provided method
fn description(&self) -> Cow<'static, str> { ... }
}Expand description
A custom resource or resource template implemented in Rust.
Required Associated Constants§
Sourceconst URI_TEMPLATE: &'static str
const URI_TEMPLATE: &'static str
URI template pattern (e.g. "file:///logs/{date}/{app}.log" or "config://app").
Sourceconst DESCRIPTION: &'static str
const DESCRIPTION: &'static str
Human-readable description.
Required Associated Types§
Sourcetype Params: DeserializeOwned + Send
type Params: DeserializeOwned + Send
Strongly-typed parameters extracted from URI variables.
Required Methods§
Provided Methods§
Sourcefn description(&self) -> Cow<'static, str>
fn description(&self) -> Cow<'static, str>
Return the resource description.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".