MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / deserialize_content

Function deserialize_content

crates/opencode-provider/src/message.rs:57–63  ·  view source on GitHub ↗

Deserialize content that may be null (some OpenAI-compatible APIs return `"content": null` for tool-call-only responses).

(deserializer: D)

Source from the content-addressed store, hash-verified

55/// Deserialize content that may be null (some OpenAI-compatible APIs return
56/// `"content": null` for tool-call-only responses).
57fn deserialize_content<'de, D>(deserializer: D) -> Result<Content, D::Error>
58where
59 D: serde::Deserializer<'de>,
60{
61 let value: Option<Content> = Option::deserialize(deserializer)?;
62 Ok(value.unwrap_or_else(|| Content::Text(String::new())))
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(rename_all = "lowercase")]

Callers

nothing calls this directly

Calls 1

newFunction · 0.85

Tested by

no test coverage detected