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

Function mp_obj

nodedb/src/engine/kv/engine.rs:507–513  ·  view source on GitHub ↗

Helper: create a MessagePack-encoded JSON object value.

(fields: &[(&str, &str)])

Source from the content-addressed store, hash-verified

505
506 /// Helper: create a MessagePack-encoded JSON object value.
507 fn mp_obj(fields: &[(&str, &str)]) -> Vec<u8> {
508 let obj: serde_json::Map<String, serde_json::Value> = fields
509 .iter()
510 .map(|(k, v)| (k.to_string(), serde_json::Value::String(v.to_string())))
511 .collect();
512 nodedb_types::json_to_msgpack(&serde_json::Value::Object(obj)).unwrap()
513 }
514
515 #[test]
516 fn register_index_and_lookup() {

Callers 5

index_maintained_on_putFunction · 0.85
index_cleaned_on_deleteFunction · 0.85
write_amp_trackingFunction · 0.85

Calls 4

collectMethod · 0.80
to_stringMethod · 0.80
json_to_msgpackFunction · 0.50
iterMethod · 0.45

Tested by 5

index_maintained_on_putFunction · 0.68
index_cleaned_on_deleteFunction · 0.68
write_amp_trackingFunction · 0.68