You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Still fairly new to rust so apologies if I'm misunderstanding and/or using lingo wrong.
Looking at the code for pointer it doesn't seem like it would support slices, i.e.
{
"test": {
"test2": [
"a",
"b",
"c"
]
}
}
I'd like to do something like: /test/test2/0..2 and also support nested structures. I've been trying to implement this myself (somewhat as a learning exercise, but also it would be useful), but I'm getting stuck on Value::Array needing owned values. I tried modifying the pointer function:
pointer
.split('/').skip(1).map(|x| x.replace("~1","/").replace("~0","~")).try_fold(self, |target, token| match target {Value::Object(map) => map.get(&token),Value::Array(list) => {let val = parse_index(&token).and_then(|x| list.get(x));if val.is_some(){return val
}else{returnSome(&parse_range(&token).and_then(|range| Value::from(&list[range])))},
_ => None,})
But I get a dangling reference. I understand why I get it, but I can't figure out a way around it. Would appreciate some guidance on how I'm approaching this, thanks in advance!
The text was updated successfully, but these errors were encountered:
Still fairly new to rust so apologies if I'm misunderstanding and/or using lingo wrong.
Looking at the code for
pointer
it doesn't seem like it would support slices, i.e.I'd like to do something like:
/test/test2/0..2
and also support nested structures. I've been trying to implement this myself (somewhat as a learning exercise, but also it would be useful), but I'm getting stuck onValue::Array
needing owned values. I tried modifying the pointer function:But I get a dangling reference. I understand why I get it, but I can't figure out a way around it. Would appreciate some guidance on how I'm approaching this, thanks in advance!
The text was updated successfully, but these errors were encountered: