Skip to content

Commit fd944ce

Browse files
committed
Sync readmes from masters
1 parent 56042bd commit fd944ce

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

protobuf-codegen/README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,30 @@ There are two protobuf parsers which can be plugged into this crate:
2727
`protoc`-based parser is expected to parse `.proto` files very correctly:
2828
all Google's protobuf implementations rely on it.
2929

30-
Where there are no known bugs in `protobuf-parse`, it is not tested very well.
30+
While there are no known bugs in `protobuf-parse`, it is not tested very well.
3131
Also `protobuf-parse` does not implement certain rarely used features of `.proto` parser,
3232
mostly complex message options specified in `.proto` files.
3333
I never saw anyone using them, but you have been warned.
3434

3535
Note `protoc` command can be obtained from
3636
[`protoc-bin-vendored`](https://docs.rs/protoc-bin-vendored) crate.
3737

38-
# Version 3
39-
40-
Note this is documentation for protobuf-codegen version 3 (which is currently in development).
41-
42-
In version 3 this crate encapsulates both `protoc`-based codegen and pure rust codegen.
43-
44-
In version 2 `protobuf-codegen` contains `protoc`-based codegen,
45-
and `protobuf-codegen-pure` is pure rust codegen.
46-
4738
# Example
4839

4940
```rust
5041
// Use this in build.rs
5142
protobuf_codegen::Codegen::new()
43+
// Use `protoc` parser, optional.
44+
.protoc()
45+
// Use `protoc-bin-vendored` bundled protoc command, optional.
46+
.protoc_path(&protoc_bin_vendored::protoc_bin_path().unwrap())
47+
// All inputs and imports from the inputs must reside in `includes` directories.
5248
.includes(&["src/protos"])
5349
// Inputs must reside in some of include paths.
5450
.input("src/protos/apple.proto")
5551
.input("src/protos/banana.proto")
56-
.out_dir("src/protos")
52+
// Specify output directory relative to Cargo output directory.
53+
.cargo_out_dir("protos")
5754
.run_from_script();
5855
```
5956

@@ -118,7 +115,8 @@ rust-protobuf since version 3 no longer directly supports serde.
118115

119116
Rust-protobuf 3 fully supports:
120117
* runtime reflection
121-
* JSON parsing and printing
118+
* JSON parsing and printing via
119+
[`protobuf-json-mapping`](https://docs.rs/protobuf-json-mapping)
122120

123121
Which covers the most of serde use cases.
124122

protobuf-codegen/src/lib.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,35 @@
2525
//! `protoc`-based parser is expected to parse `.proto` files very correctly:
2626
//! all Google's protobuf implementations rely on it.
2727
//!
28-
//! Where there are no known bugs in `protobuf-parse`, it is not tested very well.
28+
//! While there are no known bugs in `protobuf-parse`, it is not tested very well.
2929
//! Also `protobuf-parse` does not implement certain rarely used features of `.proto` parser,
3030
//! mostly complex message options specified in `.proto` files.
3131
//! I never saw anyone using them, but you have been warned.
3232
//!
3333
//! Note `protoc` command can be obtained from
3434
//! [`protoc-bin-vendored`](https://docs.rs/protoc-bin-vendored) crate.
3535
//!
36-
//! # Version 3
37-
//!
38-
//! Note this is documentation for protobuf-codegen version 3 (which is currently in development).
39-
//!
40-
//! In version 3 this crate encapsulates both `protoc`-based codegen and pure rust codegen.
41-
//!
42-
//! In version 2 `protobuf-codegen` contains `protoc`-based codegen,
43-
//! and `protobuf-codegen-pure` is pure rust codegen.
44-
//!
4536
//! # Example
4637
//!
4738
//! ```no_run
39+
//! # mod protoc_bin_vendored {
40+
//! # pub fn protoc_bin_path() -> Result<std::path::PathBuf, std::io::Error> {
41+
//! # unimplemented!()
42+
//! # }
43+
//! # }
4844
//! // Use this in build.rs
4945
//! protobuf_codegen::Codegen::new()
46+
//! // Use `protoc` parser, optional.
47+
//! .protoc()
48+
//! // Use `protoc-bin-vendored` bundled protoc command, optional.
49+
//! .protoc_path(&protoc_bin_vendored::protoc_bin_path().unwrap())
50+
//! // All inputs and imports from the inputs must reside in `includes` directories.
5051
//! .includes(&["src/protos"])
5152
//! // Inputs must reside in some of include paths.
5253
//! .input("src/protos/apple.proto")
5354
//! .input("src/protos/banana.proto")
54-
//! .out_dir("src/protos")
55+
//! // Specify output directory relative to Cargo output directory.
56+
//! .cargo_out_dir("protos")
5557
//! .run_from_script();
5658
//! ```
5759
//!
@@ -116,7 +118,8 @@
116118
//!
117119
//! Rust-protobuf 3 fully supports:
118120
//! * runtime reflection
119-
//! * JSON parsing and printing
121+
//! * JSON parsing and printing via
122+
//! [`protobuf-json-mapping`](https://docs.rs/protobuf-json-mapping)
120123
//!
121124
//! Which covers the most of serde use cases.
122125
//!

0 commit comments

Comments
 (0)