| Crates.io | path-value |
| lib.rs | path-value |
| version | 0.1.5 |
| created_at | 2020-08-21 08:03:57.348121+00 |
| updated_at | 2021-07-24 09:22:06.195138+00 |
| description | Universal type and access property(s) by path |
| homepage | |
| repository | https://github.com/honsunrise/path-value |
| max_upload_size | |
| id | 279072 |
| size | 140,032 |
path-value is a Rust universal type library used to access property(s) in Value by path.
use path_value::Value;
fn main() {
let mut value_origin = Value::default();
value_origin.set("/test/bool", true).unwrap();
value_origin.set("/test/str", "i am string").unwrap();
println!("{}", value_origin.get::<bool, _, _>("/test/bool").unwrap().unwrap());
println!("{}", value_origin.get::<String, _, _>("/test/str").unwrap().unwrap());
println!("\nAfter merge\n");
let mut value_new = Value::default();
value_new.set("/test/bool", false).unwrap();
value_new.set("/test/i32", 1000_i32).unwrap();
value_origin.merge(value_new).unwrap();
println!("{}", value_origin.get::<bool, _, _>("/test/bool").unwrap().unwrap());
println!("{}", value_origin.get::<String, _, _>("/test/str").unwrap().unwrap());
println!("{}", value_origin.get::<i32, _, _>("/test/i32").unwrap().unwrap());
}
/<path>/<path>[index]

represents access to an array of elements