import "google/protobuf/timestamp.proto";
does not get resolved.
I am trying to use this definition from google but it does not get resolved. What is the best way to use? I prefer NOT to download the proto file and include it with my project.
import "google/protobuf/timestamp.proto";
does not get resolved.
I am trying to use this definition from google but it does not get resolved. What is the best way to use? I prefer NOT to download the proto file and include it with my project.
protobuf files must be locally on your machine somewhere, assuming that you got the protobuf compiler installed and the google/protobuf path set, please be more spesific in your question, at first i though that this was a golang forum, i had to double check
I am new using protobuf with RUST. Golang and Java honor the import statement for google/protobuf/timestamp. There must be a different way to do this in Rust. Of course I can download timestamp.proto but I would rather use the google version instead of having a copy in my rust project.
When asking a question, please specify the crate you're asking about, if any. The Rust language and standard library do not have protobuf support, so I assume you're using a crate for that. It is that crate we should be looking at to determine whether it provides what you need. I can look up protobuf crates but there are several of them, and it should be you who specifies what you're using.
Thank you for the clarification. I have the prost crate included in my dependencies. It looks like it doesn't provide support for the Timestamp type (or maybe I am using a protobuf compiler that does not include google types?)
I see a separate prost-types crate that looks like it has the Timestamp type, in fact the first example in the docs uses it.
let message = Timestamp::date(2000, 1, 1).unwrap();
let any = Any::from_msg(&message).unwrap();
Ok so the protobuf compiler DOES NOT import the google definition but I can use the copied definition with the prost crate because it currently supports the google protobuf definition. By not having the compiler pickup the legitimate google/protobuf/timestamp.proto I am not protected from changes to the original definition which might result in changes in the crate because I am using a local copy. I'm better off not trying to use a published version and write my own implementation.