pub struct ResourceMetadata {
pub uri: String,
pub description: String,
pub mime_type: Option<String>,
pub metadata: HashMap<String, Value>,
}Expand description
Metadata describing a resource
Fields§
§uri: StringUnique resource identifier (URI) Examples: “file:///config.yaml”, “schema:///users”, “db:///schema.sql”
description: StringHuman-readable description of the resource
mime_type: Option<String>Optional MIME type of the resource content
metadata: HashMap<String, Value>Additional metadata
Implementations§
Source§impl ResourceMetadata
impl ResourceMetadata
Sourcepub fn new(uri: impl Into<String>, description: impl Into<String>) -> Self
pub fn new(uri: impl Into<String>, description: impl Into<String>) -> Self
Create a new resource with URI and description
Sourcepub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
Set the MIME type for this resource
Sourcepub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
pub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
Add metadata to the resource
Trait Implementations§
Source§impl Clone for ResourceMetadata
impl Clone for ResourceMetadata
Source§fn clone(&self) -> ResourceMetadata
fn clone(&self) -> ResourceMetadata
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 ResourceMetadata
impl Debug for ResourceMetadata
Source§impl<'de> Deserialize<'de> for ResourceMetadata
impl<'de> Deserialize<'de> for ResourceMetadata
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
Auto Trait Implementations§
impl Freeze for ResourceMetadata
impl RefUnwindSafe for ResourceMetadata
impl Send for ResourceMetadata
impl Sync for ResourceMetadata
impl Unpin for ResourceMetadata
impl UnsafeUnpin for ResourceMetadata
impl UnwindSafe for ResourceMetadata
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