Fix problems with global attributes and implements getter/setter for Option<T> #83
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I took a closer at the problems that occur if global and local attributes are used that result in the same function name (as mentioned in #68 and #74).
In the following I will briefly explain my proposal.
#[getset(get_copy = "pub")]
is specified but notderive(CopyGetters)
#67 automatically and avoids breaking changesHashMap<GetSetAttr, Meta>
) and mutually exclusive parameters have to be equal and share the same hash. This allows to parse all global parameter to begin and then for each field the local parameters are added to a clone of the global HashMap.Two parameters are compared against each other based on their
identifier()
that is used infn eq()
andfn hash()
.Otherwise, one could also directly use the later function name for comparison, this should be equivalent.
3. I have implemented the proposal of #78 with get_option and also set_option. This would make my other PR obsolete.
I haven't touched any of the existing functions in order to not introduce any breaking changes. This unfortunately leads to some boilerplate code at the moment, but I hope this is acceptable.
I would really appreciate to hear your opinion about this PR. If you agree with the ideas, I'd be happy to write some new tests and I could also add some new examples to the Readme.