MCPcopy Create free account
hub / github.com/AIScientists-Dev/Flowtrace / array_item

Function array_item

crates/flowtrace-cli/src/explain.rs:212–222  ·  view source on GitHub ↗

If `s` is an array, return its element schema; else `None`. Tuple-typed arrays (`items: [schema, schema, …]`) and boolean-schema items are not supported and yield `None`.

(s: &'a SchemaObject)

Source from the content-addressed store, hash-verified

210/// arrays (`items: [schema, schema, …]`) and boolean-schema items are not
211/// supported and yield `None`.
212fn array_item<'a>(s: &'a SchemaObject) -> Option<&'a SchemaObject> {
213 let arr = s.array.as_ref()?;
214 let items = arr.items.as_ref()?;
215 match items {
216 SingleOrVec::Single(b) => match b.as_ref() {
217 Schema::Object(o) => Some(o),
218 Schema::Bool(_) => None,
219 },
220 SingleOrVec::Vec(_) => None,
221 }
222}
223
224/// If `s` is a "map type" (object with `additionalProperties` and no declared
225/// properties — what schemars emits for `BTreeMap<String, T>`), return the

Callers 3

step_intoFunction · 0.85
unwrap_containerFunction · 0.85
describe_typeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…