pub enum ContentBlock {
Text(TextBlock),
Image(ImageBlock),
Thinking(ThinkingBlock),
ToolUse(ToolUseBlock),
ToolResult(ToolResultBlock),
ServerToolUse(ServerToolUseBlock),
WebSearchToolResult(WebSearchToolResultBlock),
CodeExecutionToolResult(CodeExecutionToolResultBlock),
McpToolUse(McpToolUseBlock),
McpToolResult(McpToolResultBlock),
ContainerUpload(ContainerUploadBlock),
Unknown(Value),
}Expand description
Content blocks for messages
Includes typed variants for known block types and an Unknown fallback
for forward compatibility with new block types added by the CLI.
Variants§
Text(TextBlock)
Image(ImageBlock)
Thinking(ThinkingBlock)
ToolUse(ToolUseBlock)
ToolResult(ToolResultBlock)
ServerToolUse(ServerToolUseBlock)
Server-side tool use (e.g., web search, code execution).
WebSearchToolResult(WebSearchToolResultBlock)
Result from a web search server tool.
CodeExecutionToolResult(CodeExecutionToolResultBlock)
Result from server-side code execution.
McpToolUse(McpToolUseBlock)
MCP tool invocation as a content block.
McpToolResult(McpToolResultBlock)
MCP tool result as a content block.
ContainerUpload(ContainerUploadBlock)
Container file upload content block.
Unknown(Value)
A content block type not yet known to this version of the crate. Contains the raw JSON value for caller inspection.
Implementations§
Source§impl ContentBlock
impl ContentBlock
Sourcepub fn block_type(&self) -> &str
pub fn block_type(&self) -> &str
Returns the type tag string for this content block.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true if this is an unknown/unrecognized content block type.
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 · 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 ContentBlock
impl Debug for ContentBlock
Source§impl<'de> Deserialize<'de> for ContentBlock
impl<'de> Deserialize<'de> for ContentBlock
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto 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