-
Notifications
You must be signed in to change notification settings - Fork 109
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
Rust SDK: no more reducer args structs #2036
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Well, at least, the reducer arg structs are no longer user-facing. They're still generated and used internally, for ser/de. This mostly involves a lot of uninteresting shuffling things around in the codegen. One notable piece is that we must now be more precise about what names are re-exported by the generated `mod.rs`. The (now-internal) arg structs are `pub(super)` where `super` is that `mod.rs`, but the previous system of emitting `pub use foo_reducer::*;` would expose it anyways, causing the exact same name conflict that we're trying to avoid here. As such, this commit includes a rework of `print_module_reexports` which avoids glob reexports for types and reducers. Tables still use glob re-exports, since reexporting callback ids would otherwise be complicated.
Is this because we don't support enum variants with fields in our macros? |
RReverser
reviewed
Dec 3, 2024
RReverser
reviewed
Dec 3, 2024
I thought rustc was rejecting empty struct-like variants, but it turns out that was the SATS `derive(Serialize, Deserialize)` macros, which we don't use anyways for the `enum Reducer`. Oh well; generating the unit structs is better, I just avoided it because it was more work, and now that work is done, so we might as well keep it.
RReverser
reviewed
Dec 4, 2024
There's a few things going on here:
I will add comments to this effect. |
RReverser
approved these changes
Dec 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of Changes
Well, at least, the reducer arg structs are no longer user-facing. They're still generated and used internally, for ser/de.
This mostly involves a lot of uninteresting shuffling things around in the codegen. One notable piece is that we must now be more precise about what names are re-exported by the generated
mod.rs
. The (now-internal) arg structs arepub(super)
wheresuper
is thatmod.rs
, but the previous system of emittingpub use foo_reducer::*;
would expose it anyways, causing the exact same name conflict that we're trying to avoid here. As such, this commit includes a rework ofprint_module_reexports
which avoids glob reexports for types and reducers. Tables still use glob re-exports,since reexporting callback ids would otherwise be complicated.
API and ABI breaking changes
Minor incompatible change to the Rust SDK: code which inspects
ReducerEvent
s sees one less layer of nesting. Some patterns may need to be rewritten, but this should be easy.Expected complexity level and risk
1: this code is well-tested, and the majority of this diff is autogenerated.
Testing
Describe any testing you've done, and any testing you'd like your reviewers to do,
so that you're confident that all the changes work as expected!