Comments (6)
@JohnDoneth many thanks for posting those, that's very helpful.
from tonic.
@davechallis Hi! I'm not exactly sure how this is actually handled, I would assume prost
builds two structs. I'm not sure if the docs proprely belong in tonic or with prost. I think what might be good would to build out a set of guides around the full stack version of tonic.
from tonic.
For prost
the nested types are put into their own module and the outermost items themselves are generated outside of that new module.
Example:
message MyOuterMessage {
string message = 1;
enum MyInnerEnum {
FOO = 0;
BAR = 1;
}
}
Generated:
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MyOuterMessage {
#[prost(string, tag = "1")]
pub message: std::string::String,
}
pub mod my_outer_message {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MyInnerEnum {
Foo = 0,
Bar = 1,
}
}
Nesting further puts the items deeper in the generated modules.
message Level1 {
message Level2 {
message Level3 {
string foo = 1;
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Level1 {}
pub mod level1 {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Level2 {}
pub mod level2 {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Level3 {
#[prost(string, tag = "1")]
pub foo: std::string::String,
}
}
}
from tonic.
@davechallis hopefully this answered your question, I think we can close this issue now?
from tonic.
@LucioFranco yes, please go ahead and close, I've made a note to try and work these into an example when I get the chance.
from tonic.
@davechallis that would be great!
from tonic.
Related Issues (20)
- Content-Type Validation Missing: Requests Not Returning HTTP 415 When Content-Type Is Not Start with `application/grpc`
- http2_keep_alive_interval doesn't work HOT 3
- Current "uds" example does not compile HOT 3
- Release 0.12.0 HOT 6
- `tonic::transport::Channel` struct is not as safe to clone for parallel use HOT 2
- Error when building excamples
- how to manually fail a client streaming?
- Add debug spans for codec tracing
- test codec::prost::tests::encode_too_big panicks on 32-bit architectures
- Inserting metadata in a test panics with index out of bounds HOT 2
- Tonic 0.12.0 compiles tokio even when no features are enabled HOT 4
- Upgrading to tonic-reflection 0.12 breaks reflection HOT 2
- use of undeclared crate or module `tonic_reflection` HOT 2
- How does tonic library dynamically set up custom middleware HOT 1
- Naming collisions with std::marker::Sync/Send
- How to make tonic support tls HOT 3
- nit: inconsistent use of crate::Error vs Error in single transport src file
- calling grpc server hosted on cloud run with https fails with transport error HOT 2
- version 0.12.1 causes ClientTlsConfig to explode with invalid CryptoProvider HOT 1
- Configuring Timeout for Graceful Shutdown HOT 1
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 tonic.