MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / msgpack_is_compact

Function msgpack_is_compact

nodedb/src/engine/document/store/extract.rs:191–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189
190 #[test]
191 fn msgpack_is_compact() {
192 let doc = serde_json::json!({
193 "name": "Alice Wonderland",
194 "age": 30,
195 "tags": ["admin", "user"],
196 "active": true
197 });
198
199 let json_bytes = serde_json::to_vec(&doc).unwrap();
200 let rmpv_val = json_to_msgpack(&doc);
201 let mut msgpack_bytes = Vec::new();
202 rmpv::encode::write_value(&mut msgpack_bytes, &rmpv_val).unwrap();
203
204 assert!(
205 msgpack_bytes.len() < json_bytes.len(),
206 "msgpack {} bytes vs json {} bytes",
207 msgpack_bytes.len(),
208 json_bytes.len()
209 );
210 }
211
212 #[test]
213 fn json_msgpack_roundtrip_preserves_types() {

Callers

nothing calls this directly

Calls 1

json_to_msgpackFunction · 0.70

Tested by

no test coverage detected