Trait bilibili_api_rs::Lodash
source · pub trait Lodash {
// Required method
fn at(&self, paths: Value) -> Self;
}
Expand description
Lodash-like get helper, implemented for serde_json
use bilibili_api_rs::Lodash;
let v = json!({
"following": [ {
"mid": 1472906636,
"name": "ywwuyi",
}, {
"mid": 15810,
"name": "Mr.Quin",
}],
});
assert_eq!(v.at(json!(["following", 0, "mid"])), json!(1472906636));
assert_eq!(v["following"].at(json!([
[0, "name"],
[1, "name"],
])),
json!(["ywwuyi", "Mr.Quin"]));
Required Methods§
Object Safety§
This trait is not object safe.