Debian Codegraph @

src/json/value.rs

raw symbols SCIP
1 use serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#;
2 use serde_jsonrust-analyzer cargo serde_json 1.0.114 crate/::valuerust-analyzer cargo serde_json 1.0.114 value/::{to_valuerust-analyzer cargo serde_json 1.0.114 value/to_value()., Valuerust-analyzer cargo serde_json 1.0.114 value/Value# as Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#};
3
4 pub(craterust-analyzer cargo handlebars 5.1.2 crate/) static DEFAULT_VALUErust-analyzer cargo handlebars 5.1.2 json/value/DEFAULT_VALUE.: Jsonrust-analyzer cargo serde_json 1.0.114 value/Value# = Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Nullrust-analyzer cargo serde_json 1.0.114 value/Value#Null#;
5
6 /// A JSON wrapper designed for handlebars internal use case
7 ///
8 /// * Constant: the JSON value hardcoded into template
9 /// * Context: the JSON value referenced in your provided data context
10 /// * Derived: the owned JSON value computed during rendering process
11 ///
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:)]
13 pub enum ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#<'rc> {
14 Constantrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Constant#(&'rc Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#),
15 Derivedrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Derived#(Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#),
16 // represents a json reference to context value, its full path
17 Contextrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Context#(&'rc Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#, 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#>),
18 Missingrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Missing#,
19 }
20
21 impl<'rc> ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#<'rc> {
22 /// get the JSON reference
23 pub fn as_jsonrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]as_json().(&self) -> &Jsonrust-analyzer cargo serde_json 1.0.114 value/Value# {
24 match self {
25 ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#::Constantrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Constant#(j) => j,
26 ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#::Derivedrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Derived#(ref j) => j,
27 ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#::Contextrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Context#(j, _) => j,
28 _ => &DEFAULT_VALUErust-analyzer cargo handlebars 5.1.2 json/value/DEFAULT_VALUE.,
29 }
30 }
31
32 pub fn renderrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]render().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
33 self.as_jsonrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]as_json().().renderrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonRender]render().()
34 }
35
36 pub fn is_missingrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]is_missing().(&self) -> bool {
37 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self, ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#::Missingrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Missing#)
38 }
39
40 pub fn into_derivedrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]into_derived().(self) -> ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#<'rc> {
41 let v = self.as_jsonrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]as_json().();
42 ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#::Derivedrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Derived#(v.clonerust-analyzer cargo serde_json 1.0.114 value/impl#[Value][Clone]clone().())
43 }
44
45 pub fn context_pathrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]context_path().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&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#>> {
46 match self {
47 ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#::Contextrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Context#(_, ref p) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(p),
48 _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
49 }
50 }
51 }
52
53 impl<'reg: 'rc, 'rc> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#> for ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#<'rc> {
54 fn fromrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`][`From<Json>`]from().(v: Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#) -> ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#<'rc> {
55 ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#::Derivedrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#Derived#(v)
56 }
57 }
58
59 /// Json wrapper that holds the Json value and reference path information
60 ///
61 #[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:)]
62 pub struct PathAndJsonrust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#<'rc> {
63 relative_pathrust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#relative_path.: 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#>,
64 valuerust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#value.: ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#<'rc>,
65 }
66
67 impl<'rc> PathAndJsonrust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#<'rc> {
68 pub fn newrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`PathAndJson<'rc>`]new().(relative_path: 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#>, value: ScopedJsonrust-analyzer cargo handlebars 5.1.2 json/value/ScopedJson#<'rc>) -> PathAndJsonrust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#<'rc> {
69 PathAndJsonrust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson# {
70 relative_pathrust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#relative_path.,
71 valuerust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#value.,
72 }
73 }
74
75 /// Returns relative path when the value is referenced
76 /// If the value is from a literal, the path is `None`
77 pub fn relative_pathrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`PathAndJson<'rc>`]relative_path().(&self) -> 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#> {
78 self.relative_pathrust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#relative_path..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
79 }
80
81 /// Returns full path to this value if any
82 pub fn context_pathrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`PathAndJson<'rc>`]context_path().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&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#>> {
83 self.valuerust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#value..context_pathrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]context_path().()
84 }
85
86 /// Returns the value
87 pub fn valuerust-analyzer cargo handlebars 5.1.2 json/value/impl#[`PathAndJson<'rc>`]value().(&self) -> &Jsonrust-analyzer cargo serde_json 1.0.114 value/Value# {
88 self.valuerust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#value..as_jsonrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]as_json().()
89 }
90
91 /// Test if value is missing
92 pub fn is_value_missingrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`PathAndJson<'rc>`]is_value_missing().(&self) -> bool {
93 self.valuerust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#value..is_missingrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]is_missing().()
94 }
95
96 pub fn renderrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`PathAndJson<'rc>`]render().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
97 self.valuerust-analyzer cargo handlebars 5.1.2 json/value/PathAndJson#value..renderrust-analyzer cargo handlebars 5.1.2 json/value/impl#[`ScopedJson<'rc>`]render().()
98 }
99 }
100
101 /// Render Json data with default format
102 pub trait JsonRenderrust-analyzer cargo handlebars 5.1.2 json/value/JsonRender# {
103 fn renderrust-analyzer cargo handlebars 5.1.2 json/value/JsonRender#render().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
104 }
105
106 pub trait JsonTruthyrust-analyzer cargo handlebars 5.1.2 json/value/JsonTruthy# {
107 fn is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/JsonTruthy#is_truthy().(&self, include_zero: bool) -> bool;
108 }
109
110 impl JsonRenderrust-analyzer cargo handlebars 5.1.2 json/value/JsonRender# for Jsonrust-analyzer cargo serde_json 1.0.114 value/Value# {
111 fn renderrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonRender]render().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
112 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
113 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Stringrust-analyzer cargo serde_json 1.0.114 value/Value#String#(ref s) => s.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
114 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Boolrust-analyzer cargo serde_json 1.0.114 value/Value#Bool#(i) => i.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
115 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Numberrust-analyzer cargo serde_json 1.0.114 value/Value#Number#(ref n) => n.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
116 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Nullrust-analyzer cargo serde_json 1.0.114 value/Value#Null# => "".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(),
117 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Arrayrust-analyzer cargo serde_json 1.0.114 value/Value#Array#(ref a) => {
118 let mut buf = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
119 buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('[');
120 for (i, value) in a.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
121 buf.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(value.renderrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonRender]render().().as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AsRef<str>`]as_ref().());
122
123 if i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().a.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1 {
124 buf.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(", ");
125 }
126 }
127 buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(']');
128 buf
129 }
130 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Objectrust-analyzer cargo serde_json 1.0.114 value/Value#Object#(_) => "[object]".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(),
131 }
132 }
133 }
134
135 /// Convert any serializable data into Serde Json type
136 pub fn to_jsonrust-analyzer cargo handlebars 5.1.2 json/value/to_json().<T>(src: T) -> Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#
137 where
138 T: Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#,
139 {
140 to_valuerust-analyzer cargo serde_json 1.0.114 value/to_value().(src).unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_default().()
141 }
142
143 pub fn as_stringrust-analyzer cargo handlebars 5.1.2 json/value/as_string().(src: &Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str> {
144 src.as_strrust-analyzer cargo serde_json 1.0.114 value/impl#[Value]as_str().()
145 }
146
147 impl JsonTruthyrust-analyzer cargo handlebars 5.1.2 json/value/JsonTruthy# for Jsonrust-analyzer cargo serde_json 1.0.114 value/Value# {
148 fn is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(&self, include_zero: bool) -> bool {
149 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
150 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Boolrust-analyzer cargo serde_json 1.0.114 value/Value#Bool#(ref i) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().i,
151 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Numberrust-analyzer cargo serde_json 1.0.114 value/Value#Number#(ref n) => {
152 if include_zero {
153 n.as_f64rust-analyzer cargo serde_json 1.0.114 number/impl#[Number]as_f64().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|f| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]is_nan().()).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false)
154 } else {
155 // there is no inifity in json/serde_json
156 n.as_f64rust-analyzer cargo serde_json 1.0.114 number/impl#[Number]as_f64().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|f| f.is_normalrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]is_normal().()).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false)
157 }
158 }
159 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Nullrust-analyzer cargo serde_json 1.0.114 value/Value#Null# => false,
160 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Stringrust-analyzer cargo serde_json 1.0.114 value/Value#String#(ref i) => !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().i.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().(),
161 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Arrayrust-analyzer cargo serde_json 1.0.114 value/Value#Array#(ref i) => !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().i.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().(),
162 Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Objectrust-analyzer cargo serde_json 1.0.114 value/Value#Object#(ref i) => !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().i.is_emptyrust-analyzer cargo serde_json 1.0.114 map/impl#[`Map<String, Value>`]is_empty().(),
163 }
164 }
165 }
166
167 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
168 fn test_json_renderrust-analyzer cargo handlebars 5.1.2 json/value/test_json_render().() {
169 let raw = "<p>Hello world</p>\n<p thing=\"hello\"</p>";
170 let thing = Jsonrust-analyzer cargo serde_json 1.0.114 value/Value#::Stringrust-analyzer cargo serde_json 1.0.114 value/Value#String#(raw.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
171
172 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(raw, thing.renderrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonRender]render().());
173 }
174
175 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
176 fn test_json_number_truthyrust-analyzer cargo handlebars 5.1.2 json/value/test_json_number_truthy().() {
177 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/;
178 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(16i16).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(false));
179 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(16i16).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(true));
180
181 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(0i16).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(true));
182 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().jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(0i16).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(false));
183
184 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(1.0f64).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(false));
185 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(1.0f64).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(true));
186
187 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(16i16)).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(false));
188 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(16i16)).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(true));
189
190 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().jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# as Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<i16>).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(false));
191 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().jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# as Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<i16>).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(true));
192
193 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().jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/NAN.).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(false));
194 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().jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!(f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/NAN.).is_truthyrust-analyzer cargo handlebars 5.1.2 json/value/impl#[Json][JsonTruthy]is_truthy().(true));
195
196 // there is no infinity in json/serde_json
197 // assert!(json!(f64::INFINITY).is_truthy(false));
198 // assert!(json!(f64::INFINITY).is_truthy(true));
199
200 // assert!(json!(f64::NEG_INFINITY).is_truthy(false));
201 // assert!(json!(f64::NEG_INFINITY).is_truthy(true));
202 }