Skip to content

Commit

Permalink
Add snazzy module to example (#728)
Browse files Browse the repository at this point in the history
Modify the example code for prost-build so that it uses the right module structure.

Otherwise this might cause issues if the proto imports other protos.
  • Loading branch information
mvanotti committed Oct 9, 2022
1 parent a1a3603 commit 6658ab4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions prost-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@
//!
//! ```rust,ignore
//! // Include the `items` module, which is generated from items.proto.
//! pub mod items {
//! include!(concat!(env!("OUT_DIR"), "/snazzy.items.rs"));
//! // It is important to maintain the same structure as in the proto.
//! pub mod snazzy {
//! pub mod items {
//! include!(concat!(env!("OUT_DIR"), "/snazzy.items.rs"));
//! }
//! }
//!
//! use snazzy::items;
//!
//! pub fn create_large_shirt(color: String) -> items::Shirt {
//! let mut shirt = items::Shirt::default();
//! shirt.color = color;
Expand Down

0 comments on commit 6658ab4

Please sign in to comment.