pub enum MessageContent {
Text(String),
Parts(Vec<ContentPart>),
}Variants§
Text(String)
Parts(Vec<ContentPart>)
Implementations§
Source§impl MessageContent
impl MessageContent
Sourcepub fn to_simple_string(&self) -> String
pub fn to_simple_string(&self) -> String
Returns the text content, cloning only when necessary. For simple text, returns a clone of the string. For parts, concatenates text parts with spaces. Optimized to avoid intermediate Vec allocation.
Sourcepub fn append_text_to(&self, buffer: &mut String) -> bool
pub fn append_text_to(&self, buffer: &mut String) -> bool
Appends text content directly to a buffer, avoiding intermediate allocations. Returns true if any content was appended.
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 PartialEq for MessageContent
impl PartialEq for MessageContent
Source§impl Serialize for MessageContent
impl Serialize for MessageContent
impl StructuralPartialEq 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