Debian Codegraph @

src/specification/draft201909.rs

raw symbols SCIP
1 use serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::Valuerust-analyzer cargo serde_json 1.0.145 value/Value#;
2
3 use craterust-analyzer cargo referencing 0.37.4 crate/::{resourcerust-analyzer cargo referencing 0.37.4 resource/::InnerResourcePtrrust-analyzer cargo referencing 0.37.4 resource/InnerResourcePtr#, segmentsrust-analyzer cargo referencing 0.37.4 segments/::Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#, Errorrust-analyzer cargo referencing 0.37.4 error/Error#, Resolverrust-analyzer cargo referencing 0.37.4 resolver/Resolver#, Segmentsrust-analyzer cargo referencing 0.37.4 segments/Segments#};
4
5 use superrust-analyzer cargo referencing 0.37.4 specification/::subresourcesrust-analyzer cargo referencing 0.37.4 specification/subresources/::SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#;
6
7 pub(craterust-analyzer cargo referencing 0.37.4 crate/) fn object_iterrust-analyzer cargo referencing 0.37.4 specification/draft201909/object_iter().<'a>(
8 (key, value): (&'a Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, &'a Valuerust-analyzer cargo serde_json 1.0.145 value/Value#),
9 ) -> SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#<'a> {
10 match key.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().() {
11 // For these keys, yield the value once.
12 "additionalItems"
13 | "additionalProperties"
14 | "contains"
15 | "contentSchema"
16 | "else"
17 | "if"
18 | "not"
19 | "propertyNames"
20 | "then"
21 | "unevaluatedItems"
22 | "unevaluatedProperties" => SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#::Oncerust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#Once#(value),
23 // For these keys, if the value is an array, iterate over its items.
24 "allOf" | "anyOf" | "oneOf" => {
25 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(arr) = value.as_arrayrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_array().() {
26 SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#::Arrayrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#Array#(arr.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().())
27 } else {
28 SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#::Emptyrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#Empty#
29 }
30 }
31 // For these keys, if the value is an object, iterate over its values.
32 "$defs" | "definitions" | "dependentSchemas" | "patternProperties" | "properties" => {
33 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(obj) = value.as_objectrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_object().() {
34 SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#::Objectrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#Object#(obj.valuesrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]values().())
35 } else {
36 SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#::Emptyrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#Empty#
37 }
38 }
39 // For "items": if it's an array, iterate over its items; otherwise, yield the value once.
40 "items" => match value {
41 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Arrayrust-analyzer cargo serde_json 1.0.145 value/Value#Array#(arr) => SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#::Arrayrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#Array#(arr.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()),
42 _ => SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#::Oncerust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#Once#(value),
43 },
44 // For any other key, yield nothing.
45 _ => SubresourceIteratorInnerrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#::Emptyrust-analyzer cargo referencing 0.37.4 specification/subresources/SubresourceIteratorInner#Empty#,
46 }
47 }
48
49 pub(craterust-analyzer cargo referencing 0.37.4 crate/) fn maybe_in_subresourcerust-analyzer cargo referencing 0.37.4 specification/draft201909/maybe_in_subresource().<'r>(
50 segments: &Segmentsrust-analyzer cargo referencing 0.37.4 segments/Segments#,
51 resolver: &Resolverrust-analyzer cargo referencing 0.37.4 resolver/Resolver#<'r>,
52 subresource: &InnerResourcePtrrust-analyzer cargo referencing 0.37.4 resource/InnerResourcePtr#,
53 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Resolverrust-analyzer cargo referencing 0.37.4 resolver/Resolver#<'r>, Errorrust-analyzer cargo referencing 0.37.4 error/Error#> {
54 const IN_VALUErust-analyzer cargo referencing 0.37.4 specification/draft201909/IN_VALUE.: &[&str] = &[
55 "additionalItems",
56 "additionalProperties",
57 "contains",
58 "contentSchema",
59 "else",
60 "if",
61 "not",
62 "propertyNames",
63 "then",
64 "unevaluatedItems",
65 "unevaluatedProperties",
66 ];
67 const IN_CHILDrust-analyzer cargo referencing 0.37.4 specification/draft201909/IN_CHILD.: &[&str] = &[
68 "allOf",
69 "anyOf",
70 "oneOf",
71 "$defs",
72 "definitions",
73 "dependentSchemas",
74 "patternProperties",
75 "properties",
76 ];
77
78 let mut iter = segments.iterrust-analyzer cargo referencing 0.37.4 segments/impl#[`Segments<'a>`]iter().();
79 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(segment) = iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]next().() {
80 if let Segmentrust-analyzer cargo referencing 0.37.4 segments/Segment#::Keyrust-analyzer cargo referencing 0.37.4 segments/Segment#Key#(key) = segment {
81 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().key rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[`Cow<'_, str>`][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[`Cow<'_, str>`][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[`Cow<'_, str>`][`PartialEq<&str>`]eq()."items" && subresource.contentsrust-analyzer cargo referencing 0.37.4 resource/impl#[InnerResourcePtr]contents().().is_objectrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]is_object().() {
82 return resolver.in_subresource_innerrust-analyzer cargo referencing 0.37.4 resolver/impl#[`Resolver<'r>`]in_subresource_inner().(subresource);
83 }
84 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().IN_VALUErust-analyzer cargo referencing 0.37.4 specification/draft201909/IN_VALUE..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&key.as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, T>`][`AsRef<T>`]as_ref().())
85 && (!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().IN_CHILDrust-analyzer cargo referencing 0.37.4 specification/draft201909/IN_CHILD..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&key.as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, T>`][`AsRef<T>`]as_ref().()) || iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().())
86 {
87 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(resolver.clonerust-analyzer cargo referencing 0.37.4 resolver/impl#[`Resolver<'r>`][Clone]clone().());
88 }
89 }
90 }
91 resolver.in_subresource_innerrust-analyzer cargo referencing 0.37.4 resolver/impl#[`Resolver<'r>`]in_subresource_inner().(subresource)
92 }