-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_concurrent values #930
Conversation
KM8Oz
commented
Sep 11, 2022
I suspect this won't be merged as-is. It is a rather opinionated feature for such a fundamental crate. Also, it's not ready needed: |
I made some changes on it so it will fit my needs. Thanks overall
…On Tue, May 23, 2023, 19:28 kangalio ***@***.***> wrote:
I suspect this won't be merged as-is. It is a rather opinionated feature
for such a fundamental crate.
Also, it's not ready needed: object["A"]["B"]["C"] works.
—
Reply to this email directly, view it on GitHub
<#930 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKPIGZMNNOIJH3MFGYTD53XHT6WJANCNFSM6AAAAAAQJ4LUFM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
/// assert_eq!(*array.get_concurrent("A.B.C").unwrap(), json!("foo")); // true | ||
/// assert_eq!(*array.get_concurrent("A.B.C.D").unwrap(), json!("foo")); // true also | ||
/// ``` | ||
pub fn get_concurrent<I: &str>(&self, pattern: I) -> Option<Value> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not compile.
error: expected a trait, found type
--> src/value/mod.rs:317:30
|
317 | pub fn get_concurrent<I: &str>(&self, pattern: I) -> Option<Value> {
| ^^^^
/// ``` | ||
pub fn get_concurrent<I: &str>(&self, pattern: I) -> Option<Value> { | ||
let rest: Value = Value::default(); | ||
for item in list.split(".").into_iter() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not compile.
error[E0425]: cannot find value `list` in this scope
--> src/value/mod.rs:319:21
|
319 | for item in list.split(".").into_iter() {
| ^^^^ not found in this scope
pub fn get_concurrent<I: &str>(&self, pattern: I) -> Option<Value> { | ||
let rest: Value = Value::default(); | ||
for item in list.split(".").into_iter() { | ||
let rest = match self.0.get(item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not compile.
error[E0609]: no field `0` on type `&Value`
--> src/value/mod.rs:320:35
|
320 | let rest = match self.0.get(item) {
| ^ unknown field
None => Some(&self.0), | ||
}; | ||
} | ||
Some(rest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function would always return Some(Value::Null)
, which does not seem useful.
This looks like an ad-hoc redesign of JSON Pointer (RFC 6901). I would prefer not to include this in serde_Json. |