prost
prost copied to clipboard
Package shouldn't be required
The protocol-buffers states: You can add an optional package specifier to a .proto file.
As prost is requiring a package
, correct proto files missing the package can't be processed. This is a limitation and impacts interoperability.
Solution: use option rust_package = "helloworld"
for the rust package. This is analogous to what other libraries in other languages use, like go_package
, java_package
, etc.
The use-case I have is creating a client library for the SPIFFE Workload API: https://github.com/spiffe/go-spiffe/blob/master/proto/spiffe/workload/workload.proto
Not sure if this problem still exists. If your proto file doesn't contain a package name, it will be written to _.rs
in the out/
directory during the build process, which is awkward. You can use prost_build::Config::default_package_name
to fix this. Note that this method doesn't seem to expect the .rs
file name extension to be part of the argument, which isn't documented properly yet. I generally think that it's better to include a path in the build script rather than modifying the proto file for anything Rust related. See also this post on URLO.