stats_path

Function stats_path 

Source
pub fn stats_path<'a>(value: &'a Value, path: &str) -> JsonField<'a>
Expand description

Build a JsonField view rooted at value and walk along the dotted path. An empty path returns the root unchanged so a caller writing stats_path(v, "").as_f64() (e.g. for a scalar-rooted stats response) hits the typed scalar accessor directly.

Mirrors super::Snapshot::var / super::SnapshotEntry::get in error shape: typos and missing keys surface as SnapshotError::FieldNotFound with the available sibling keys at the failing depth — the same diagnostic experience the BPF-snapshot side already provides. scx_stats payloads commonly nest layer / cgroup / cpu maps under top-level keys, so the dotted form "layers.batch.util" is the canonical drill-down for layered scheduler stats.