| 1 | use craterust-analyzer cargo jsonschema 0.37.4 crate/::{ |
| 2 | compilerrust-analyzer cargo jsonschema 0.37.4 compiler/, noderust-analyzer cargo jsonschema 0.37.4 node/::SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, pathsrust-analyzer cargo jsonschema 0.37.4 paths/::Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#, threadrust-analyzer cargo jsonschema 0.37.4 thread/::ThreadBoundrust-analyzer cargo jsonschema 0.37.4 thread/ThreadBound#, validatorrust-analyzer cargo jsonschema 0.37.4 validator/::Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# as _, |
| 3 | }; |
| 4 | use ahashrust-analyzer cargo ahash 0.8.12 crate/::AHashMaprust-analyzer cargo ahash 0.8.12 hash_map/AHashMap#; |
| 5 | use serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::{Maprust-analyzer cargo serde_json 1.0.145 map/Map#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#}; |
| 6 | |
| 7 | use craterust-analyzer cargo jsonschema 0.37.4 crate/::ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#; |
| 8 | |
| 9 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) type FancyRegexValidatorsrust-analyzer cargo jsonschema 0.37.4 properties/FancyRegexValidators# = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(fancy_regexrust-analyzer cargo fancy-regex 0.11.0 crate/::Regexrust-analyzer cargo fancy-regex 0.11.0 Regex#, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>; |
| 10 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) type RegexValidatorsrust-analyzer cargo jsonschema 0.37.4 properties/RegexValidators# = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(regexrust-analyzer cargo regex 1.12.2 crate/::Regexrust-analyzer cargo regex 1.12.2 regex/string/Regex#, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>; |
| 11 | |
| 12 | /// A value that can look up property validators by name. |
| 13 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) trait PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#: ThreadBoundrust-analyzer cargo jsonschema 0.37.4 thread/ThreadBound# { |
| 14 | fn get_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_validator().(&self, property: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#>; |
| 15 | fn get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(&self, property: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, &SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>; |
| 16 | } |
| 17 | |
| 18 | // We're defining two different property validator map implementations, one for small map sizes and |
| 19 | // one for large map sizes, to optimize the performance depending on the number of properties |
| 20 | // present. |
| 21 | // |
| 22 | // Implementors should use `compile_dynamic_prop_map_validator!` for building their validator maps |
| 23 | // at runtime, as it wraps up all of the logic to choose the right map size and then build and |
| 24 | // compile the validator. |
| 25 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) type SmallValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/SmallValidatorsMap# = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>; |
| 26 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) type BigValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/BigValidatorsMap# = AHashMaprust-analyzer cargo ahash 0.8.12 hash_map/AHashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#>; |
| 27 | |
| 28 | impl PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap# for SmallValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/SmallValidatorsMap# { |
| 29 | #[inline] |
| 30 | fn get_validatorrust-analyzer cargo jsonschema 0.37.4 properties/impl#[`Vec<(String, SchemaNode)>`][PropertiesValidatorsMap]get_validator().(&self, property: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#> { |
| 31 | for (prop, node) in self { |
| 32 | if prop rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().property { |
| 33 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(node); |
| 34 | } |
| 35 | } |
| 36 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 37 | } |
| 38 | #[inline] |
| 39 | fn get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/impl#[`Vec<(String, SchemaNode)>`][PropertiesValidatorsMap]get_key_validator().(&self, property: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, &SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)> { |
| 40 | for (prop, node) in self { |
| 41 | if prop rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().property { |
| 42 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((prop, node)); |
| 43 | } |
| 44 | } |
| 45 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | impl PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap# for BigValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/BigValidatorsMap# { |
| 50 | #[inline] |
| 51 | fn get_validatorrust-analyzer cargo jsonschema 0.37.4 properties/impl#[`AHashMap<String, SchemaNode>`][PropertiesValidatorsMap]get_validator().(&self, property: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#> { |
| 52 | self.getrust-analyzer cargo ahash 0.8.12 hash_map/impl#[`AHashMap<K, V, S>`]get().(property) |
| 53 | } |
| 54 | |
| 55 | #[inline] |
| 56 | fn get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/impl#[`AHashMap<String, SchemaNode>`][PropertiesValidatorsMap]get_key_validator().(&self, property: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, &SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)> { |
| 57 | self.get_key_valuerust-analyzer cargo ahash 0.8.12 hash_map/impl#[`AHashMap<K, V, S>`]get_key_value().(property) |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compile_small_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_small_map().<'a>( |
| 62 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 63 | map: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>, |
| 64 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<SmallValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/SmallValidatorsMap#, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> { |
| 65 | let mut properties = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(map.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 66 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("properties"); |
| 67 | for (key, subschema) in map { |
| 68 | let pctx = kctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(key.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()); |
| 69 | properties.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(( |
| 70 | key.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), |
| 71 | compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&pctx, pctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 72 | )); |
| 73 | } |
| 74 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(properties) |
| 75 | } |
| 76 | |
| 77 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compile_big_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_big_map().<'a>( |
| 78 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 79 | map: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>, |
| 80 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<BigValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/BigValidatorsMap#, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> { |
| 81 | let mut properties = AHashMaprust-analyzer cargo ahash 0.8.12 hash_map/AHashMap#::with_capacityrust-analyzer cargo ahash 0.8.12 hash_map/impl#[`AHashMap<K, V>`]with_capacity().(map.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 82 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("properties"); |
| 83 | for (key, subschema) in map { |
| 84 | let pctx = kctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(key.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()); |
| 85 | properties.insertrust-analyzer cargo ahash 0.8.12 hash_map/impl#[`AHashMap<K, V, S>`]insert().( |
| 86 | key.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), |
| 87 | compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&pctx, pctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 88 | ); |
| 89 | } |
| 90 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(properties) |
| 91 | } |
| 92 | |
| 93 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn are_properties_validrust-analyzer cargo jsonschema 0.37.4 properties/are_properties_valid().<M, F>( |
| 94 | prop_map: &M, |
| 95 | props: &Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>, |
| 96 | ctx: &mut craterust-analyzer cargo jsonschema 0.37.4 crate/::validatorrust-analyzer cargo jsonschema 0.37.4 validator/::ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 97 | check: F, |
| 98 | ) -> bool |
| 99 | where |
| 100 | M: PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#, |
| 101 | F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, &mut craterust-analyzer cargo jsonschema 0.37.4 crate/::validatorrust-analyzer cargo jsonschema 0.37.4 validator/::ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#) -> bool, |
| 102 | { |
| 103 | for (property, instance) in props { |
| 104 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(validator) = prop_map.get_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_validator().(property) { |
| 105 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().validator.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(instance, ctx) { |
| 106 | return false; |
| 107 | } |
| 108 | } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().check(instance, ctx) { |
| 109 | return false; |
| 110 | } |
| 111 | } |
| 112 | true |
| 113 | } |
| 114 | |
| 115 | /// Create a vector of pattern-validators pairs. |
| 116 | #[inline] |
| 117 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compile_fancy_regex_patternsrust-analyzer cargo jsonschema 0.37.4 properties/compile_fancy_regex_patterns().<'a>( |
| 118 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 119 | obj: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>, |
| 120 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<FancyRegexValidatorsrust-analyzer cargo jsonschema 0.37.4 properties/FancyRegexValidators#, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> { |
| 121 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("patternProperties"); |
| 122 | let mut compiled_patterns = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(obj.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 123 | for (pattern, subschema) in obj { |
| 124 | let pctx = kctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(pattern.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()); |
| 125 | let compiled_pattern = ctx.get_or_compile_regexrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]get_or_compile_regex().(pattern).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|()| { |
| 126 | ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::formatrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]format().(Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), kctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), subschema, "regex") |
| 127 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 128 | let node = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&pctx, pctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 129 | compiled_patterns.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(((*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Deref]deref().compiled_pattern).clonerust-analyzer cargo fancy-regex 0.11.0 impl#[Regex][Clone]clone().(), node)); |
| 130 | } |
| 131 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(compiled_patterns) |
| 132 | } |
| 133 | |
| 134 | #[inline] |
| 135 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compile_regex_patternsrust-analyzer cargo jsonschema 0.37.4 properties/compile_regex_patterns().<'a>( |
| 136 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 137 | obj: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>, |
| 138 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<RegexValidatorsrust-analyzer cargo jsonschema 0.37.4 properties/RegexValidators#, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> { |
| 139 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("patternProperties"); |
| 140 | let mut compiled_patterns = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(obj.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 141 | for (pattern, subschema) in obj { |
| 142 | let pctx = kctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(pattern.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()); |
| 143 | let compiled_pattern = ctx.get_or_compile_standard_regexrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]get_or_compile_standard_regex().(pattern).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|()| { |
| 144 | ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::formatrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]format().(Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), kctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), subschema, "regex") |
| 145 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 146 | let node = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&pctx, pctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 147 | compiled_patterns.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(((*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Deref]deref().compiled_pattern).clonerust-analyzer cargo regex 1.12.2 regex/string/impl#[Regex][Clone]clone().(), node)); |
| 148 | } |
| 149 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(compiled_patterns) |
| 150 | } |
| 151 | |
| 152 | macro_rules! compile_dynamic_prop_map_validatorrust-analyzer cargo jsonschema 0.37.4 properties/compile_dynamic_prop_map_validator! { |
| 153 | ($validator:tt, $properties:ident, $( $arg:expr ),* $(,)*) => {{ |
| 154 | if let Value::Object(map) = $properties { |
| 155 | if map.len() < 40 { |
| 156 | Some($validator::<SmallValidatorsMap>::compile( |
| 157 | map, $($arg, )* |
| 158 | )) |
| 159 | } else { |
| 160 | Some($validator::<BigValidatorsMap>::compile( |
| 161 | map, $($arg, )* |
| 162 | )) |
| 163 | } |
| 164 | } else { |
| 165 | Some(Err(ValidationError::custom( |
| 166 | Location::new(), |
| 167 | Location::new(), |
| 168 | $properties, |
| 169 | "Unexpected type", |
| 170 | ))) |
| 171 | } |
| 172 | }}; |
| 173 | } |
| 174 | |
| 175 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) use compile_dynamic_prop_map_validatorrust-analyzer cargo jsonschema 0.37.4 properties/compile_dynamic_prop_map_validator!; |