|
25 | 25 | //! `protoc`-based parser is expected to parse `.proto` files very correctly: |
26 | 26 | //! all Google's protobuf implementations rely on it. |
27 | 27 | //! |
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. |
29 | 29 | //! Also `protobuf-parse` does not implement certain rarely used features of `.proto` parser, |
30 | 30 | //! mostly complex message options specified in `.proto` files. |
31 | 31 | //! I never saw anyone using them, but you have been warned. |
32 | 32 | //! |
33 | 33 | //! Note `protoc` command can be obtained from |
34 | 34 | //! [`protoc-bin-vendored`](https://docs.rs/protoc-bin-vendored) crate. |
35 | 35 | //! |
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 | | -//! |
45 | 36 | //! # Example |
46 | 37 | //! |
47 | 38 | //! ```no_run |
| 39 | +//! # mod protoc_bin_vendored { |
| 40 | +//! # pub fn protoc_bin_path() -> Result<std::path::PathBuf, std::io::Error> { |
| 41 | +//! # unimplemented!() |
| 42 | +//! # } |
| 43 | +//! # } |
48 | 44 | //! // Use this in build.rs |
49 | 45 | //! 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. |
50 | 51 | //! .includes(&["src/protos"]) |
51 | 52 | //! // Inputs must reside in some of include paths. |
52 | 53 | //! .input("src/protos/apple.proto") |
53 | 54 | //! .input("src/protos/banana.proto") |
54 | | -//! .out_dir("src/protos") |
| 55 | +//! // Specify output directory relative to Cargo output directory. |
| 56 | +//! .cargo_out_dir("protos") |
55 | 57 | //! .run_from_script(); |
56 | 58 | //! ``` |
57 | 59 | //! |
|
116 | 118 | //! |
117 | 119 | //! Rust-protobuf 3 fully supports: |
118 | 120 | //! * runtime reflection |
119 | | -//! * JSON parsing and printing |
| 121 | +//! * JSON parsing and printing via |
| 122 | +//! [`protobuf-json-mapping`](https://docs.rs/protobuf-json-mapping) |
120 | 123 | //! |
121 | 124 | //! Which covers the most of serde use cases. |
122 | 125 | //! |
|
0 commit comments