Comments (1)
Hi! This sounds like a good idea to me; I also personally prefer the proto comments approach. I can think of some pros and cons to proto comments:
Pros
Compared to build flags, as you say they look easier to maintain and work with. We can:
- Carry Rust-specific information inside proto files without affecting other proto compilers
- Place this information more naturally next to the messages they affect, rather than having to remember to dump them all in one go each time before calling
pb-rs
.
Con
On the other hand, one downside I can think of for proto comments is that we have to actually modify the proto file itself. Proto files that at some point have been touched by a user of pb-rs
may now be marked with what is essentially noise to users of literally any other compiler (even other Rust proto compilers).
Whether this will be an issue I think will depend on the use case of the proto file itself and whether it's very specific in its circulation (e.g. internally within a company), or if it will be exposed to the public at large. Thoughts?
Unless we can convince others to use the comment convention 👀 🤔
Implementation
Looking at the code, I'm wondering whether it's a good idea to implement this in a more generalized way, so that:
- We might easily add in more keywords later on (like controlling whether a struct is owned perhaps?)
- Other users (even those who've not heard of
pb-rs
) will at least be able to tell that these are magic comments that apply to Rust / a certain proto compiler.
What do you think?
On a side note, the addition of EnumField
is nice; I was about to do something like that in order to properly implement deprecated fields for enums.
from quick-protobuf.
Related Issues (20)
- Nested messages, subtraction with oveflow panic
- Custom struct derive not added to oneof option i.e. to generated OneOfidentity enum
- Why does length of encoded data is at the first of bytes? HOT 3
- BytesReader::read_packed_fixed is unsound because it doesn't respect alignment
- Default values not respected HOT 4
- proto3 optionals ignored HOT 2
- Adding message length twice HOT 1
- Proposed API change: move to getters and setters HOT 11
- feature request: allow direct writing into `WriterBackend`
- Missing CI HOT 1
- Unable to run tests HOT 3
- Unable to import a nested message that uses an outer message. HOT 1
- Wrong usage of `include_bytes!` in README file of pb-rs
- Proposal for a re-worked API HOT 4
- No automatically generate mod.rs
- [Feature request] pb-rs deterministic mode
- Release a new version
- deserialize_from_vec may be more helperful
- builder for proto object may be more helperful
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quick-protobuf.