Debian Codegraph @

src/specification/ids.rs

raw symbols SCIP
1 //! Extracting schema ID.
2 use serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::Valuerust-analyzer cargo serde_json 1.0.145 value/Value#;
3
4 pub(craterust-analyzer cargo referencing 0.37.4 crate/) fn dollar_idrust-analyzer cargo referencing 0.37.4 specification/ids/dollar_id().(contents: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str> {
5 contents
6 .as_objectrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_object().()
7 .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|obj| obj.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("$id"))
8 .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|id| id.as_strrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_str().())
9 }
10
11 pub(craterust-analyzer cargo referencing 0.37.4 crate/) fn legacy_dollar_idrust-analyzer cargo referencing 0.37.4 specification/ids/legacy_dollar_id().(contents: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str> {
12 let object = contents.as_objectrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_object().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
13 if object.contains_keyrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]contains_key().("$ref") {
14 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
15 }
16 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id) = contents.getrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]get().("$id").and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|id| id.as_strrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_str().()) {
17 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().id.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('#') {
18 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id);
19 }
20 }
21 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
22 }
23
24 pub(craterust-analyzer cargo referencing 0.37.4 crate/) fn legacy_idrust-analyzer cargo referencing 0.37.4 specification/ids/legacy_id().(contents: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str> {
25 let object = contents.as_objectrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_object().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
26 if object.contains_keyrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]contains_key().("$ref") {
27 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
28 }
29 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id) = object.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("id").and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|id| id.as_strrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_str().()) {
30 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().id.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('#') {
31 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id);
32 }
33 }
34 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
35 }