| commit | fdbba4713a58ff8c3bff5e915c6cd8b102279be5 | [log] [tgz] |
|---|---|---|
| author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Sat Apr 01 07:52:03 2023 +0000 |
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Sat Apr 01 07:52:03 2023 +0000 |
| tree | 554f7362ef429cebf5ef30f382497240a06989f8 | |
| parent | 2515e78aaefcd6a632b39262ccbe8da5e6a73b86 [diff] | |
| parent | 723f91d21517dcbf64537d4adf2a962d93ac09d2 [diff] |
Snap for 9867821 from 349c4f67edf11e0560c05b96307205769e215bb4 to udc-release am: 723f91d215 Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/protobuf-codegen/+/22400617 Change-Id: I7bad6cbf323365a1a773aeb4dfb3f7442f930740 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This crate contains protobuf code generator implementation and a protoc-gen-rust protoc plugin.
This crate:
protoc-gen-rust plugin for protoc commandThis crate is not meant to be used directly, in fact, it does not provide any public API (except for protoc-gen-rust binary).
Code can be generated with either:
protoc-gen-rust plugin for protoc orprotoc-rust crate (code generator which depends on protoc binary for parsing of .proto files)protobuf-codegen-pure crate, similar API to protoc-rust, but uses pure rust parser of .proto files.protoc-gen-rust plugin for protocWhen non-cargo build system is used, consider using standard protobuf code generation pattern: protoc command does all the work of handling paths and parsing .proto files. When protoc is invoked with --rust_out= option, it invokes protoc-gen-rust plugin. provided by this crate.
When building with cargo, consider using protoc-rust or protobuf-codegen-pure crates.
protoc-gen-rust if you have to(Note protoc can be invoked programmatically with protoc crate)
protoc binary.On OS X Homebrew can be used:
brew install protobuf
On Ubuntu, protobuf-compiler package can be installed:
apt-get install protobuf-compiler
Protobuf is needed only for code generation, rust-protobuf runtime does not use protobuf library.
protoc-gen-rust program (which is protoc plugin)It can be installed either from source or with cargo install protobuf command.
protoc-gen-rust to $PATHIf you installed it with cargo, it should be
PATH="$HOME/.cargo/bin:$PATH"
protoc --rust_out . foo.proto
This will generate .rs files in current directory.
This is documentation for version 2 of the crate.
Version 3 of the crate (currently in development) encapsulates both protoc and pure codegens in this crate.