#[non_exhaustive]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 icons: Option<Vec<Icon>>,
pub meta: Option<Meta>,
pub annotations: Option<Annotations>,
}Expand description
A known resource that the server is capable of reading (spec Resource).
Also used as the inner type of ContentBlock::ResourceLink (spec ResourceLink extends Resource).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.uri: StringThe URI of this resource (e.g. file:///path/to/file).
name: StringThe programmatic name of the resource.
title: Option<String>Optional human-readable display title.
description: Option<String>Optional 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 (before base64/tokenization), if known.
icons: Option<Vec<Icon>>Optional set of icons the client may display for this resource.
meta: Option<Meta>Optional protocol-level metadata for this resource.
annotations: Option<Annotations>Optional annotations describing how the client should use this resource.
Implementations§
Source§impl Resource
impl Resource
pub fn new(uri: impl Into<String>, name: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
pub fn with_size(self, size: u64) -> Self
pub fn with_icons(self, icons: Vec<Icon>) -> Self
pub fn with_meta(self, meta: Meta) -> Self
pub fn with_annotations(self, annotations: Annotations) -> Self
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
Source§impl JsonSchema for Resource
impl JsonSchema for Resource
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl 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