#[non_exhaustive]pub enum ContentBlock {
Text(String),
Image(ImageBlock),
ToolUse(ToolUseBlock),
ToolResult(ToolResultBlock),
CachePoint(CachePointBlock),
}Expand description
A content block that can appear in a message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text(String)
Image(ImageBlock)
ToolUse(ToolUseBlock)
ToolResult(ToolResultBlock)
CachePoint(CachePointBlock)
Implementations§
Source§impl ContentBlock
impl ContentBlock
Sourcepub fn as_image(&self) -> Result<&ImageBlock, &Self>
pub fn as_image(&self) -> Result<&ImageBlock, &Self>
Returns Ok(&ImageBlock) if this is an Image block.
Sourcepub fn as_tool_use(&self) -> Result<&ToolUseBlock, &Self>
pub fn as_tool_use(&self) -> Result<&ToolUseBlock, &Self>
Returns Ok(&ToolUseBlock) if this is a ToolUse block.
Sourcepub fn as_tool_result(&self) -> Result<&ToolResultBlock, &Self>
pub fn as_tool_result(&self) -> Result<&ToolResultBlock, &Self>
Returns Ok(&ToolResultBlock) if this is a ToolResult block.
Sourcepub fn as_cache_point(&self) -> Result<&CachePointBlock, &Self>
pub fn as_cache_point(&self) -> Result<&CachePointBlock, &Self>
Returns Ok(&CachePointBlock) if this is a CachePoint 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 moreAuto 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