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
I think the built-in support for bracket/brace/paren delimited things is great. I have been thinking about seeing if I could submit a PR that would make the following "just work":
In other words, I want to extend derive_syn_parse so that any Vec containing a type that implements Parse is automatically digestible by derive_syn_parse.
The way this would work under the hood is in the expansion, we would automatically output the following for such fields within the Parse implementation:
letmut #field_name = Vec::new();while(some condition relating to the subsequent field){
#field_name.push(input.parse()?);}
Would you be interested in such a PR and/or do you think something like this would be feasible @sharnoff?
The text was updated successfully, but these errors were encountered:
Late reply here as well, as I'm going through everything now.
Any automatic handling of Vec<T> would have to be syntax-based, because derive-syn-parse, as a proc macro crate, cannot expose any other public items (unless things have changed since I first wrote this).
If we try, we get:
error: `proc-macro` crate types currently cannot export any items other than functions tagged with `#[proc_macro]`, `#[proc_macro_derive]`, or `#[proc_macro_attribute]`
(Incidentally, this is also why we don't have automated handling of Delimited<P, T>)
That said, I think it'd make sense to provide this behavior built-in. I'd be happy to have it under #[repeat] or something similar (bikeshedding welcome! you probably use this more than I do 😅).
Yeah I mean I think something around this would definitely be helpful. I've run into this same problem making my own parsing library quoth recently, and I don't have a perfect solution there either
I think the built-in support for bracket/brace/paren delimited things is great. I have been thinking about seeing if I could submit a PR that would make the following "just work":
In other words, I want to extend
derive_syn_parse
so that anyVec
containing a type that implementsParse
is automatically digestible byderive_syn_parse
.The way this would work under the hood is in the expansion, we would automatically output the following for such fields within the Parse implementation:
Would you be interested in such a PR and/or do you think something like this would be feasible @sharnoff?
The text was updated successfully, but these errors were encountered: