pub fn lookup_dotted_path<'a>(tree: &'a Table, path: &str) -> Option<&'a Value>Expand description
Walk a TOML table by a dotted path, returning the value at
the leaf or None if any segment is missing or steps through
a non-table. Used by workspace/configuration to look up
server-namespaced keys (e.g. "rust-analyzer.cargo.features"
walks tree["rust-analyzer"]["cargo"]["features"]).
ยงExamples
use lattice_config::lookup_dotted_path;
let tree: toml::Table = "[rust-analyzer.cargo]\nfeatures = \"all\"".parse().unwrap();
let v = lookup_dotted_path(&tree, "rust-analyzer.cargo.features");
assert_eq!(v.and_then(|v| v.as_str()), Some("all"));
// Stepping through a non-table, or a missing segment, is `None`.
assert!(lookup_dotted_path(&tree, "rust-analyzer.cargo.features.x").is_none());
assert!(lookup_dotted_path(&tree, "rust-analyzer.check").is_none());