prost icon indicating copy to clipboard operation
prost copied to clipboard

README says prost generates module hierarchy following package keyword

Open tytouf opened this issue 1 year ago • 3 comments

README file is misleading regarding prost generating modules following the package keyword. It says "All Rust types generated from the file will be in the foo::bar module." but as far as I can see using the example found here: https://github.com/danburkert/snazzy this is not the case. Instead it is up to the user to work with mod and include! and recreate the modules hierarchy following the package value. Am I correct or is there another way to do it ?

tytouf avatar Feb 28 '23 10:02 tytouf

I guess the include_file() method from prost_build::Config is implementing the expected behaviour.

https://docs.rs/prost-build/latest/prost_build/struct.Config.html#method.include_file

tytouf avatar Feb 28 '23 15:02 tytouf

docs.rs/prost-build/latest/prost_build/struct.Config.html#method.include_file

oh, this solution works for me too, thank you!

prost's authors should definitely mark it somewhere in README

beautyfree avatar Oct 07 '23 19:10 beautyfree

That's also what I was looking for.

A good thing that it is already available, but as beautyfree said:

  • it should be described on the main documentation page,
  • I would even recommend to generate the file by default with name 'mod.rs' (that's what protobuf seems to do).

mic006 avatar Nov 27 '23 20:11 mic006