pub struct Resource {
pub uri: String,
pub name: String,
pub description: Option<String>,
pub title: Option<String>,
pub icons: Option<Vec<Icon>>,
pub mime_type: Option<String>,
pub annotations: Option<ResourceAnnotations>,
pub size: Option<u64>,
pub meta: Option<HashMap<String, Value>>,
}Expand description
Resource definition.
Describes a readable resource with its URI template and metadata.
Fields§
§uri: StringResource URI or URI template
name: StringResource name (machine-readable identifier)
description: Option<String>Resource description
title: Option<String>Human-readable title
icons: Option<Vec<Icon>>Resource icons
mime_type: Option<String>MIME type of the resource content
annotations: Option<ResourceAnnotations>Resource annotations
size: Option<u64>Size in bytes (if known)
meta: Option<HashMap<String, Value>>Extension metadata (tags, version, etc.)
Implementations§
Source§impl Resource
impl Resource
Sourcepub fn new(uri: impl Into<String>, name: impl Into<String>) -> Resource
pub fn new(uri: impl Into<String>, name: impl Into<String>) -> Resource
Create a new resource with URI and name.
Sourcepub fn with_description(self, description: impl Into<String>) -> Resource
pub fn with_description(self, description: impl Into<String>) -> Resource
Set the description.
Sourcepub fn with_mime_type(self, mime_type: impl Into<String>) -> Resource
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Resource
Set the MIME type.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Resource
impl<'de> Deserialize<'de> for Resource
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Resource, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Resource, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Resource
impl Serialize for Resource
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Resource
Auto Trait Implementations§
impl Freeze for Resource
impl RefUnwindSafe for Resource
impl Send for Resource
impl Sync for Resource
impl Unpin for Resource
impl UnsafeUnpin for Resource
impl UnwindSafe for Resource
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