pub struct ResourceTemplate {
pub name: String,
pub uri_template: String,
pub title: Option<String>,
pub description: Option<String>,
pub mime_type: Option<String>,
pub annotations: Option<Annotations>,
pub _meta: Option<Value>,
}
Expand description
A template description for resources available on the server Supports RFC 6570 URI template expansion
Fields§
§name: String
Programmatic identifier
uri_template: String
URI template (RFC 6570)
title: Option<String>
Human-readable title
description: Option<String>
Description of what this template is for
mime_type: Option<String>
MIME type for all resources matching this template (if uniform)
annotations: Option<Annotations>
Optional annotations
_meta: Option<Value>
Optional metadata
Implementations§
Source§impl ResourceTemplate
impl ResourceTemplate
Sourcepub fn new<N: Into<String>, U: Into<String>>(name: N, uri_template: U) -> Self
pub fn new<N: Into<String>, U: Into<String>>(name: N, uri_template: U) -> Self
Create a new resource template
Sourcepub fn with_title<T: Into<String>>(self, title: T) -> Self
pub fn with_title<T: Into<String>>(self, title: T) -> Self
Set the title
Sourcepub fn with_description<D: Into<String>>(self, description: D) -> Self
pub fn with_description<D: Into<String>>(self, description: D) -> Self
Set the description
Sourcepub fn with_mime_type<M: Into<String>>(self, mime_type: M) -> Self
pub fn with_mime_type<M: Into<String>>(self, mime_type: M) -> Self
Set the MIME type
Sourcepub fn with_annotations(self, annotations: Annotations) -> Self
pub fn with_annotations(self, annotations: Annotations) -> Self
Set annotations
Sourcepub fn file_system<N: Into<String>>(name: N, base_path: &str) -> Self
pub fn file_system<N: Into<String>>(name: N, base_path: &str) -> Self
Create a file system template
Sourcepub fn api_endpoint<N: Into<String>>(name: N, base_url: &str) -> Self
pub fn api_endpoint<N: Into<String>>(name: N, base_url: &str) -> Self
Create an API endpoint template
Sourcepub fn database_query<N: Into<String>>(name: N) -> Self
pub fn database_query<N: Into<String>>(name: N) -> Self
Create a database query template
Trait Implementations§
Source§impl Clone for ResourceTemplate
impl Clone for ResourceTemplate
Source§fn clone(&self) -> ResourceTemplate
fn clone(&self) -> ResourceTemplate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ResourceTemplate
impl Debug for ResourceTemplate
Source§impl<'de> Deserialize<'de> for ResourceTemplate
impl<'de> Deserialize<'de> for ResourceTemplate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ResourceTemplate
impl PartialEq for ResourceTemplate
Source§impl Serialize for ResourceTemplate
impl Serialize for ResourceTemplate
impl StructuralPartialEq for ResourceTemplate
Auto Trait Implementations§
impl Freeze for ResourceTemplate
impl RefUnwindSafe for ResourceTemplate
impl Send for ResourceTemplate
impl Sync for ResourceTemplate
impl Unpin for ResourceTemplate
impl UnwindSafe for ResourceTemplate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more