Closed snproj closed 1 year ago
Made the changes as per above, also removed some extra parentheses in the generated get_size()
es that previous versions of this PR added in.
Edit: cleaning up diff
I've spent a few hours trying to get the diff as small as possible for the get_size()
and write_message()
parts, but the way that the code generation has changed in this PR means that eliminating all the differences is hard without a bunch of error-prone rewriting (that will eventually be reverted anyway when I make the PR to clean it up, since I already have the code for that). I don't know that it's impossible, but I didn't want to delay too long haha
If you're curious, the previous code had control flow in various parts that determine when to add a dereference into the code, which had built up over time into generating a bunch of &&*&**&
. This is the main source of diff, since I decided to rewrite the control flow to avoid these chains of references and dereferences; which makes it hard to artificially add them back in and shrink the diff.
Hopefully it's ok 🙏
I've spent a few hours trying to get the diff as small as possible for the
get_size()
andwrite_message()
parts, but the way that the code generation has changed in this PR means that eliminating all the differences is hard without a bunch of error-prone rewriting (that will eventually be reverted anyway when I make the PR to clean it up, since I already have the code for that). I don't know that it's impossible, but I didn't want to delay too long hahaIf you're curious, the previous code had control flow in various parts that determine when to add a dereference into the code, which had built up over time into generating a bunch of
&&*&**&
. This is the main source of diff, since I decided to rewrite the control flow to avoid these chains of references and dereferences; which makes it hard to artificially add them back in and shrink the diff.Hopefully it's ok pray
Yeah that is fine. There is a means to an end when it comes to reducing diff :)
https://github.com/libp2p/rust-libp2p/pull/3455 uses this branch and it works well, green light from our end!
Hi @snproj!
Can you do a version bump in the near future to include this change?
Thanks 🙏
Friendly ping. Could you cut a new release with this patch?
Continuation of #243
Since I no longer have access to the
ghpr-asia
fork that I made that PR with.impl
s should now only be generated when there are custom default fields--generate-getters
to generate getters for Proto2 fields with custom defaultsMinor notes:
const
fields from user input.#[derive(Debug, Default, PartialEq, Clone)]
to#[derive(Default, Debug, PartialEq, Clone)]
is there becauseDefault
is now being inserted programmatically into the list of derives, so it was best to simply append to the startFuture action
0
required
fields