pub enum Content {
Text(TextContent),
Image(ImageContent),
Resource(EmbeddedResource),
}
Variants§
Implementations§
Source§impl Content
impl Content
pub fn text<S: Into<String>>(text: S) -> Self
pub fn image<S: Into<String>, T: Into<String>>(data: S, mime_type: T) -> Self
pub fn resource(resource: ResourceContents) -> Self
pub fn embedded_text<S: Into<String>, T: Into<String>>( uri: S, content: T, ) -> Self
Sourcepub fn as_image(&self) -> Option<(&str, &str)>
pub fn as_image(&self) -> Option<(&str, &str)>
Get the image content if this is an ImageContent variant
Sourcepub fn with_audience(self, audience: Vec<Role>) -> Self
pub fn with_audience(self, audience: Vec<Role>) -> Self
Set the audience for the content
Sourcepub fn with_priority(self, priority: f32) -> Self
pub fn with_priority(self, priority: f32) -> Self
pub fn unannotated(&self) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Content
impl<'de> Deserialize<'de> for Content
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 Content
Auto Trait Implementations§
impl Freeze for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnwindSafe for Content
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