• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! # Parse `.proto` files
2 //!
3 //! Parse `.proto` file definitions, **not** the protobuf text format serialization.
4 //!
5 //! Files can be parsed using pure Rust parser (mod `pure`)
6 //! or using the `protoc` command (mod `protoc`).
7 //!
8 //! This crate is not meant to be used directly, but rather through the `protobuf-codegen` crate.
9 //! If you think this crate might be useful to you,
10 //! please [consider creating an issue](https://github.com/stepancheg/rust-protobuf/issues/new),
11 //! until that this crate is considered to have **no stable API**.
12 
13 extern crate core;
14 
15 mod case_convert;
16 mod parse_and_typecheck;
17 mod parser;
18 mod path;
19 mod proto;
20 mod proto_path;
21 mod protobuf_abs_path;
22 mod protobuf_ident;
23 mod protobuf_path;
24 mod protobuf_rel_path;
25 pub(crate) mod protoc;
26 pub mod pure;
27 mod rel_path;
28 mod test_against_protobuf_protos;
29 mod which_parser;
30 
31 // Public API
32 // Non-public API used by codegen crate.
33 pub use case_convert::*;
34 pub use parse_and_typecheck::*;
35 pub use parser::Parser;
36 pub use proto_path::*;
37 use protobuf::reflect::FileDescriptor;
38 pub use protobuf_abs_path::*;
39 pub use protobuf_ident::*;
40 pub use protobuf_rel_path::*;
41 
42 use crate::pure::model;
43 
44 #[derive(Clone)]
45 pub(crate) struct FileDescriptorPair {
46     pub(crate) parsed: model::FileDescriptor,
47     pub(crate) descriptor_proto: protobuf::descriptor::FileDescriptorProto,
48     pub(crate) descriptor: FileDescriptor,
49 }
50