pub struct Resource {
pub uri: String,
pub name: String,
pub title: Option<String>,
pub description: Option<String>,
pub mime_type: Option<String>,
pub size: Option<u64>,
pub annotations: Option<Annotations>,
pub meta: Option<HashMap<String, Value>>,
}
Expand description
A resource descriptor (matches TypeScript Resource interface) Resource extends BaseMetadata, so it includes name and title fields
Fields§
§uri: String
The URI of this resource (format: uri)
name: String
Programmatic identifier (from BaseMetadata)
title: Option<String>
Human-readable display name (from BaseMetadata)
description: Option<String>
A description of what this resource represents
mime_type: Option<String>
The MIME type of this resource, if known
size: Option<u64>
The size of the raw resource content, in bytes
annotations: Option<Annotations>
Optional annotations for the client
meta: Option<HashMap<String, Value>>
See General fields: _meta for notes on _meta usage
Implementations§
Source§impl Resource
impl Resource
pub fn new(uri: impl Into<String>, name: impl Into<String>) -> Resource
pub fn with_title(self, title: impl Into<String>) -> Resource
pub fn with_description(self, description: impl Into<String>) -> Resource
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Resource
pub fn with_size(self, size: u64) -> Resource
pub fn with_annotations(self, annotations: Annotations) -> Resource
pub fn with_meta(self, meta: HashMap<String, Value>) -> Resource
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 HasResourceAnnotations for Resource
impl HasResourceAnnotations for Resource
fn annotations(&self) -> Option<&Annotations>
Source§impl HasResourceDescription for Resource
impl HasResourceDescription for Resource
fn description(&self) -> Option<&str>
Source§impl HasResourceMeta for Resource
impl HasResourceMeta for Resource
Source§impl HasResourceMetadata for Resource
impl HasResourceMetadata for Resource
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
Auto Trait Implementations§
impl Freeze for Resource
impl RefUnwindSafe for Resource
impl Send for Resource
impl Sync for Resource
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ResourceDefinition for Twhere
T: HasResourceMetadata + HasResourceDescription + HasResourceUri + HasResourceMimeType + HasResourceSize + HasResourceAnnotations + HasResourceMeta + Send + Sync,
impl<T> ResourceDefinition for Twhere
T: HasResourceMetadata + HasResourceDescription + HasResourceUri + HasResourceMimeType + HasResourceSize + HasResourceAnnotations + HasResourceMeta + Send + Sync,
Source§fn display_name(&self) -> &str
fn display_name(&self) -> &str
Display name precedence: title > name (matches TypeScript spec)
Source§fn to_resource(&self) -> Resource
fn to_resource(&self) -> Resource
Convert to concrete Resource struct for protocol serialization