Skip to main content

Module utils

Module utils 

Source
Expand description

§Utility Functions Module

Path-based read/write helpers for the datavalue::OwnedDataValue tree that backs Message::context. The same dot-path syntax that worked on serde_json::Value works here unchanged — including #-prefix escapes for numeric object keys.

Functions§

get_nested_value
Get a reference to the value at path, walking the tree.
get_nested_value_cloned
Clone the value at path, returning None if the path is unresolvable.
get_nested_value_parts
Same as get_nested_value but consumes a pre-split slice of path parts. Parts retain the original # prefix; strip_hash_prefix is applied at lookup time so the #20 → “force object key 20” semantics still hold.
set_nested_value
Set the value at path, creating intermediate containers as needed.
set_nested_value_parts
Same as set_nested_value but consumes a pre-split slice of path parts. Parts retain the original # prefix; strip_hash_prefix is applied at use time. Crucially, the “is the NEXT segment an array index?” decision looks at the raw (unstripped) parts[i+1]#20 parses as non-numeric, so the child container is an Object (key “20”), not an Array.