-
Notifications
You must be signed in to change notification settings - Fork 30
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
Support optional generation #7
Conversation
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
This is required by tikv/raft-rs#218 |
QAQ |
pub enum GenOpt { | ||
All, | ||
NoImplMessage, | ||
bitflags! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt that whether we really need so many options or not. I only like MSG
, CLR
, HAS
, and TKE
in person. NEW
can be replaced with Default
, and GET
, SET
and MUT
are useless because we can touch the internal fields directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The process of eliminating wrapper usages should be step by step and this (relatively) fine grained config can help us do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or can we merge these 3 as one option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hicqu I guess you've missed the point of this PR. What I was trying to do is to introduce a mechanism which can gradually reduce the wrapper functions. The ultimate goal is passing a GenOpt::empty()
to the wrapper generator. Currently we're generating all of them so we can quickly launch prost support and my plan is to replace all usages of the generated wrappers with direct access. These options allow me to eliminate the generated wrappers step by step. That's all. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So after all wrappers are removed, should we remove these options also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can! And I believe we're supposed to do so.
@nrc PTAL. kvproto is blocked on raft-rs, and raft-rs is blocked on here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, a few small comments inline
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
@nrc something else to consider: We may need to provide an option that "generates getters that are not of primitive types". |
Because for non-primitive types, they become |
I start doubting the idea of eliminating all getters. I'm here to propose another design of this library (unrelated to this PR):
PTAL @nrc |
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
Support generating only selected family of functions.