@@ -70,6 +70,7 @@ mod serde_json_value {
70
70
71
71
/// this is mutually recursive with `serialize_value`
72
72
fn serialize_array < W : Write > ( array : & Vec < serde_json:: Value > , writer : & mut W ) -> Result < ( ) > {
73
+ // The implementation here is very similar to that of Vec<V>.
73
74
writer. write_all (
74
75
& ( u32:: try_from ( array. len ( ) ) . map_err ( |_| ErrorKind :: InvalidData ) ?) . to_le_bytes ( ) ,
75
76
) ?;
@@ -84,7 +85,7 @@ mod serde_json_value {
84
85
map : & serde_json:: Map < String , serde_json:: Value > ,
85
86
writer : & mut W ,
86
87
) -> Result < ( ) > {
87
- // The implementation here is identical to that of BTreeMap<String, serde_json::Value >.
88
+ // The implementation here is very similar to that of BTreeMap<K, V >.
88
89
u32:: try_from ( map. len ( ) )
89
90
. map_err ( |_| ErrorKind :: InvalidData ) ?
90
91
. serialize ( writer) ?;
@@ -179,6 +180,7 @@ mod serde_json_value {
179
180
180
181
/// this is mutually recursive with `deserialize_value`
181
182
fn deserialize_array < R : Read > ( reader : & mut R ) -> Result < Vec < serde_json:: Value > > {
183
+ // The implementation here is very similar to that of Vec<V>.
182
184
let len = u32:: deserialize_reader ( reader) ?;
183
185
let mut result = Vec :: with_capacity ( hint_cautious :: < ( String , serde_json:: Value ) > ( len) ) ;
184
186
for _ in 0 ..len {
@@ -192,9 +194,10 @@ mod serde_json_value {
192
194
fn deserialize_map < R : Read > (
193
195
reader : & mut R ,
194
196
) -> Result < serde_json:: Map < String , serde_json:: Value > > {
195
- // The implementation here is identical to that of BTreeMap<String, serde_json::Value >.
197
+ // The implementation here is very similar to that of BTreeMap<K, V >.
196
198
197
199
let vec: Vec < ( String , serde_json:: Value ) > = {
200
+ // The implementation here is very similar to that of Vec<(K, V)>.
198
201
let len = u32:: deserialize_reader ( reader) ?;
199
202
let mut result =
200
203
Vec :: with_capacity ( hint_cautious :: < ( String , serde_json:: Value ) > ( len) ) ;
0 commit comments