Skip to content

v0.1.2-next.48

@filipeforattini filipeforattini tagged this 10 Apr 18:06
UnifiedStore::set_config_tree(prefix, json) flattens a JSON tree into
dot-notation KV pairs and inserts them all at once into red_config.

Before (8 individual kv() calls):
  kv("red.system.pid", Value::UnsignedInteger(sys.pid));
  kv("red.system.cpu_cores", Value::UnsignedInteger(sys.cpu_cores));
  ...

After (1 call with JSON):
  store.set_config_tree("red.system", &json!({
      "pid": sys.pid,
      "cpu_cores": sys.cpu_cores,
      ...
  }));

Available for any code that needs to write config subtrees.
Assets 2
Loading