Skip to main content

Module content

Module content 

Source
Expand description

Content blocks inside assistant and user messages.

SDK’s TextBlock, ThinkingBlock, ToolUseBlock, ToolResultBlock. Wire shape is {"type": "...", ...}. Unknown block types land in ContentBlock::Unknown so the decoder is forward-compatible with new Anthropic API blocks (document, future types) without an SDK bump - mirrors the top-level the SDK’s DecodedLine::Unknown fallback.

Re-exports§

use serde::Deserialize; 🔒
use serde::Deserialize; 🔒
use serde::Deserializer; 🔒
use serde::Serialize; 🔒
use serde::Serialize; 🔒
use serde::Serializer; 🔒
use serde_json::Value; 🔒
use crate::messages::Extras; 🔒

Enums§

ContentBlock
A single block inside an assistant turn’s content array or a user message’s tool-result envelope.

Functions§

extras_of 🔒
The block’s own object minus the keys its typed arm read, kept verbatim so a decode is lossless.
with_extras 🔒
Merge a block’s unmodelled fields into its serialized object. A key the typed arm wrote wins, so an extra can never shadow a modelled field.