pub enum UserContent {
Text(String),
Blocks(Vec<ContentBlock>),
}Expand description
用户消息内容 — 支持纯文本快捷方式或多模态内容块。
90% 的场景是纯文本,Text 变体避免了
vec![ContentBlock::Text { text }] 的样板代码。
Variants§
Implementations§
Source§impl UserContent
impl UserContent
Sourcepub fn into_blocks(self) -> Vec<ContentBlock>
pub fn into_blocks(self) -> Vec<ContentBlock>
将内容规范化为 ContentBlock 数组。
Trait Implementations§
Source§impl Clone for UserContent
impl Clone for UserContent
Source§fn clone(&self) -> UserContent
fn clone(&self) -> UserContent
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 UserContent
impl Debug for UserContent
Source§impl<'de> Deserialize<'de> for UserContent
impl<'de> Deserialize<'de> for UserContent
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 UserContent
impl From<&str> for UserContent
Source§impl From<String> for UserContent
impl From<String> for UserContent
Source§impl From<Vec<ContentBlock>> for UserContent
impl From<Vec<ContentBlock>> for UserContent
Source§fn from(blocks: Vec<ContentBlock>) -> Self
fn from(blocks: Vec<ContentBlock>) -> Self
Converts to this type from the input type.
Source§impl PartialEq for UserContent
impl PartialEq for UserContent
Source§fn eq(&self, other: &UserContent) -> bool
fn eq(&self, other: &UserContent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for UserContent
impl Serialize for UserContent
impl StructuralPartialEq for UserContent
Auto Trait Implementations§
impl Freeze for UserContent
impl RefUnwindSafe for UserContent
impl Send for UserContent
impl Sync for UserContent
impl Unpin for UserContent
impl UnsafeUnpin for UserContent
impl UnwindSafe for UserContent
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