pub enum ContentBlock {
Text {
text: String,
annotations: Option<Annotations>,
meta: Option<OpenMetadata>,
additional: BTreeMap<String, Value>,
},
Image {
data: String,
mime_type: String,
annotations: Option<Annotations>,
meta: Option<OpenMetadata>,
additional: BTreeMap<String, Value>,
},
Audio {
data: String,
mime_type: String,
annotations: Option<Annotations>,
meta: Option<OpenMetadata>,
additional: BTreeMap<String, Value>,
},
ResourceLink {
icons: Option<Vec<RawIcon>>,
name: String,
title: Option<String>,
uri: AbsoluteUri,
description: Option<String>,
mime_type: Option<String>,
annotations: Option<Annotations>,
size: Option<JsonInteger>,
meta: Option<OpenMetadata>,
additional: BTreeMap<String, Value>,
},
Resource {
resource: EmbeddedResourceContents,
annotations: Option<Annotations>,
meta: Option<OpenMetadata>,
additional: BTreeMap<String, Value>,
},
}Expand description
Final common content discriminators.
Variants§
Text
Text content.
Image
Binary image content.
Audio
Binary audio content.
ResourceLink
A resource link uses the exact resource_link discriminator.
Fields
§
uri: AbsoluteUri§
annotations: Option<Annotations>§
size: Option<JsonInteger>§
meta: Option<OpenMetadata>Resource
An embedded resource uses the exact resource discriminator.
Fields
§
resource: EmbeddedResourceContents§
annotations: Option<Annotations>§
meta: Option<OpenMetadata>Implementations§
Source§impl ContentBlock
impl ContentBlock
Sourcepub fn image(
data: impl Into<String>,
mime_type: impl Into<String>,
) -> Result<Self, CommonTypeError>
pub fn image( data: impl Into<String>, mime_type: impl Into<String>, ) -> Result<Self, CommonTypeError>
Constructs image content after validating base64 and image MIME shape.
Sourcepub fn audio(
data: impl Into<String>,
mime_type: impl Into<String>,
) -> Result<Self, CommonTypeError>
pub fn audio( data: impl Into<String>, mime_type: impl Into<String>, ) -> Result<Self, CommonTypeError>
Constructs audio content after validating base64 and audio MIME shape.
Sourcepub fn resource_link(
uri: impl Into<String>,
name: impl Into<String>,
) -> Result<Self, CommonTypeError>
pub fn resource_link( uri: impl Into<String>, name: impl Into<String>, ) -> Result<Self, CommonTypeError>
Constructs a resource-link content block.
Trait Implementations§
Source§impl Clone for ContentBlock
impl Clone for ContentBlock
Source§fn clone(&self) -> ContentBlock
fn clone(&self) -> ContentBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ContentBlock
impl Debug for ContentBlock
Source§impl<'de> Deserialize<'de> for ContentBlock
impl<'de> Deserialize<'de> for ContentBlock
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 PartialEq for ContentBlock
impl PartialEq for ContentBlock
Source§impl Serialize for ContentBlock
impl Serialize for ContentBlock
impl StructuralPartialEq for ContentBlock
Auto Trait Implementations§
impl Freeze for ContentBlock
impl RefUnwindSafe for ContentBlock
impl Send for ContentBlock
impl Sync for ContentBlock
impl Unpin for ContentBlock
impl UnsafeUnpin for ContentBlock
impl UnwindSafe for ContentBlock
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).