-
Notifications
You must be signed in to change notification settings - Fork 58
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 macros for include ttrpc gen code #269
base: master
Are you sure you want to change the base?
Conversation
Give macros for more convenient to use, if it is in Default dir Signed-off-by: jokemanfire <[email protected]>
/// This is only work on out_dir not set. | ||
/// ```rust,ignore | ||
/// mod protocals { | ||
/// include_ttrpc!("helloworld"); |
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.
Then how to include helloworld.rs
?
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.
What I think is that this macro only provides the code for *_ttrpc.rs generated by ttrpc-code gen The generated proto's rs code is not within the scope of this macro.
@jokemanfire I have a question, how useful is the development of these API? After all, the more open the API is, the more disadvantageous it is for us to maintain compatibility. |
What I add is for the interface , "include!(concat!(env!("OUT_DIR"), "/mod.rs"));" is ugly , and is not friendly to caller. In tonic they provide a marco which I think it is useful and more friendly |
The sentence The macro include_ttrpc is not general for it only works for *_ttrpc.rs in OUT_DIR. Still I don't think we need these two macros. welcome to discuss, thanks. |
At that time, adding two interfaces was for the convenience of one of my projects, May be we can use
If it is more greater? |
This scenario is that I do not want to keep the code generated by codegen, and developers do not need to pay attention to the code generated by ttrpc codegen. At this point, the code is generated in the directory of the OUT_SIR environment variable. Then I want to reference this * _ttrpc.rs code. I have to include a rather ugly code |
Give macros for more convenient to use, if it is in Default dir