Debian Codegraph @

src/impls/serde_json.rs

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 use crate::{
2 Clear, Collection, CollectionMut, CollectionRef, Get, GetKeyValue, GetMut, Keyed, KeyedRef,
3 Len, MapInsert, MapIter, MapIterMut, Remove, SimpleCollectionMut, SimpleCollectionRef,
4 SimpleKeyedRef,
5 };
6 use std::{borrow::Borrow, cmp::Ord, hash::Hash};
7
8 impl Collection for serde_json::Map<String, serde_json::Value> {
9 type Item = serde_json::Value;
10 }
11
12 impl CollectionRef for serde_json::Map<String, serde_json::Value> {
13 type ItemRef<'a> = &'a serde_json::Value where Self: 'a;
14
15 crate::covariant_item_ref!();
16 }
17
18 impl CollectionMut for serde_json::Map<String, serde_json::Value> {
19 type ItemMut<'a> = &'a mut serde_json::Value where Self: 'a;
20
21 crate::covariant_item_mut!();
22 }
23
24 impl SimpleCollectionRef for serde_json::Map<String, serde_json::Value> {
25 crate::simple_collection_ref!();
26 }
27
28 impl SimpleCollectionMut for serde_json::Map<String, serde_json::Value> {
29 fn into_mut<'a>(r: &'a mut serde_json::Value) -> &'a mut serde_json::Value
30 where
31 Self: 'a,
32 {
33 r
34 }
35 }
36
37 impl Keyed for serde_json::Map<String, serde_json::Value> {
38 type Key = String;
39 }
40
41 impl KeyedRef for serde_json::Map<String, serde_json::Value> {
42 type KeyRef<'a> = &'a String where Self: 'a;
43
44 crate::covariant_key_ref!();
45 }
46
47 impl SimpleKeyedRef for serde_json::Map<String, serde_json::Value> {
48 crate::simple_keyed_ref!();
49 }
50
51 impl Len for serde_json::Map<String, serde_json::Value> {
52 #[inline(always)]
53 fn len(&self) -> usize {
54 self.len()
55 }
56
57 #[inline(always)]
58 fn is_empty(&self) -> bool {
59 self.is_empty()
60 }
61 }
62
63 impl MapIter for serde_json::Map<String, serde_json::Value> {
64 type Iter<'a> = serde_json::map::Iter<'a> where Self: 'a;
65
66 #[inline(always)]
67 fn iter(&self) -> Self::Iter<'_> {
68 self.iter()
69 }
70 }
71
72 impl MapIterMut for serde_json::Map<String, serde_json::Value> {
73 type IterMut<'a> = serde_json::map::IterMut<'a> where Self: 'a;
74
75 #[inline(always)]
76 fn iter_mut(&mut self) -> Self::IterMut<'_> {
77 self.iter_mut()
78 }
79 }
80
81 impl<'a, Q: ?Sized> Get<&'a Q> for serde_json::Map<String, serde_json::Value>
82 where
83 String: Borrow<Q>,
84 Q: Ord + Hash,
85 {
86 #[inline(always)]
87 fn get(&self, q: &'a Q) -> Option<&serde_json::Value> {
88 self.get(q)
89 }
90 }
91
92 impl<'a, Q: ?Sized> GetMut<&'a Q> for serde_json::Map<String, serde_json::Value>
93 where
94 String: Borrow<Q>,
95 Q: Ord + Hash,
96 {
97 #[inline(always)]
98 fn get_mut(&mut self, q: &'a Q) -> Option<&mut serde_json::Value> {
99 self.get_mut(q)
100 }
101 }
102
103 impl<'a, Q: ?Sized> GetKeyValue<&'a Q> for serde_json::Map<String, serde_json::Value>
104 where
105 String: Borrow<Q>,
106 Q: Ord + Hash,
107 {
108 #[inline(always)]
109 #[deny(unconditional_recursion)]
110 fn get_key_value(&self, q: &'a Q) -> Option<(&String, &serde_json::Value)> {
111 self.get_key_value(q)
112 }
113 }
114
115 impl MapInsert<String> for serde_json::Map<String, serde_json::Value> {
116 type Output = Option<serde_json::Value>;
117
118 #[inline(always)]
119 fn insert(&mut self, key: String, value: serde_json::Value) -> Option<serde_json::Value> {
120 self.insert(key, value)
121 }
122 }
123
124 impl<'a, Q: ?Sized> Remove<&'a Q> for serde_json::Map<String, serde_json::Value>
125 where
126 String: Borrow<Q>,
127 Q: Ord + Hash,
128 {
129 #[inline(always)]
130 fn remove(&mut self, key: &'a Q) -> Option<serde_json::Value> {
131 self.remove(key)
132 }
133 }
134
135 impl Clear for serde_json::Map<String, serde_json::Value> {
136 #[inline(always)]
137 fn clear(&mut self) {
138 self.clear()
139 }
140 }