Debian Codegraph @

src/types.rs

raw symbols SCIP
1 //! JSON type representations for schema validation.
2 //!
3 //! Provides [`JsonType`] for individual types and [`JsonTypeSet`] for efficient
4 //! bitset-based type checking in validation hot paths.
5
6 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/;
7 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#;
8
9 use serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::Valuerust-analyzer cargo serde_json 1.0.145 value/Value#;
10
11 /// Represents a JSON value type.
12 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
13 #[repr(u8)]
14 pub enum JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType# {
15 Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array# = 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().0,
16 Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean# = 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().1,
17 Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer# = 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().2,
18 Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null# = 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().3,
19 Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number# = 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().4,
20 Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object# = 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().5,
21 Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String# = 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().6,
22 }
23
24 impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType# {
25 fn fmtrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
26 match self {
27 JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("array"),
28 JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("boolean"),
29 JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("integer"),
30 JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("null"),
31 JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("number"),
32 JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("object"),
33 JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("string"),
34 }
35 }
36 }
37
38 impl JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType# {
39 pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn from_reprrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType]from_repr().(repr: u8) -> Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType] {
40 match repr {
41 1 => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array#,
42 2 => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#,
43 4 => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer#,
44 8 => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null#,
45 16 => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#,
46 32 => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object#,
47 64 => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#,
48 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Invalid JsonType representation: {repr}"),
49 }
50 }
51 }
52
53 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&Valuerust-analyzer cargo serde_json 1.0.145 value/Value#> for JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType# {
54 fn fromrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType][`From<&Value>`]from().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) -> Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType][`From<&Value>`] {
55 match instance {
56 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Nullrust-analyzer cargo serde_json 1.0.145 value/Value#Null# => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null#,
57 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Boolrust-analyzer cargo serde_json 1.0.145 value/Value#Bool#(_) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#,
58 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Numberrust-analyzer cargo serde_json 1.0.145 value/Value#Number#(_) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#,
59 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Stringrust-analyzer cargo serde_json 1.0.145 value/Value#String#(_) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#,
60 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Arrayrust-analyzer cargo serde_json 1.0.145 value/Value#Array#(_) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array#,
61 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(_) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object#,
62 }
63 }
64 }
65
66 impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType# {
67 type Errrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType][FromStr]Err# = ();
68
69 fn from_strrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType][FromStr], Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> {
70 match s {
71 "array" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array#),
72 "boolean" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#),
73 "integer" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer#),
74 "null" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null#),
75 "number" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#),
76 "object" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object#),
77 "string" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#),
78 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(()),
79 }
80 }
81 }
82
83 /// A set of JSON types.
84 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
85 pub struct JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#(u8);
86
87 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet# {
88 fn defaultrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet][Default]default().() -> Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet][Default] {
89 Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet][Default]::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().()
90 }
91 }
92
93 impl JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet# {
94 /// Create an empty set of types.
95 #[inline]
96 #[must_use]
97 pub const fn emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().() -> Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet] {
98 Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet](0)
99 }
100 /// Create a set with all possible JSON types.
101 #[inline]
102 #[must_use]
103 pub const fn allrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]all().() -> Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet] {
104 JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().()
105 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null#)
106 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#)
107 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer#)
108 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#)
109 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#)
110 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array#)
111 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object#)
112 }
113 /// Add a type to this set and return the modified set.
114 #[inline]
115 #[must_use]
116 pub const fn insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(mut self, ty: JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#) -> Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet] {
117 self.0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOrAssign<Self>`]bitor_assign().ty as u8;
118 self
119 }
120 /// Remove a type from this set and return the modified set.
121 #[inline]
122 #[must_use]
123 pub const fn removerust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]remove().(mut self, ty: JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#) -> Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet] {
124 self.0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAndAssign<Self>`]bitand_assign().&=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAndAssign<Self>`]bitand_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAndAssign<Self>`]bitand_assign().!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][Not]not().(ty as u8);
125 self
126 }
127 /// Return the number of types in this set.
128 #[inline]
129 #[must_use]
130 pub const fn lenrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]len().(self) -> usize {
131 self.0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0..count_onesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]count_ones().() as usize
132 }
133 /// Return `true` if the set contains no types.
134 #[inline]
135 #[must_use]
136 pub const fn is_emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]is_empty().(self) -> bool {
137 self.0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().0
138 }
139 /// Check if this set includes the specified type.
140 #[inline]
141 #[must_use]
142 pub fn containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(self, ty: JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#) -> bool {
143 self.0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().ty as u8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0
144 }
145 /// Check if a JSON value's type is allowed by this set.
146 #[must_use]
147 pub fn contains_value_typerust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains_value_type().(self, value: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) -> bool {
148 match value {
149 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Arrayrust-analyzer cargo serde_json 1.0.145 value/Value#Array#(_) => self.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array#),
150 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Boolrust-analyzer cargo serde_json 1.0.145 value/Value#Bool#(_) => self.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#),
151 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Nullrust-analyzer cargo serde_json 1.0.145 value/Value#Null# => self.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null#),
152 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Numberrust-analyzer cargo serde_json 1.0.145 value/Value#Number#(n) => {
153 #[cfg(feature = "arbitrary-precision")]
154 {
155 use craterust-analyzer cargo jsonschema 0.37.4 crate/::extrust-analyzer cargo jsonschema 0.37.4 ext/::numericrust-analyzer cargo jsonschema 0.37.4 ext/numeric/::bignumrust-analyzer cargo jsonschema 0.37.4 ext/numeric/bignum/;
156 use num_traitsrust-analyzer cargo num-traits 0.2.19 crate/::Onerust-analyzer cargo num-traits 0.2.19 identities/One#;
157
158 // Check if the number is an integer using the same logic as is_integer()
159 // Important: Check BigFraction BEFORE as_f64() to avoid precision loss
160 let is_integer = n.is_i64rust-analyzer cargo serde_json 1.0.145 number/impl#[Number]is_i64().() || n.is_u64rust-analyzer cargo serde_json 1.0.145 number/impl#[Number]is_u64().() || {
161 // Check huge plain integers first
162 if bignumrust-analyzer cargo jsonschema 0.37.4 ext/numeric/bignum/::try_parse_bigintrust-analyzer cargo jsonschema 0.37.4 ext/numeric/bignum/try_parse_bigint().(n).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
163 true
164 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(bigfrac) = bignumrust-analyzer cargo jsonschema 0.37.4 ext/numeric/bignum/::try_parse_bigfractionrust-analyzer cargo jsonschema 0.37.4 ext/numeric/bignum/try_parse_bigfraction().(n) {
165 // Check if denominator is 1 (integer value)
166 bigfrac.denomrust-analyzer cargo fraction 0.15.3 fraction/generic_fraction/impl#[`GenericFraction<T>`]denom().().is_none_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none_or().(Onerust-analyzer cargo num-traits 0.2.19 identities/One#::is_onerust-analyzer cargo num-bigint 0.4.6 biguint/impl#[BigUint][One]is_one().)
167 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(f) = n.as_f64rust-analyzer cargo serde_json 1.0.145 number/impl#[Number]as_f64().() {
168 // For numbers in f64 range
169 f.fractrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]fract().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialEq<Self>`]eq().0.
170 } else {
171 // Numbers that overflow to infinity (as_f64() returns None)
172 false
173 }
174 };
175 if is_integer {
176 self.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer#) || self.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#)
177 } else {
178 self.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#)
179 }
180 }
181 #[cfg(not(feature = "arbitrary-precision"))]
182 {
183 let is_integer = if n.is_i64() || n.is_u64() {
184 true
185 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(f) = n.as_f64() {
186 f.fract() == 0.
187 } else {
188 unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(
189 "Numbers always fit in u64/i64/f64 without arbitrary-precision"
190 )
191 };
192 if is_integer {
193 // Integer numbers match either Integer or Number types
194 self.contains(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer#) || self.contains(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#)
195 } else {
196 // Floating-point numbers only match Number type
197 self.contains(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#)
198 }
199 }
200 }
201 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(_) => self.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object#),
202 Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Stringrust-analyzer cargo serde_json 1.0.145 value/Value#String#(_) => self.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#),
203 }
204 }
205 /// Get an iterator over the types in this set.
206 #[inline]
207 #[must_use]
208 pub fn iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]iter().(&self) -> JsonTypeSetIteratorrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator# {
209 JsonTypeSetIteratorrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator# { setrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#set.: *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self }
210 }
211 }
212
213 impl IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for &JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet# {
214 type Itemrust-analyzer cargo jsonschema 0.37.4 types/impl#[`&JsonTypeSet`][IntoIterator]Item# = JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#;
215 type IntoIterrust-analyzer cargo jsonschema 0.37.4 types/impl#[`&JsonTypeSet`][IntoIterator]IntoIter# = JsonTypeSetIteratorrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#;
216 fn into_iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[`&JsonTypeSet`][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[`&JsonTypeSet`][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# {
217 self.iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]iter().()
218 }
219 }
220
221 impl IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet# {
222 type Itemrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet][IntoIterator]Item# = JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#;
223 type IntoIterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet][IntoIterator]IntoIter# = JsonTypeSetIteratorrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#;
224
225 fn into_iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# {
226 JsonTypeSetIteratorrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator# { setrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#set.: self }
227 }
228 }
229
230 impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet# {
231 fn fmtrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
232 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "(")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
233
234 let mut iter = self.iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]iter().();
235
236 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ty) = iter.nextrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]next().() {
237 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{ty}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
238 }
239
240 for ty in iter {
241 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, ", {ty}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
242 }
243
244 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, ")")
245 }
246 }
247
248 /// Iterator for traversing the types in a `JsonTypeSet`.
249 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
250 pub struct JsonTypeSetIteratorrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator# {
251 setrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#set.: JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#,
252 }
253
254 impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for JsonTypeSetIteratorrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator# {
255 type Itemrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]Item# = JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#;
256
257 fn nextrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
258 if self.setrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#set..0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().0 {
259 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
260 } else {
261 // Find the least significant bit that is set
262 let lsb = self.setrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#set..0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().self.setrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#set..0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0..wrapping_negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_neg().();
263
264 // Clear the least significant bit
265 self.setrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#set..0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAndAssign<Self>`]bitand_assign().&=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAndAssign<Self>`]bitand_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAndAssign<Self>`]bitand_assign().self.setrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#set..0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().1;
266
267 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::from_reprrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType]from_repr().(lsb))
268 }
269 }
270 fn size_hintrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) {
271 let count = self.setrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator#set..0rust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#0..count_onesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]count_ones().() as usize;
272 (count, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(count))
273 }
274 }
275
276 impl ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for JsonTypeSetIteratorrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSetIterator# {}
277
278 #[cfg(test)]
279 mod testsrust-analyzer cargo jsonschema 0.37.4 types/tests/ {
280 use superrust-analyzer cargo jsonschema 0.37.4 types/::*;
281 use serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::jsonrust-analyzer cargo serde_json 1.0.145 macros/json!;
282 use test_caserust-analyzer cargo test-case 3.3.1 crate/::test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:;
283
284 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:("array" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array#) ; "parse array")]
285 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:("boolean" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#) ; "parse boolean")]
286 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:("integer" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer#) ; "parse integer")]
287 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:("null" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null#) ; "parse null")]
288 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:("number" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#) ; "parse number")]
289 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:("object" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object#) ; "parse object")]
290 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:("string" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#) ; "parse string")]
291 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:("invalid" => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(()) ; "parse invalid")]
292 fn test_from_strrust-analyzer cargo jsonschema 0.37.4 types/tests/test_from_str().(input: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#, ()> {
293 JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::from_strrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType][FromStr]from_str().(input)
294 }
295
296 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array# => "array" ; "display array")]
297 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean# => "boolean" ; "display boolean")]
298 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer# => "integer" ; "display integer")]
299 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null# => "null" ; "display null")]
300 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number# => "number" ; "display number")]
301 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object# => "object" ; "display object")]
302 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String# => "string" ; "display string")]
303 fn test_displayrust-analyzer cargo jsonschema 0.37.4 types/tests/test_display().(json_type: JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
304 json_type.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()
305 }
306
307 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(null) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null# ; "value null")]
308 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(true) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean# ; "value boolean")]
309 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(42) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number# ; "value number int")]
310 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(1.12) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number# ; "value number float")]
311 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!("hello") => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String# ; "value string")]
312 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!([1, 2, 3]) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array# ; "value array")]
313 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"key": "value"}) => JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object# ; "value object")]
314 fn test_from_valuerust-analyzer cargo jsonschema 0.37.4 types/tests/test_from_value().(value: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) -> JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType# {
315 JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::fromrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonType][`From<&Value>`]from().(value)
316 }
317
318 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
319 fn test_insert_typesrust-analyzer cargo jsonschema 0.37.4 types/tests/test_insert_types().() {
320 let mut set = JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().();
321 set = set.insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#);
322 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#));
323 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#));
324
325 set = set.insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#);
326 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#));
327 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#));
328 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array#));
329 }
330
331 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(null), JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Nullrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Null#) => true ; "null type")]
332 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(true), JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#) => true ; "boolean type")]
333 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!("test"), JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#) => true ; "string type")]
334 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!([1,2]), JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Arrayrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Array#) => true ; "array type")]
335 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"a": 1}), JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object#) => true ; "object type")]
336 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(42), JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#) => true ; "number matches number")]
337 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(42), JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer#) => true ; "int matches integer")]
338 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(1.23), JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#) => true ; "float matches number")]
339 #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!(1.23), JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer#) => false ; "float doesn't match integer")]
340 fn test_contains_value_typerust-analyzer cargo jsonschema 0.37.4 types/tests/test_contains_value_type().(value: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, set: JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#) -> bool {
341 set.contains_value_typerust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains_value_type().(value)
342 }
343
344 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
345 fn test_remove_typesrust-analyzer cargo jsonschema 0.37.4 types/tests/test_remove_types().() {
346 let set = JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::allrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]all().().removerust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]remove().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#);
347 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#));
348 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.containsrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]contains().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Integerrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Integer#));
349 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]len().(), 6);
350
351 let empty = JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().();
352 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(empty.removerust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]remove().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#), empty);
353 }
354
355 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
356 fn test_lenrust-analyzer cargo jsonschema 0.37.4 types/tests/test_len().() {
357 let empty = JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().();
358 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(empty.is_emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]is_empty().());
359 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(empty.lenrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]len().(), 0);
360
361 let with_string = empty.insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#);
362 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().with_string.is_emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]is_empty().());
363 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(with_string.lenrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]len().(), 1);
364 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::allrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]all().().lenrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]len().(), 7);
365 }
366
367 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
368 fn test_debug_formatrust-analyzer cargo jsonschema 0.37.4 types/tests/test_debug_format().() {
369 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::defaultrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet][Default]default().()), "()");
370 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
371 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#)),
372 "(string)"
373 );
374 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
375 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
376 "{:?}",
377 JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().()
378 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#)
379 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#)
380 ),
381 "(number, string)"
382 );
383 }
384
385 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
386 fn test_empty_iteratorrust-analyzer cargo jsonschema 0.37.4 types/tests/test_empty_iterator().() {
387 let set = JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().();
388 let mut iter = set.iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]iter().();
389 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.nextrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
390 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.size_hintrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]size_hint().(), (0, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0)));
391 }
392
393 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
394 fn test_single_type_iteratorrust-analyzer cargo jsonschema 0.37.4 types/tests/test_single_type_iterator().() {
395 let set = JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().().insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#);
396 let mut iter = set.iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]iter().();
397 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.size_hintrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]size_hint().(), (1, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1)));
398 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.nextrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#));
399 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.size_hintrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]size_hint().(), (0, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0)));
400 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.nextrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
401 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.size_hintrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]size_hint().(), (0, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0)));
402 }
403
404 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
405 fn test_multiple_types_iteratorrust-analyzer cargo jsonschema 0.37.4 types/tests/test_multiple_types_iterator().() {
406 let set = JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::emptyrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]empty().()
407 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#)
408 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#)
409 .insertrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]insert().(JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#);
410
411 let types: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#> = set.iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
412 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(types.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3);
413 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(types.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Stringrust-analyzer cargo jsonschema 0.37.4 types/JsonType#String#));
414 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(types.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Numberrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Number#));
415 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(types.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Booleanrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Boolean#));
416
417 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]iter().().size_hintrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]size_hint().(), (3, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(3)));
418 }
419
420 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
421 fn test_all_types_iteratorrust-analyzer cargo jsonschema 0.37.4 types/tests/test_all_types_iterator().() {
422 let set = JsonTypeSetrust-analyzer cargo jsonschema 0.37.4 types/JsonTypeSet#::allrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]all().();
423
424 let types: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#> = set.iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
425 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(types.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 7);
426
427 let mut iter = set.iterrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSet]iter().();
428 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator#len().(), 7);
429 iter.nextrust-analyzer cargo jsonschema 0.37.4 types/impl#[JsonTypeSetIterator][Iterator]next().();
430 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator#len().(), 6);
431 }
432 }