pub struct Resource {
pub uri: String,
pub name: String,
pub description: Option<String>,
pub mime_type: Option<String>,
pub annotations: Option<Annotations>,
pub size: Option<u64>,
pub title: Option<String>,
pub meta: Option<HashMap<String, Value>>,
}
Expand description
Resource definition
Fields§
§uri: String
URI of the resource
name: String
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
description: Option<String>
Description of the resource
mime_type: Option<String>
MIME type of the resource
annotations: Option<Annotations>
Resource annotations (2025-06-18)
size: Option<u64>
Resource size in bytes (2025-06-18)
title: Option<String>
Intended for UI and end-user contexts
meta: Option<HashMap<String, Value>>
Metadata field for future extensions
Implementations§
Source§impl Resource
impl Resource
Sourcepub fn from_legacy<S: Into<String>>(uri: S, name: Option<S>) -> Self
pub fn from_legacy<S: Into<String>>(uri: S, name: Option<S>) -> Self
Create a resource from legacy format (name was optional)
Sourcepub fn with_title<S: Into<String>>(self, title: S) -> Self
pub fn with_title<S: Into<String>>(self, title: S) -> Self
Add title to the resource
Sourcepub fn with_description<S: Into<String>>(self, description: S) -> Self
pub fn with_description<S: Into<String>>(self, description: S) -> Self
Add description to the resource
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Resource
impl<'de> Deserialize<'de> for Resource
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
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 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