protobuf/well_known_types/
source_context.rs1#![allow(unknown_lints)]
6#![allow(clippy::all)]
7
8#![allow(unused_attributes)]
9#![cfg_attr(rustfmt, rustfmt::skip)]
10
11#![allow(box_pointers)]
12#![allow(dead_code)]
13#![allow(missing_docs)]
14#![allow(non_camel_case_types)]
15#![allow(non_snake_case)]
16#![allow(non_upper_case_globals)]
17#![allow(trivial_casts)]
18#![allow(unused_imports)]
19#![allow(unused_results)]
20#[derive(PartialEq,Clone,Default)]
23#[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))]
24pub struct SourceContext {
25 pub file_name: ::std::string::String,
27 #[cfg_attr(feature = "with-serde", serde(skip))]
29 pub unknown_fields: crate::UnknownFields,
30 #[cfg_attr(feature = "with-serde", serde(skip))]
31 pub cached_size: crate::CachedSize,
32}
33
34impl<'a> ::std::default::Default for &'a SourceContext {
35 fn default() -> &'a SourceContext {
36 <SourceContext as crate::Message>::default_instance()
37 }
38}
39
40impl SourceContext {
41 pub fn new() -> SourceContext {
42 ::std::default::Default::default()
43 }
44
45 pub fn get_file_name(&self) -> &str {
49 &self.file_name
50 }
51 pub fn clear_file_name(&mut self) {
52 self.file_name.clear();
53 }
54
55 pub fn set_file_name(&mut self, v: ::std::string::String) {
57 self.file_name = v;
58 }
59
60 pub fn mut_file_name(&mut self) -> &mut ::std::string::String {
63 &mut self.file_name
64 }
65
66 pub fn take_file_name(&mut self) -> ::std::string::String {
68 ::std::mem::replace(&mut self.file_name, ::std::string::String::new())
69 }
70}
71
72impl crate::Message for SourceContext {
73 fn is_initialized(&self) -> bool {
74 true
75 }
76
77 fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> {
78 while !is.eof()? {
79 let (field_number, wire_type) = is.read_tag_unpack()?;
80 match field_number {
81 1 => {
82 crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.file_name)?;
83 },
84 _ => {
85 crate::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
86 },
87 };
88 }
89 ::std::result::Result::Ok(())
90 }
91
92 #[allow(unused_variables)]
94 fn compute_size(&self) -> u32 {
95 let mut my_size = 0;
96 if !self.file_name.is_empty() {
97 my_size += crate::rt::string_size(1, &self.file_name);
98 }
99 my_size += crate::rt::unknown_fields_size(self.get_unknown_fields());
100 self.cached_size.set(my_size);
101 my_size
102 }
103
104 fn write_to_with_cached_sizes(&self, os: &mut crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> {
105 if !self.file_name.is_empty() {
106 os.write_string(1, &self.file_name)?;
107 }
108 os.write_unknown_fields(self.get_unknown_fields())?;
109 ::std::result::Result::Ok(())
110 }
111
112 fn get_cached_size(&self) -> u32 {
113 self.cached_size.get()
114 }
115
116 fn get_unknown_fields(&self) -> &crate::UnknownFields {
117 &self.unknown_fields
118 }
119
120 fn mut_unknown_fields(&mut self) -> &mut crate::UnknownFields {
121 &mut self.unknown_fields
122 }
123
124 fn as_any(&self) -> &dyn (::std::any::Any) {
125 self as &dyn (::std::any::Any)
126 }
127 fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
128 self as &mut dyn (::std::any::Any)
129 }
130 fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
131 self
132 }
133
134 fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor {
135 Self::descriptor_static()
136 }
137
138 fn new() -> SourceContext {
139 SourceContext::new()
140 }
141
142 fn descriptor_static() -> &'static crate::reflect::MessageDescriptor {
143 static descriptor: crate::rt::LazyV2<crate::reflect::MessageDescriptor> = crate::rt::LazyV2::INIT;
144 descriptor.get(|| {
145 let mut fields = ::std::vec::Vec::new();
146 fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>(
147 "file_name",
148 |m: &SourceContext| { &m.file_name },
149 |m: &mut SourceContext| { &mut m.file_name },
150 ));
151 crate::reflect::MessageDescriptor::new_pb_name::<SourceContext>(
152 "SourceContext",
153 fields,
154 file_descriptor_proto()
155 )
156 })
157 }
158
159 fn default_instance() -> &'static SourceContext {
160 static instance: crate::rt::LazyV2<SourceContext> = crate::rt::LazyV2::INIT;
161 instance.get(SourceContext::new)
162 }
163}
164
165impl crate::Clear for SourceContext {
166 fn clear(&mut self) {
167 self.file_name.clear();
168 self.unknown_fields.clear();
169 }
170}
171
172impl ::std::fmt::Debug for SourceContext {
173 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
174 crate::text_format::fmt(self, f)
175 }
176}
177
178impl crate::reflect::ProtobufValue for SourceContext {
179 fn as_ref(&self) -> crate::reflect::ReflectValueRef {
180 crate::reflect::ReflectValueRef::Message(self)
181 }
182}
183
184static file_descriptor_proto_data: &'static [u8] = b"\
185 \n$google/protobuf/source_context.proto\x12\x0fgoogle.protobuf\",\n\rSou\
186 rceContext\x12\x1b\n\tfile_name\x18\x01\x20\x01(\tR\x08fileNameB\x8a\x01\
187 \n\x13com.google.protobufB\x12SourceContextProtoP\x01Z6google.golang.org\
188 /protobuf/types/known/sourcecontextpb\xa2\x02\x03GPB\xaa\x02\x1eGoogle.P\
189 rotobuf.WellKnownTypesJ\xc1\x10\n\x06\x12\x04\x1e\0/\x01\n\xcc\x0c\n\x01\
190 \x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Protocol\x20Buffers\x20-\x20Google's\
191 \x20data\x20interchange\x20format\n\x20Copyright\x202008\x20Google\x20In\
192 c.\x20\x20All\x20rights\x20reserved.\n\x20https://developers.google.com/\
193 protocol-buffers/\n\n\x20Redistribution\x20and\x20use\x20in\x20source\
194 \x20and\x20binary\x20forms,\x20with\x20or\x20without\n\x20modification,\
195 \x20are\x20permitted\x20provided\x20that\x20the\x20following\x20conditio\
196 ns\x20are\n\x20met:\n\n\x20\x20\x20\x20\x20*\x20Redistributions\x20of\
197 \x20source\x20code\x20must\x20retain\x20the\x20above\x20copyright\n\x20n\
198 otice,\x20this\x20list\x20of\x20conditions\x20and\x20the\x20following\
199 \x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Redistributions\x20in\x20binar\
200 y\x20form\x20must\x20reproduce\x20the\x20above\n\x20copyright\x20notice,\
201 \x20this\x20list\x20of\x20conditions\x20and\x20the\x20following\x20discl\
202 aimer\n\x20in\x20the\x20documentation\x20and/or\x20other\x20materials\
203 \x20provided\x20with\x20the\n\x20distribution.\n\x20\x20\x20\x20\x20*\
204 \x20Neither\x20the\x20name\x20of\x20Google\x20Inc.\x20nor\x20the\x20name\
205 s\x20of\x20its\n\x20contributors\x20may\x20be\x20used\x20to\x20endorse\
206 \x20or\x20promote\x20products\x20derived\x20from\n\x20this\x20software\
207 \x20without\x20specific\x20prior\x20written\x20permission.\n\n\x20THIS\
208 \x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIGHT\x20HOLDERS\x20A\
209 ND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20EXPRESS\x20OR\x20I\
210 MPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\
211 \x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABILITY\x20AND\x20FITN\
212 ESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20DISCLAIMED.\x20IN\
213 \x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\x20OR\x20CONTRIB\
214 UTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIRECT,\x20INCIDENTA\
215 L,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\x20(INC\
216 LUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREMENT\x20OF\x20SUBSTI\
217 TUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE,\n\x20DATA,\x20OR\
218 \x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOWEVER\x20CAUSED\x20\
219 AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WHETHER\x20IN\x20CON\
220 TRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INCLUDING\x20NEGLIGEN\
221 CE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\x20OUT\x20OF\x20TH\
222 E\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\x20ADVISED\x20OF\x20\
223 THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\n\x01\x02\x12\x03\
224 \x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\x12\x03\"\0;\n\
225 \x08\n\x01\x08\x12\x03#\0,\n\t\n\x02\x08\x01\x12\x03#\0,\n\x08\n\x01\x08\
226 \x12\x03$\03\n\t\n\x02\x08\x08\x12\x03$\03\n\x08\n\x01\x08\x12\x03%\0\"\
227 \n\t\n\x02\x08\n\x12\x03%\0\"\n\x08\n\x01\x08\x12\x03&\0!\n\t\n\x02\x08$\
228 \x12\x03&\0!\n\x08\n\x01\x08\x12\x03'\0M\n\t\n\x02\x08\x0b\x12\x03'\0M\n\
229 \x83\x01\n\x02\x04\0\x12\x04+\0/\x01\x1aw\x20`SourceContext`\x20represen\
230 ts\x20information\x20about\x20the\x20source\x20of\x20a\n\x20protobuf\x20\
231 element,\x20like\x20the\x20file\x20in\x20which\x20it\x20is\x20defined.\n\
232 \n\n\n\x03\x04\0\x01\x12\x03+\x08\x15\n\xa3\x01\n\x04\x04\0\x02\0\x12\
233 \x03.\x02\x17\x1a\x95\x01\x20The\x20path-qualified\x20name\x20of\x20the\
234 \x20.proto\x20file\x20that\x20contained\x20the\x20associated\n\x20protob\
235 uf\x20element.\x20\x20For\x20example:\x20`\"google/protobuf/source_conte\
236 xt.proto\"`.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03.\x02\x08\n\x0c\n\x05\
237 \x04\0\x02\0\x01\x12\x03.\t\x12\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03.\x15\
238 \x16b\x06proto3\
239";
240
241static file_descriptor_proto_lazy: crate::rt::LazyV2<crate::descriptor::FileDescriptorProto> = crate::rt::LazyV2::INIT;
242
243fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto {
244 crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
245}
246
247pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto {
248 file_descriptor_proto_lazy.get(|| {
249 parse_descriptor_proto()
250 })
251}