prost_types/compiler.rs
1/// The version number of protocol compiler.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Version {
4 #[prost(int32, optional, tag="1")]
5 pub major: ::core::option::Option<i32>,
6 #[prost(int32, optional, tag="2")]
7 pub minor: ::core::option::Option<i32>,
8 #[prost(int32, optional, tag="3")]
9 pub patch: ::core::option::Option<i32>,
10 /// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
11 /// be empty for mainline stable releases.
12 #[prost(string, optional, tag="4")]
13 pub suffix: ::core::option::Option<::prost::alloc::string::String>,
14}
15/// An encoded CodeGeneratorRequest is written to the plugin's stdin.
16#[derive(Clone, PartialEq, ::prost::Message)]
17pub struct CodeGeneratorRequest {
18 /// The .proto files that were explicitly listed on the command-line. The
19 /// code generator should generate code only for these files. Each file's
20 /// descriptor will be included in proto_file, below.
21 #[prost(string, repeated, tag="1")]
22 pub file_to_generate: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
23 /// The generator parameter passed on the command-line.
24 #[prost(string, optional, tag="2")]
25 pub parameter: ::core::option::Option<::prost::alloc::string::String>,
26 /// FileDescriptorProtos for all files in files_to_generate and everything
27 /// they import. The files will appear in topological order, so each file
28 /// appears before any file that imports it.
29 ///
30 /// protoc guarantees that all proto_files will be written after
31 /// the fields above, even though this is not technically guaranteed by the
32 /// protobuf wire format. This theoretically could allow a plugin to stream
33 /// in the FileDescriptorProtos and handle them one by one rather than read
34 /// the entire set into memory at once. However, as of this writing, this
35 /// is not similarly optimized on protoc's end -- it will store all fields in
36 /// memory at once before sending them to the plugin.
37 ///
38 /// Type names of fields and extensions in the FileDescriptorProto are always
39 /// fully qualified.
40 #[prost(message, repeated, tag="15")]
41 pub proto_file: ::prost::alloc::vec::Vec<super::FileDescriptorProto>,
42 /// The version number of protocol compiler.
43 #[prost(message, optional, tag="3")]
44 pub compiler_version: ::core::option::Option<Version>,
45}
46/// The plugin writes an encoded CodeGeneratorResponse to stdout.
47#[derive(Clone, PartialEq, ::prost::Message)]
48pub struct CodeGeneratorResponse {
49 /// Error message. If non-empty, code generation failed. The plugin process
50 /// should exit with status code zero even if it reports an error in this way.
51 ///
52 /// This should be used to indicate errors in .proto files which prevent the
53 /// code generator from generating correct code. Errors which indicate a
54 /// problem in protoc itself -- such as the input CodeGeneratorRequest being
55 /// unparseable -- should be reported by writing a message to stderr and
56 /// exiting with a non-zero status code.
57 #[prost(string, optional, tag="1")]
58 pub error: ::core::option::Option<::prost::alloc::string::String>,
59 /// A bitmask of supported features that the code generator supports.
60 /// This is a bitwise "or" of values from the Feature enum.
61 #[prost(uint64, optional, tag="2")]
62 pub supported_features: ::core::option::Option<u64>,
63 #[prost(message, repeated, tag="15")]
64 pub file: ::prost::alloc::vec::Vec<code_generator_response::File>,
65}
66/// Nested message and enum types in `CodeGeneratorResponse`.
67pub mod code_generator_response {
68 /// Represents a single generated file.
69 #[derive(Clone, PartialEq, ::prost::Message)]
70 pub struct File {
71 /// The file name, relative to the output directory. The name must not
72 /// contain "." or ".." components and must be relative, not be absolute (so,
73 /// the file cannot lie outside the output directory). "/" must be used as
74 /// the path separator, not "\".
75 ///
76 /// If the name is omitted, the content will be appended to the previous
77 /// file. This allows the generator to break large files into small chunks,
78 /// and allows the generated text to be streamed back to protoc so that large
79 /// files need not reside completely in memory at one time. Note that as of
80 /// this writing protoc does not optimize for this -- it will read the entire
81 /// CodeGeneratorResponse before writing files to disk.
82 #[prost(string, optional, tag="1")]
83 pub name: ::core::option::Option<::prost::alloc::string::String>,
84 /// If non-empty, indicates that the named file should already exist, and the
85 /// content here is to be inserted into that file at a defined insertion
86 /// point. This feature allows a code generator to extend the output
87 /// produced by another code generator. The original generator may provide
88 /// insertion points by placing special annotations in the file that look
89 /// like:
90 /// @@protoc_insertion_point(NAME)
91 /// The annotation can have arbitrary text before and after it on the line,
92 /// which allows it to be placed in a comment. NAME should be replaced with
93 /// an identifier naming the point -- this is what other generators will use
94 /// as the insertion_point. Code inserted at this point will be placed
95 /// immediately above the line containing the insertion point (thus multiple
96 /// insertions to the same point will come out in the order they were added).
97 /// The double-@ is intended to make it unlikely that the generated code
98 /// could contain things that look like insertion points by accident.
99 ///
100 /// For example, the C++ code generator places the following line in the
101 /// .pb.h files that it generates:
102 /// // @@protoc_insertion_point(namespace_scope)
103 /// This line appears within the scope of the file's package namespace, but
104 /// outside of any particular class. Another plugin can then specify the
105 /// insertion_point "namespace_scope" to generate additional classes or
106 /// other declarations that should be placed in this scope.
107 ///
108 /// Note that if the line containing the insertion point begins with
109 /// whitespace, the same whitespace will be added to every line of the
110 /// inserted text. This is useful for languages like Python, where
111 /// indentation matters. In these languages, the insertion point comment
112 /// should be indented the same amount as any inserted code will need to be
113 /// in order to work correctly in that context.
114 ///
115 /// The code generator that generates the initial file and the one which
116 /// inserts into it must both run as part of a single invocation of protoc.
117 /// Code generators are executed in the order in which they appear on the
118 /// command line.
119 ///
120 /// If |insertion_point| is present, |name| must also be present.
121 #[prost(string, optional, tag="2")]
122 pub insertion_point: ::core::option::Option<::prost::alloc::string::String>,
123 /// The file contents.
124 #[prost(string, optional, tag="15")]
125 pub content: ::core::option::Option<::prost::alloc::string::String>,
126 /// Information describing the file content being inserted. If an insertion
127 /// point is used, this information will be appropriately offset and inserted
128 /// into the code generation metadata for the generated files.
129 #[prost(message, optional, tag="16")]
130 pub generated_code_info: ::core::option::Option<super::super::GeneratedCodeInfo>,
131 }
132 /// Sync with code_generator.h.
133 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
134 #[repr(i32)]
135 pub enum Feature {
136 None = 0,
137 Proto3Optional = 1,
138 }
139}