Introspect Query
IQ (Introspect Query) lets you query standard structs, maps, enums, arrays, tuples, and nested combinations of these, to get deep values with a simple path syntax.
Values jut have to implement serde's Serialize trait.
Bot values and queries are dynamic, and can be provided at runtime.
See the IQ trait for all extract functions.
use IQ;
use ;
let car = Car ;
// extract "primitive" values as strings with extract_primitive
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!; // it's not a primitive
// extract any value as Json with extract_json
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// extract any deserializable value with extract_value
assert_eq!;
assert_eq!;
// You don't have to concat tokens if you build the path
assert_eq!;
// Extract functions are available both on the IQ trait and as standalone functions.
assert_eq!;
// If iq is compied with the "template" feature, you get a mini templating utility
let template = new;
assert_eq!;
IQ also works with enums, maps, and tuples: more tests can be found in libs.rs.