pub enum MessageContent {
Text(String),
MultiModal {
text: Option<String>,
attachments: Vec<ContentAttachment>,
},
}Expand description
Content of a chat message - supports text and multi-modal content
Variants§
Implementations§
Source§impl MessageContent
impl MessageContent
Sourcepub fn multi_modal(text: impl Into<String>) -> Self
pub fn multi_modal(text: impl Into<String>) -> Self
Create multi-modal content with text
Sourcepub fn with_attachment(self, attachment: ContentAttachment) -> Self
pub fn with_attachment(self, attachment: ContentAttachment) -> Self
Add an attachment to multi-modal content
Sourcepub fn text_content(&self) -> Option<&str>
pub fn text_content(&self) -> Option<&str>
Get the text content, if any
Sourcepub fn attachments(&self) -> &[ContentAttachment]
pub fn attachments(&self) -> &[ContentAttachment]
Get attachments, if any
Trait Implementations§
Source§impl Clone for MessageContent
impl Clone for MessageContent
Source§fn clone(&self) -> MessageContent
fn clone(&self) -> MessageContent
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 MessageContent
impl Debug for MessageContent
Source§impl<'de> Deserialize<'de> for MessageContent
impl<'de> Deserialize<'de> for MessageContent
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 From<&str> for MessageContent
impl From<&str> for MessageContent
Source§impl From<String> for MessageContent
impl From<String> for MessageContent
Auto Trait Implementations§
impl Freeze for MessageContent
impl RefUnwindSafe for MessageContent
impl Send for MessageContent
impl Sync for MessageContent
impl Unpin for MessageContent
impl UnwindSafe for MessageContent
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