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

Method parse_array

crates/opencode-session/src/prompt.rs:86–94  ·  view source on GitHub ↗

Parse a JSON array of parts into a Vec , skipping invalid entries.

(value: &serde_json::Value)

Source from the content-addressed store, hash-verified

84impl PartInput {
85 /// Parse a JSON array of parts into a Vec<PartInput>, skipping invalid entries.
86 pub fn parse_array(value: &serde_json::Value) -> Vec<PartInput> {
87 match value.as_array() {
88 Some(arr) => arr
89 .iter()
90 .filter_map(|v| serde_json::from_value(v.clone()).ok())
91 .collect(),
92 None => Vec::new(),
93 }
94 }
95}
96
97struct PromptState {

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected