Skip to main content

Content

Enum Content 

Source
#[non_exhaustive]
pub enum Content { Text(String), Image { source: ImageSource, }, Document { source: DocumentSource, }, ToolUse { id: String, name: String, input: Value, signature: Option<String>, }, ToolResult { tool_use_id: String, content: Vec<Content>, is_error: bool, }, Thinking { text: String, signature: Option<String>, id: Option<String>, encrypted_content: Option<String>, }, RedactedThinking { data: String, }, ServerToolUse { id: String, name: String, input: Value, }, ServerToolResult { kind: String, tool_use_id: String, content: Value, }, }
Expand description

A piece of content. Text is expressible as a bare string or a {"type":"text",…} object; other variants are tagged objects. Thinking/RedactedThinking payloads and the two server-tool variants (CR-4) round-trip verbatim — provider-executed blocks carried untouched, mirroring the RedactedThinking rule.

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

Fields

§

Document

A document/PDF, INPUT-ONLY, mirroring Image (no provider RETURNS one — no decode).

Fields

§

ToolUse

Fields

§name: String
§input: Value
§signature: Option<String>

Google thoughtSignature for this tool call — LOAD-BEARING for Gemini 2.5 multi-turn function calling (the API 400s if it is dropped on replay). None for dialects without it (Anthropic/OpenAI). Folded from a Delta::SignatureDelta on the tool block (bl-61a9).

§

ToolResult

Fields

§tool_use_id: String
§content: Vec<Content>
§is_error: bool
§

Thinking

Fields

§text: String
§signature: Option<String>

Anthropic thinking signature (the API 400s on an altered/absent one).

§id: Option<String>

OpenAI Responses reasoning-item id (rs_…), echoed back on replay.

§encrypted_content: Option<String>

OpenAI Responses encrypted_content — the encrypted reasoning payload for stateless (store:false) replay. None for dialects without it (bl-61a9).

§

RedactedThinking

Fields

§data: String
§

ServerToolUse

Anthropic server-tool invocation (web_search etc.), opaque (CR-4). Echoed back VERBATIM on replay; never folded into ToolUse. id uses srvtoolu_.

Fields

§name: String
§input: Value
§

ServerToolResult

Server-tool RESULT, opaque. kind IS the wire tag (web_search_tool_result, code_execution_tool_result, …) — an open set carried as data, re-emitted verbatim on encode. content is the untouched provider payload: array of results on success, or {type:*_error,...} object on failure. Echoed back VERBATIM; NEVER a client tool_result.

Fields

§kind: String
§tool_use_id: String
§content: Value

Trait Implementations§

Source§

impl Clone for Content

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Content

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Content

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Content

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Content

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Content

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.