-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add syn_mid::ImplItemMethod #19
Comments
What APIs do you actually need? ImplItemMethod (struct) + ImplItem (enum, 1 variant) + ItemImpl (struct) + Item (enum, 2 variant)?
I'm not sure what this means. You need the full feature of syn to let syn parse it. Or does that mean treating anything other than a method as a variant like FWIW, as rustc syntactically accepts top-level functions without body, we can also change ItemFn. (aside from we want to do that or not) |
Yes, I think this is enough. I started an implementation within syn_mid but I got bogged down when I started copying and pasting a lot of parser code from syn. And it looks like there is some overlap between the code to parse ImplItemMethod and the existing code in syn_mid that parses ItemFn.
Yes, this is fine - I mean syn_mid provides ItemImplMethod (and ImplItem, ItemImpl and Item), and other variants within ImplItem are fully parsed and exposed in terms of syn's types. ImplItemConst is the other variant within ImplItem that could contain a non-trivial body, so it could be another candidate for special handling by syn_mid, but I haven't yet encountered any large The background to this is as a speedup for crates like pyo3 that parse |
I'm a bit confused about this because one of the purposes of this crate was for users who don't want to depend on the full feature of syn, but want to parse functions. That said, if we do it under the feature flag, it might be fine. |
My use case for this crate is saving compile time and forward compatibility with rust syntax by not parsing the function bodies. So I prefer completeness of structs over compile time benefits of removing them. And I think a feature flag is fine. |
Ok, I would accept PRs to implement these items under the feature flag. |
For parsing
impl
blocks without method bodies.Also adds syn_mid::ImplItem and syn_mid::Item, with the types other than ImplItemMethod delegated to
syn
.The text was updated successfully, but these errors were encountered: