Closed
Description
The compile_well_known_types
flag controls whether generated libraries use prost-types or types from generated google.protobuf.*
protos.
This flag is currently always enabled here (and a bit further below for tonic):
rules_rust/proto/prost/private/prost.bzl
Line 63 in 478213b
Being enabled by default means that we have to use e.g. timestamp_proto::google::protobuf::Timestamp
instead of prost_types::Timestamp
.
I'm not sure whether this is a good or a bad thing.
- It's more precise if users explicitly use the types that are actually written in the proto files.
- It seems the ergonomics of prost-types are nicer. E.g. a generated
timestamp_proto::google::protobuf::Timestamp
doesn't implementFrom<SystemTime>
, butprost_types::Timestamp
does. Intuitively I could also imagine the specializedprost-types
to be more performant.
There is also a protoc-wkt crate that adds more extensive chrono-timestamp interop and other goodies.
Adding configurability for compile_well_known_types
seems straightforward, but I'm not sure what the better default would be.