pub struct ResourceContents {
pub uri: String,
pub mime_type: Option<String>,
pub body: ResourceBody,
}Expand description
One entry of a resources/read result’s contents array.
Fields§
§uri: StringThe resource’s URI, which the peer named in the request.
Carried on every entry rather than once on the result, because the schema requires it on every entry.
mime_type: Option<String>The media type, if known.
body: ResourceBodyThe body, in one of the two forms the schema allows.
Implementations§
Source§impl ResourceContents
impl ResourceContents
Sourcepub fn blob(uri: impl Into<String>, base64: impl Into<String>) -> Self
pub fn blob(uri: impl Into<String>, base64: impl Into<String>) -> Self
A binary resource, already base64-encoded.
The caller encodes. A decoder here would be a second opinion about whether a payload is binary, and the MIME type the caller already holds is the better witness.
Sourcepub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
The same contents, with a media type.
Trait Implementations§
Source§impl Clone for ResourceContents
impl Clone for ResourceContents
Source§impl Debug for ResourceContents
impl Debug for ResourceContents
impl Eq for ResourceContents
Source§impl PartialEq for ResourceContents
impl PartialEq for ResourceContents
impl StructuralPartialEq for ResourceContents
Auto Trait Implementations§
impl Freeze for ResourceContents
impl RefUnwindSafe for ResourceContents
impl Send for ResourceContents
impl Sync for ResourceContents
impl Unpin for ResourceContents
impl UnsafeUnpin for ResourceContents
impl UnwindSafe for ResourceContents
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