pub trait Index: Sealed { }Expand description
A type that can be used to index into a serde_encom::Value.
The get and get_mut methods of Value accept any type that
implements Index, as does the square-bracket indexing operator. This
trait is implemented for strings which are used as the index into an EnCom
map, and for usize which is used as the index into an EnCom array.
This trait is sealed and cannot be implemented for types outside of
serde_encom.
§Examples
let data = encom_from_json!({ "inner": [1, 2, 3] });
// Data is an EnCom map so it can be indexed with a string.
let inner = &data["inner"];
// Inner is an EnCom array so it can be indexed with an integer.
let first = &inner[0];
assert_eq!(first, 1);