1 // This file is generated by rust-protobuf 2.14.0-pre. Do not edit
2 // @generated
3 
4 // https://github.com/rust-lang/rust-clippy/issues/702
5 #![allow(unknown_lints)]
6 #![allow(clippy::all)]
7 
8 #![cfg_attr(rustfmt, rustfmt_skip)]
9 
10 #![allow(box_pointers)]
11 #![allow(dead_code)]
12 #![allow(missing_docs)]
13 #![allow(non_camel_case_types)]
14 #![allow(non_snake_case)]
15 #![allow(non_upper_case_globals)]
16 #![allow(trivial_casts)]
17 #![allow(unsafe_code)]
18 #![allow(unused_imports)]
19 #![allow(unused_results)]
20 //! Generated file from `google/protobuf/duration.proto`
21 
22 use protobuf::Message as Message_imported_for_functions;
23 use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
24 
25 #[derive(PartialEq,Clone,Default)]
26 #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
27 pub struct Duration {
28     // message fields
29     pub seconds: i64,
30     pub nanos: i32,
31     // special fields
32     #[cfg_attr(feature = "with-serde", serde(skip))]
33     pub unknown_fields: ::protobuf::UnknownFields,
34     #[cfg_attr(feature = "with-serde", serde(skip))]
35     pub cached_size: ::protobuf::CachedSize,
36 }
37 
38 impl<'a> ::std::default::Default for &'a Duration {
default() -> &'a Duration39     fn default() -> &'a Duration {
40         <Duration as ::protobuf::Message>::default_instance()
41     }
42 }
43 
44 impl Duration {
new() -> Duration45     pub fn new() -> Duration {
46         ::std::default::Default::default()
47     }
48 
49     // int64 seconds = 1;
50 
51 
get_seconds(&self) -> i6452     pub fn get_seconds(&self) -> i64 {
53         self.seconds
54     }
clear_seconds(&mut self)55     pub fn clear_seconds(&mut self) {
56         self.seconds = 0;
57     }
58 
59     // Param is passed by value, moved
set_seconds(&mut self, v: i64)60     pub fn set_seconds(&mut self, v: i64) {
61         self.seconds = v;
62     }
63 
64     // int32 nanos = 2;
65 
66 
get_nanos(&self) -> i3267     pub fn get_nanos(&self) -> i32 {
68         self.nanos
69     }
clear_nanos(&mut self)70     pub fn clear_nanos(&mut self) {
71         self.nanos = 0;
72     }
73 
74     // Param is passed by value, moved
set_nanos(&mut self, v: i32)75     pub fn set_nanos(&mut self, v: i32) {
76         self.nanos = v;
77     }
78 }
79 
80 impl ::protobuf::Message for Duration {
is_initialized(&self) -> bool81     fn is_initialized(&self) -> bool {
82         true
83     }
84 
merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()>85     fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
86         while !is.eof()? {
87             let (field_number, wire_type) = is.read_tag_unpack()?;
88             match field_number {
89                 1 => {
90                     if wire_type != ::protobuf::wire_format::WireTypeVarint {
91                         return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
92                     }
93                     let tmp = is.read_int64()?;
94                     self.seconds = tmp;
95                 },
96                 2 => {
97                     if wire_type != ::protobuf::wire_format::WireTypeVarint {
98                         return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
99                     }
100                     let tmp = is.read_int32()?;
101                     self.nanos = tmp;
102                 },
103                 _ => {
104                     ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
105                 },
106             };
107         }
108         ::std::result::Result::Ok(())
109     }
110 
111     // Compute sizes of nested messages
112     #[allow(unused_variables)]
compute_size(&self) -> u32113     fn compute_size(&self) -> u32 {
114         let mut my_size = 0;
115         if self.seconds != 0 {
116             my_size += ::protobuf::rt::value_size(1, self.seconds, ::protobuf::wire_format::WireTypeVarint);
117         }
118         if self.nanos != 0 {
119             my_size += ::protobuf::rt::value_size(2, self.nanos, ::protobuf::wire_format::WireTypeVarint);
120         }
121         my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
122         self.cached_size.set(my_size);
123         my_size
124     }
125 
write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()>126     fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
127         if self.seconds != 0 {
128             os.write_int64(1, self.seconds)?;
129         }
130         if self.nanos != 0 {
131             os.write_int32(2, self.nanos)?;
132         }
133         os.write_unknown_fields(self.get_unknown_fields())?;
134         ::std::result::Result::Ok(())
135     }
136 
get_cached_size(&self) -> u32137     fn get_cached_size(&self) -> u32 {
138         self.cached_size.get()
139     }
140 
get_unknown_fields(&self) -> &::protobuf::UnknownFields141     fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
142         &self.unknown_fields
143     }
144 
mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields145     fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
146         &mut self.unknown_fields
147     }
148 
as_any(&self) -> &dyn (::std::any::Any)149     fn as_any(&self) -> &dyn (::std::any::Any) {
150         self as &dyn (::std::any::Any)
151     }
as_any_mut(&mut self) -> &mut dyn (::std::any::Any)152     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
153         self as &mut dyn (::std::any::Any)
154     }
into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)>155     fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
156         self
157     }
158 
descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor159     fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
160         Self::descriptor_static()
161     }
162 
new() -> Duration163     fn new() -> Duration {
164         Duration::new()
165     }
166 
descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor167     fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
168         static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
169         unsafe {
170             descriptor.get(|| {
171                 let mut fields = ::std::vec::Vec::new();
172                 fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
173                     "seconds",
174                     |m: &Duration| { &m.seconds },
175                     |m: &mut Duration| { &mut m.seconds },
176                 ));
177                 fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
178                     "nanos",
179                     |m: &Duration| { &m.nanos },
180                     |m: &mut Duration| { &mut m.nanos },
181                 ));
182                 ::protobuf::reflect::MessageDescriptor::new_pb_name::<Duration>(
183                     "Duration",
184                     fields,
185                     file_descriptor_proto()
186                 )
187             })
188         }
189     }
190 
default_instance() -> &'static Duration191     fn default_instance() -> &'static Duration {
192         static mut instance: ::protobuf::lazy::Lazy<Duration> = ::protobuf::lazy::Lazy::INIT;
193         unsafe {
194             instance.get(Duration::new)
195         }
196     }
197 }
198 
199 impl ::protobuf::Clear for Duration {
clear(&mut self)200     fn clear(&mut self) {
201         self.seconds = 0;
202         self.nanos = 0;
203         self.unknown_fields.clear();
204     }
205 }
206 
207 impl ::std::fmt::Debug for Duration {
fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result208     fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
209         ::protobuf::text_format::fmt(self, f)
210     }
211 }
212 
213 impl ::protobuf::reflect::ProtobufValue for Duration {
as_ref(&self) -> ::protobuf::reflect::ReflectValueRef214     fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
215         ::protobuf::reflect::ReflectValueRef::Message(self)
216     }
217 }
218 
219 static file_descriptor_proto_data: &'static [u8] = b"\
220     \n\x1egoogle/protobuf/duration.proto\x12\x0fgoogle.protobuf\":\n\x08Dura\
221     tion\x12\x18\n\x07seconds\x18\x01\x20\x01(\x03R\x07seconds\x12\x14\n\x05\
222     nanos\x18\x02\x20\x01(\x05R\x05nanosB|\n\x13com.google.protobufB\rDurati\
223     onProtoP\x01Z*github.com/golang/protobuf/ptypes/duration\xf8\x01\x01\xa2\
224     \x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesJ\xe1\x1e\n\x06\x12\
225     \x04\x1e\0g\x01\n\xcc\x0c\n\x01\x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Protoc\
226     ol\x20Buffers\x20-\x20Google's\x20data\x20interchange\x20format\n\x20Cop\
227     yright\x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20\
228     https://developers.google.com/protocol-buffers/\n\n\x20Redistribution\
229     \x20and\x20use\x20in\x20source\x20and\x20binary\x20forms,\x20with\x20or\
230     \x20without\n\x20modification,\x20are\x20permitted\x20provided\x20that\
231     \x20the\x20following\x20conditions\x20are\n\x20met:\n\n\x20\x20\x20\x20\
232     \x20*\x20Redistributions\x20of\x20source\x20code\x20must\x20retain\x20th\
233     e\x20above\x20copyright\n\x20notice,\x20this\x20list\x20of\x20conditions\
234     \x20and\x20the\x20following\x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Red\
235     istributions\x20in\x20binary\x20form\x20must\x20reproduce\x20the\x20abov\
236     e\n\x20copyright\x20notice,\x20this\x20list\x20of\x20conditions\x20and\
237     \x20the\x20following\x20disclaimer\n\x20in\x20the\x20documentation\x20an\
238     d/or\x20other\x20materials\x20provided\x20with\x20the\n\x20distribution.\
239     \n\x20\x20\x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\x20Inc\
240     .\x20nor\x20the\x20names\x20of\x20its\n\x20contributors\x20may\x20be\x20\
241     used\x20to\x20endorse\x20or\x20promote\x20products\x20derived\x20from\n\
242     \x20this\x20software\x20without\x20specific\x20prior\x20written\x20permi\
243     ssion.\n\n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIG\
244     HT\x20HOLDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20\
245     EXPRESS\x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\
246     \x20LIMITED\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABIL\
247     ITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20D\
248     ISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\
249     \x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIR\
250     ECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\
251     \x20DAMAGES\x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREM\
252     ENT\x20OF\x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE\
253     ,\n\x20DATA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOW\
254     EVER\x20CAUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WH\
255     ETHER\x20IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INC\
256     LUDING\x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\
257     \x20OUT\x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\
258     \x20ADVISED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\
259     \n\x01\x02\x12\x03\x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\
260     \x12\x03\"\0;\n\x08\n\x01\x08\x12\x03#\0\x1f\n\t\n\x02\x08\x1f\x12\x03#\
261     \0\x1f\n\x08\n\x01\x08\x12\x03$\0A\n\t\n\x02\x08\x0b\x12\x03$\0A\n\x08\n\
262     \x01\x08\x12\x03%\0,\n\t\n\x02\x08\x01\x12\x03%\0,\n\x08\n\x01\x08\x12\
263     \x03&\0.\n\t\n\x02\x08\x08\x12\x03&\0.\n\x08\n\x01\x08\x12\x03'\0\"\n\t\
264     \n\x02\x08\n\x12\x03'\0\"\n\x08\n\x01\x08\x12\x03(\0!\n\t\n\x02\x08$\x12\
265     \x03(\0!\n\x92\x0c\n\x02\x04\0\x12\x04Z\0g\x01\x1a\x85\x0c\x20A\x20Durat\
266     ion\x20represents\x20a\x20signed,\x20fixed-length\x20span\x20of\x20time\
267     \x20represented\n\x20as\x20a\x20count\x20of\x20seconds\x20and\x20fractio\
268     ns\x20of\x20seconds\x20at\x20nanosecond\n\x20resolution.\x20It\x20is\x20\
269     independent\x20of\x20any\x20calendar\x20and\x20concepts\x20like\x20\"day\
270     \"\n\x20or\x20\"month\".\x20It\x20is\x20related\x20to\x20Timestamp\x20in\
271     \x20that\x20the\x20difference\x20between\n\x20two\x20Timestamp\x20values\
272     \x20is\x20a\x20Duration\x20and\x20it\x20can\x20be\x20added\x20or\x20subt\
273     racted\n\x20from\x20a\x20Timestamp.\x20Range\x20is\x20approximately\x20+\
274     -10,000\x20years.\n\n\x20Example\x201:\x20Compute\x20Duration\x20from\
275     \x20two\x20Timestamps\x20in\x20pseudo\x20code.\n\n\x20\x20\x20\x20\x20Ti\
276     mestamp\x20start\x20=\x20...;\n\x20\x20\x20\x20\x20Timestamp\x20end\x20=\
277     \x20...;\n\x20\x20\x20\x20\x20Duration\x20duration\x20=\x20...;\n\n\x20\
278     \x20\x20\x20\x20duration.seconds\x20=\x20end.seconds\x20-\x20start.secon\
279     ds;\n\x20\x20\x20\x20\x20duration.nanos\x20=\x20end.nanos\x20-\x20start.\
280     nanos;\n\n\x20\x20\x20\x20\x20if\x20(duration.seconds\x20<\x200\x20&&\
281     \x20duration.nanos\x20>\x200)\x20{\n\x20\x20\x20\x20\x20\x20\x20duration\
282     .seconds\x20+=\x201;\n\x20\x20\x20\x20\x20\x20\x20duration.nanos\x20-=\
283     \x201000000000;\n\x20\x20\x20\x20\x20}\x20else\x20if\x20(durations.secon\
284     ds\x20>\x200\x20&&\x20duration.nanos\x20<\x200)\x20{\n\x20\x20\x20\x20\
285     \x20\x20\x20duration.seconds\x20-=\x201;\n\x20\x20\x20\x20\x20\x20\x20du\
286     ration.nanos\x20+=\x201000000000;\n\x20\x20\x20\x20\x20}\n\n\x20Example\
287     \x202:\x20Compute\x20Timestamp\x20from\x20Timestamp\x20+\x20Duration\x20\
288     in\x20pseudo\x20code.\n\n\x20\x20\x20\x20\x20Timestamp\x20start\x20=\x20\
289     ...;\n\x20\x20\x20\x20\x20Duration\x20duration\x20=\x20...;\n\x20\x20\
290     \x20\x20\x20Timestamp\x20end\x20=\x20...;\n\n\x20\x20\x20\x20\x20end.sec\
291     onds\x20=\x20start.seconds\x20+\x20duration.seconds;\n\x20\x20\x20\x20\
292     \x20end.nanos\x20=\x20start.nanos\x20+\x20duration.nanos;\n\n\x20\x20\
293     \x20\x20\x20if\x20(end.nanos\x20<\x200)\x20{\n\x20\x20\x20\x20\x20\x20\
294     \x20end.seconds\x20-=\x201;\n\x20\x20\x20\x20\x20\x20\x20end.nanos\x20+=\
295     \x201000000000;\n\x20\x20\x20\x20\x20}\x20else\x20if\x20(end.nanos\x20>=\
296     \x201000000000)\x20{\n\x20\x20\x20\x20\x20\x20\x20end.seconds\x20+=\x201\
297     ;\n\x20\x20\x20\x20\x20\x20\x20end.nanos\x20-=\x201000000000;\n\x20\x20\
298     \x20\x20\x20}\n\n\x20Example\x203:\x20Compute\x20Duration\x20from\x20dat\
299     etime.timedelta\x20in\x20Python.\n\n\x20\x20\x20\x20\x20td\x20=\x20datet\
300     ime.timedelta(days=3,\x20minutes=10)\n\x20\x20\x20\x20\x20duration\x20=\
301     \x20Duration()\n\x20\x20\x20\x20\x20duration.FromTimedelta(td)\n\n\n\n\n\
302     \n\x03\x04\0\x01\x12\x03Z\x08\x10\np\n\x04\x04\0\x02\0\x12\x03^\x02\x14\
303     \x1ac\x20Signed\x20seconds\x20of\x20the\x20span\x20of\x20time.\x20Must\
304     \x20be\x20from\x20-315,576,000,000\n\x20to\x20+315,576,000,000\x20inclus\
305     ive.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03^\x02\x07\n\x0c\n\x05\x04\0\
306     \x02\0\x01\x12\x03^\x08\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03^\x12\x13\
307     \n\x83\x03\n\x04\x04\0\x02\x01\x12\x03f\x02\x12\x1a\xf5\x02\x20Signed\
308     \x20fractions\x20of\x20a\x20second\x20at\x20nanosecond\x20resolution\x20\
309     of\x20the\x20span\n\x20of\x20time.\x20Durations\x20less\x20than\x20one\
310     \x20second\x20are\x20represented\x20with\x20a\x200\n\x20`seconds`\x20fie\
311     ld\x20and\x20a\x20positive\x20or\x20negative\x20`nanos`\x20field.\x20For\
312     \x20durations\n\x20of\x20one\x20second\x20or\x20more,\x20a\x20non-zero\
313     \x20value\x20for\x20the\x20`nanos`\x20field\x20must\x20be\n\x20of\x20the\
314     \x20same\x20sign\x20as\x20the\x20`seconds`\x20field.\x20Must\x20be\x20fr\
315     om\x20-999,999,999\n\x20to\x20+999,999,999\x20inclusive.\n\n\x0c\n\x05\
316     \x04\0\x02\x01\x05\x12\x03f\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\
317     \x03f\x08\r\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03f\x10\x11b\x06proto3\
318 ";
319 
320 static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
321 
parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto322 fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
323     ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
324 }
325 
file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto326 pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
327     unsafe {
328         file_descriptor_proto_lazy.get(|| {
329             parse_descriptor_proto()
330         })
331     }
332 }
333