protobuf/well_known_types/
struct_pb.rs

1// This file is generated by rust-protobuf 2.27.1. 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#![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//! Generated file from `google/protobuf/struct.proto`
21
22#[derive(PartialEq,Clone,Default)]
23#[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))]
24pub struct Struct {
25    // message fields
26    pub fields: ::std::collections::HashMap<::std::string::String, Value>,
27    // special fields
28    #[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 Struct {
35    fn default() -> &'a Struct {
36        <Struct as crate::Message>::default_instance()
37    }
38}
39
40impl Struct {
41    pub fn new() -> Struct {
42        ::std::default::Default::default()
43    }
44
45    // repeated .google.protobuf.Struct.FieldsEntry fields = 1;
46
47
48    pub fn get_fields(&self) -> &::std::collections::HashMap<::std::string::String, Value> {
49        &self.fields
50    }
51    pub fn clear_fields(&mut self) {
52        self.fields.clear();
53    }
54
55    // Param is passed by value, moved
56    pub fn set_fields(&mut self, v: ::std::collections::HashMap<::std::string::String, Value>) {
57        self.fields = v;
58    }
59
60    // Mutable pointer to the field.
61    pub fn mut_fields(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, Value> {
62        &mut self.fields
63    }
64
65    // Take field
66    pub fn take_fields(&mut self) -> ::std::collections::HashMap<::std::string::String, Value> {
67        ::std::mem::replace(&mut self.fields, ::std::collections::HashMap::new())
68    }
69}
70
71impl crate::Message for Struct {
72    fn is_initialized(&self) -> bool {
73        true
74    }
75
76    fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> {
77        while !is.eof()? {
78            let (field_number, wire_type) = is.read_tag_unpack()?;
79            match field_number {
80                1 => {
81                    crate::rt::read_map_into::<crate::types::ProtobufTypeString, crate::types::ProtobufTypeMessage<Value>>(wire_type, is, &mut self.fields)?;
82                },
83                _ => {
84                    crate::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
85                },
86            };
87        }
88        ::std::result::Result::Ok(())
89    }
90
91    // Compute sizes of nested messages
92    #[allow(unused_variables)]
93    fn compute_size(&self) -> u32 {
94        let mut my_size = 0;
95        my_size += crate::rt::compute_map_size::<crate::types::ProtobufTypeString, crate::types::ProtobufTypeMessage<Value>>(1, &self.fields);
96        my_size += crate::rt::unknown_fields_size(self.get_unknown_fields());
97        self.cached_size.set(my_size);
98        my_size
99    }
100
101    fn write_to_with_cached_sizes(&self, os: &mut crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> {
102        crate::rt::write_map_with_cached_sizes::<crate::types::ProtobufTypeString, crate::types::ProtobufTypeMessage<Value>>(1, &self.fields, os)?;
103        os.write_unknown_fields(self.get_unknown_fields())?;
104        ::std::result::Result::Ok(())
105    }
106
107    fn get_cached_size(&self) -> u32 {
108        self.cached_size.get()
109    }
110
111    fn get_unknown_fields(&self) -> &crate::UnknownFields {
112        &self.unknown_fields
113    }
114
115    fn mut_unknown_fields(&mut self) -> &mut crate::UnknownFields {
116        &mut self.unknown_fields
117    }
118
119    fn as_any(&self) -> &dyn (::std::any::Any) {
120        self as &dyn (::std::any::Any)
121    }
122    fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
123        self as &mut dyn (::std::any::Any)
124    }
125    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
126        self
127    }
128
129    fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor {
130        Self::descriptor_static()
131    }
132
133    fn new() -> Struct {
134        Struct::new()
135    }
136
137    fn descriptor_static() -> &'static crate::reflect::MessageDescriptor {
138        static descriptor: crate::rt::LazyV2<crate::reflect::MessageDescriptor> = crate::rt::LazyV2::INIT;
139        descriptor.get(|| {
140            let mut fields = ::std::vec::Vec::new();
141            fields.push(crate::reflect::accessor::make_map_accessor::<_, crate::types::ProtobufTypeString, crate::types::ProtobufTypeMessage<Value>>(
142                "fields",
143                |m: &Struct| { &m.fields },
144                |m: &mut Struct| { &mut m.fields },
145            ));
146            crate::reflect::MessageDescriptor::new_pb_name::<Struct>(
147                "Struct",
148                fields,
149                file_descriptor_proto()
150            )
151        })
152    }
153
154    fn default_instance() -> &'static Struct {
155        static instance: crate::rt::LazyV2<Struct> = crate::rt::LazyV2::INIT;
156        instance.get(Struct::new)
157    }
158}
159
160impl crate::Clear for Struct {
161    fn clear(&mut self) {
162        self.fields.clear();
163        self.unknown_fields.clear();
164    }
165}
166
167impl ::std::fmt::Debug for Struct {
168    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
169        crate::text_format::fmt(self, f)
170    }
171}
172
173impl crate::reflect::ProtobufValue for Struct {
174    fn as_ref(&self) -> crate::reflect::ReflectValueRef {
175        crate::reflect::ReflectValueRef::Message(self)
176    }
177}
178
179#[derive(PartialEq,Clone,Default)]
180#[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))]
181pub struct Value {
182    // message oneof groups
183    pub kind: ::std::option::Option<Value_oneof_kind>,
184    // special fields
185    #[cfg_attr(feature = "with-serde", serde(skip))]
186    pub unknown_fields: crate::UnknownFields,
187    #[cfg_attr(feature = "with-serde", serde(skip))]
188    pub cached_size: crate::CachedSize,
189}
190
191impl<'a> ::std::default::Default for &'a Value {
192    fn default() -> &'a Value {
193        <Value as crate::Message>::default_instance()
194    }
195}
196
197#[derive(Clone,PartialEq,Debug)]
198#[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))]
199pub enum Value_oneof_kind {
200    null_value(NullValue),
201    number_value(f64),
202    string_value(::std::string::String),
203    bool_value(bool),
204    struct_value(Struct),
205    list_value(ListValue),
206}
207
208impl Value {
209    pub fn new() -> Value {
210        ::std::default::Default::default()
211    }
212
213    // .google.protobuf.NullValue null_value = 1;
214
215
216    pub fn get_null_value(&self) -> NullValue {
217        match self.kind {
218            ::std::option::Option::Some(Value_oneof_kind::null_value(v)) => v,
219            _ => NullValue::NULL_VALUE,
220        }
221    }
222    pub fn clear_null_value(&mut self) {
223        self.kind = ::std::option::Option::None;
224    }
225
226    pub fn has_null_value(&self) -> bool {
227        match self.kind {
228            ::std::option::Option::Some(Value_oneof_kind::null_value(..)) => true,
229            _ => false,
230        }
231    }
232
233    // Param is passed by value, moved
234    pub fn set_null_value(&mut self, v: NullValue) {
235        self.kind = ::std::option::Option::Some(Value_oneof_kind::null_value(v))
236    }
237
238    // double number_value = 2;
239
240
241    pub fn get_number_value(&self) -> f64 {
242        match self.kind {
243            ::std::option::Option::Some(Value_oneof_kind::number_value(v)) => v,
244            _ => 0.,
245        }
246    }
247    pub fn clear_number_value(&mut self) {
248        self.kind = ::std::option::Option::None;
249    }
250
251    pub fn has_number_value(&self) -> bool {
252        match self.kind {
253            ::std::option::Option::Some(Value_oneof_kind::number_value(..)) => true,
254            _ => false,
255        }
256    }
257
258    // Param is passed by value, moved
259    pub fn set_number_value(&mut self, v: f64) {
260        self.kind = ::std::option::Option::Some(Value_oneof_kind::number_value(v))
261    }
262
263    // string string_value = 3;
264
265
266    pub fn get_string_value(&self) -> &str {
267        match self.kind {
268            ::std::option::Option::Some(Value_oneof_kind::string_value(ref v)) => v,
269            _ => "",
270        }
271    }
272    pub fn clear_string_value(&mut self) {
273        self.kind = ::std::option::Option::None;
274    }
275
276    pub fn has_string_value(&self) -> bool {
277        match self.kind {
278            ::std::option::Option::Some(Value_oneof_kind::string_value(..)) => true,
279            _ => false,
280        }
281    }
282
283    // Param is passed by value, moved
284    pub fn set_string_value(&mut self, v: ::std::string::String) {
285        self.kind = ::std::option::Option::Some(Value_oneof_kind::string_value(v))
286    }
287
288    // Mutable pointer to the field.
289    pub fn mut_string_value(&mut self) -> &mut ::std::string::String {
290        if let ::std::option::Option::Some(Value_oneof_kind::string_value(_)) = self.kind {
291        } else {
292            self.kind = ::std::option::Option::Some(Value_oneof_kind::string_value(::std::string::String::new()));
293        }
294        match self.kind {
295            ::std::option::Option::Some(Value_oneof_kind::string_value(ref mut v)) => v,
296            _ => panic!(),
297        }
298    }
299
300    // Take field
301    pub fn take_string_value(&mut self) -> ::std::string::String {
302        if self.has_string_value() {
303            match self.kind.take() {
304                ::std::option::Option::Some(Value_oneof_kind::string_value(v)) => v,
305                _ => panic!(),
306            }
307        } else {
308            ::std::string::String::new()
309        }
310    }
311
312    // bool bool_value = 4;
313
314
315    pub fn get_bool_value(&self) -> bool {
316        match self.kind {
317            ::std::option::Option::Some(Value_oneof_kind::bool_value(v)) => v,
318            _ => false,
319        }
320    }
321    pub fn clear_bool_value(&mut self) {
322        self.kind = ::std::option::Option::None;
323    }
324
325    pub fn has_bool_value(&self) -> bool {
326        match self.kind {
327            ::std::option::Option::Some(Value_oneof_kind::bool_value(..)) => true,
328            _ => false,
329        }
330    }
331
332    // Param is passed by value, moved
333    pub fn set_bool_value(&mut self, v: bool) {
334        self.kind = ::std::option::Option::Some(Value_oneof_kind::bool_value(v))
335    }
336
337    // .google.protobuf.Struct struct_value = 5;
338
339
340    pub fn get_struct_value(&self) -> &Struct {
341        match self.kind {
342            ::std::option::Option::Some(Value_oneof_kind::struct_value(ref v)) => v,
343            _ => <Struct as crate::Message>::default_instance(),
344        }
345    }
346    pub fn clear_struct_value(&mut self) {
347        self.kind = ::std::option::Option::None;
348    }
349
350    pub fn has_struct_value(&self) -> bool {
351        match self.kind {
352            ::std::option::Option::Some(Value_oneof_kind::struct_value(..)) => true,
353            _ => false,
354        }
355    }
356
357    // Param is passed by value, moved
358    pub fn set_struct_value(&mut self, v: Struct) {
359        self.kind = ::std::option::Option::Some(Value_oneof_kind::struct_value(v))
360    }
361
362    // Mutable pointer to the field.
363    pub fn mut_struct_value(&mut self) -> &mut Struct {
364        if let ::std::option::Option::Some(Value_oneof_kind::struct_value(_)) = self.kind {
365        } else {
366            self.kind = ::std::option::Option::Some(Value_oneof_kind::struct_value(Struct::new()));
367        }
368        match self.kind {
369            ::std::option::Option::Some(Value_oneof_kind::struct_value(ref mut v)) => v,
370            _ => panic!(),
371        }
372    }
373
374    // Take field
375    pub fn take_struct_value(&mut self) -> Struct {
376        if self.has_struct_value() {
377            match self.kind.take() {
378                ::std::option::Option::Some(Value_oneof_kind::struct_value(v)) => v,
379                _ => panic!(),
380            }
381        } else {
382            Struct::new()
383        }
384    }
385
386    // .google.protobuf.ListValue list_value = 6;
387
388
389    pub fn get_list_value(&self) -> &ListValue {
390        match self.kind {
391            ::std::option::Option::Some(Value_oneof_kind::list_value(ref v)) => v,
392            _ => <ListValue as crate::Message>::default_instance(),
393        }
394    }
395    pub fn clear_list_value(&mut self) {
396        self.kind = ::std::option::Option::None;
397    }
398
399    pub fn has_list_value(&self) -> bool {
400        match self.kind {
401            ::std::option::Option::Some(Value_oneof_kind::list_value(..)) => true,
402            _ => false,
403        }
404    }
405
406    // Param is passed by value, moved
407    pub fn set_list_value(&mut self, v: ListValue) {
408        self.kind = ::std::option::Option::Some(Value_oneof_kind::list_value(v))
409    }
410
411    // Mutable pointer to the field.
412    pub fn mut_list_value(&mut self) -> &mut ListValue {
413        if let ::std::option::Option::Some(Value_oneof_kind::list_value(_)) = self.kind {
414        } else {
415            self.kind = ::std::option::Option::Some(Value_oneof_kind::list_value(ListValue::new()));
416        }
417        match self.kind {
418            ::std::option::Option::Some(Value_oneof_kind::list_value(ref mut v)) => v,
419            _ => panic!(),
420        }
421    }
422
423    // Take field
424    pub fn take_list_value(&mut self) -> ListValue {
425        if self.has_list_value() {
426            match self.kind.take() {
427                ::std::option::Option::Some(Value_oneof_kind::list_value(v)) => v,
428                _ => panic!(),
429            }
430        } else {
431            ListValue::new()
432        }
433    }
434}
435
436impl crate::Message for Value {
437    fn is_initialized(&self) -> bool {
438        if let Some(Value_oneof_kind::struct_value(ref v)) = self.kind {
439            if !v.is_initialized() {
440                return false;
441            }
442        }
443        if let Some(Value_oneof_kind::list_value(ref v)) = self.kind {
444            if !v.is_initialized() {
445                return false;
446            }
447        }
448        true
449    }
450
451    fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> {
452        while !is.eof()? {
453            let (field_number, wire_type) = is.read_tag_unpack()?;
454            match field_number {
455                1 => {
456                    if wire_type != crate::wire_format::WireTypeVarint {
457                        return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type));
458                    }
459                    self.kind = ::std::option::Option::Some(Value_oneof_kind::null_value(is.read_enum()?));
460                },
461                2 => {
462                    if wire_type != crate::wire_format::WireTypeFixed64 {
463                        return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type));
464                    }
465                    self.kind = ::std::option::Option::Some(Value_oneof_kind::number_value(is.read_double()?));
466                },
467                3 => {
468                    if wire_type != crate::wire_format::WireTypeLengthDelimited {
469                        return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type));
470                    }
471                    self.kind = ::std::option::Option::Some(Value_oneof_kind::string_value(is.read_string()?));
472                },
473                4 => {
474                    if wire_type != crate::wire_format::WireTypeVarint {
475                        return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type));
476                    }
477                    self.kind = ::std::option::Option::Some(Value_oneof_kind::bool_value(is.read_bool()?));
478                },
479                5 => {
480                    if wire_type != crate::wire_format::WireTypeLengthDelimited {
481                        return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type));
482                    }
483                    self.kind = ::std::option::Option::Some(Value_oneof_kind::struct_value(is.read_message()?));
484                },
485                6 => {
486                    if wire_type != crate::wire_format::WireTypeLengthDelimited {
487                        return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type));
488                    }
489                    self.kind = ::std::option::Option::Some(Value_oneof_kind::list_value(is.read_message()?));
490                },
491                _ => {
492                    crate::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
493                },
494            };
495        }
496        ::std::result::Result::Ok(())
497    }
498
499    // Compute sizes of nested messages
500    #[allow(unused_variables)]
501    fn compute_size(&self) -> u32 {
502        let mut my_size = 0;
503        if let ::std::option::Option::Some(ref v) = self.kind {
504            match v {
505                &Value_oneof_kind::null_value(v) => {
506                    my_size += crate::rt::enum_size(1, v);
507                },
508                &Value_oneof_kind::number_value(v) => {
509                    my_size += 9;
510                },
511                &Value_oneof_kind::string_value(ref v) => {
512                    my_size += crate::rt::string_size(3, &v);
513                },
514                &Value_oneof_kind::bool_value(v) => {
515                    my_size += 2;
516                },
517                &Value_oneof_kind::struct_value(ref v) => {
518                    let len = v.compute_size();
519                    my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len;
520                },
521                &Value_oneof_kind::list_value(ref v) => {
522                    let len = v.compute_size();
523                    my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len;
524                },
525            };
526        }
527        my_size += crate::rt::unknown_fields_size(self.get_unknown_fields());
528        self.cached_size.set(my_size);
529        my_size
530    }
531
532    fn write_to_with_cached_sizes(&self, os: &mut crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> {
533        if let ::std::option::Option::Some(ref v) = self.kind {
534            match v {
535                &Value_oneof_kind::null_value(v) => {
536                    os.write_enum(1, crate::ProtobufEnum::value(&v))?;
537                },
538                &Value_oneof_kind::number_value(v) => {
539                    os.write_double(2, v)?;
540                },
541                &Value_oneof_kind::string_value(ref v) => {
542                    os.write_string(3, v)?;
543                },
544                &Value_oneof_kind::bool_value(v) => {
545                    os.write_bool(4, v)?;
546                },
547                &Value_oneof_kind::struct_value(ref v) => {
548                    os.write_tag(5, crate::wire_format::WireTypeLengthDelimited)?;
549                    os.write_raw_varint32(v.get_cached_size())?;
550                    v.write_to_with_cached_sizes(os)?;
551                },
552                &Value_oneof_kind::list_value(ref v) => {
553                    os.write_tag(6, crate::wire_format::WireTypeLengthDelimited)?;
554                    os.write_raw_varint32(v.get_cached_size())?;
555                    v.write_to_with_cached_sizes(os)?;
556                },
557            };
558        }
559        os.write_unknown_fields(self.get_unknown_fields())?;
560        ::std::result::Result::Ok(())
561    }
562
563    fn get_cached_size(&self) -> u32 {
564        self.cached_size.get()
565    }
566
567    fn get_unknown_fields(&self) -> &crate::UnknownFields {
568        &self.unknown_fields
569    }
570
571    fn mut_unknown_fields(&mut self) -> &mut crate::UnknownFields {
572        &mut self.unknown_fields
573    }
574
575    fn as_any(&self) -> &dyn (::std::any::Any) {
576        self as &dyn (::std::any::Any)
577    }
578    fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
579        self as &mut dyn (::std::any::Any)
580    }
581    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
582        self
583    }
584
585    fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor {
586        Self::descriptor_static()
587    }
588
589    fn new() -> Value {
590        Value::new()
591    }
592
593    fn descriptor_static() -> &'static crate::reflect::MessageDescriptor {
594        static descriptor: crate::rt::LazyV2<crate::reflect::MessageDescriptor> = crate::rt::LazyV2::INIT;
595        descriptor.get(|| {
596            let mut fields = ::std::vec::Vec::new();
597            fields.push(crate::reflect::accessor::make_singular_enum_accessor::<_, NullValue>(
598                "null_value",
599                Value::has_null_value,
600                Value::get_null_value,
601            ));
602            fields.push(crate::reflect::accessor::make_singular_f64_accessor::<_>(
603                "number_value",
604                Value::has_number_value,
605                Value::get_number_value,
606            ));
607            fields.push(crate::reflect::accessor::make_singular_string_accessor::<_>(
608                "string_value",
609                Value::has_string_value,
610                Value::get_string_value,
611            ));
612            fields.push(crate::reflect::accessor::make_singular_bool_accessor::<_>(
613                "bool_value",
614                Value::has_bool_value,
615                Value::get_bool_value,
616            ));
617            fields.push(crate::reflect::accessor::make_singular_message_accessor::<_, Struct>(
618                "struct_value",
619                Value::has_struct_value,
620                Value::get_struct_value,
621            ));
622            fields.push(crate::reflect::accessor::make_singular_message_accessor::<_, ListValue>(
623                "list_value",
624                Value::has_list_value,
625                Value::get_list_value,
626            ));
627            crate::reflect::MessageDescriptor::new_pb_name::<Value>(
628                "Value",
629                fields,
630                file_descriptor_proto()
631            )
632        })
633    }
634
635    fn default_instance() -> &'static Value {
636        static instance: crate::rt::LazyV2<Value> = crate::rt::LazyV2::INIT;
637        instance.get(Value::new)
638    }
639}
640
641impl crate::Clear for Value {
642    fn clear(&mut self) {
643        self.kind = ::std::option::Option::None;
644        self.kind = ::std::option::Option::None;
645        self.kind = ::std::option::Option::None;
646        self.kind = ::std::option::Option::None;
647        self.kind = ::std::option::Option::None;
648        self.kind = ::std::option::Option::None;
649        self.unknown_fields.clear();
650    }
651}
652
653impl ::std::fmt::Debug for Value {
654    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
655        crate::text_format::fmt(self, f)
656    }
657}
658
659impl crate::reflect::ProtobufValue for Value {
660    fn as_ref(&self) -> crate::reflect::ReflectValueRef {
661        crate::reflect::ReflectValueRef::Message(self)
662    }
663}
664
665#[derive(PartialEq,Clone,Default)]
666#[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))]
667pub struct ListValue {
668    // message fields
669    pub values: crate::RepeatedField<Value>,
670    // special fields
671    #[cfg_attr(feature = "with-serde", serde(skip))]
672    pub unknown_fields: crate::UnknownFields,
673    #[cfg_attr(feature = "with-serde", serde(skip))]
674    pub cached_size: crate::CachedSize,
675}
676
677impl<'a> ::std::default::Default for &'a ListValue {
678    fn default() -> &'a ListValue {
679        <ListValue as crate::Message>::default_instance()
680    }
681}
682
683impl ListValue {
684    pub fn new() -> ListValue {
685        ::std::default::Default::default()
686    }
687
688    // repeated .google.protobuf.Value values = 1;
689
690
691    pub fn get_values(&self) -> &[Value] {
692        &self.values
693    }
694    pub fn clear_values(&mut self) {
695        self.values.clear();
696    }
697
698    // Param is passed by value, moved
699    pub fn set_values(&mut self, v: crate::RepeatedField<Value>) {
700        self.values = v;
701    }
702
703    // Mutable pointer to the field.
704    pub fn mut_values(&mut self) -> &mut crate::RepeatedField<Value> {
705        &mut self.values
706    }
707
708    // Take field
709    pub fn take_values(&mut self) -> crate::RepeatedField<Value> {
710        ::std::mem::replace(&mut self.values, crate::RepeatedField::new())
711    }
712}
713
714impl crate::Message for ListValue {
715    fn is_initialized(&self) -> bool {
716        for v in &self.values {
717            if !v.is_initialized() {
718                return false;
719            }
720        };
721        true
722    }
723
724    fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> {
725        while !is.eof()? {
726            let (field_number, wire_type) = is.read_tag_unpack()?;
727            match field_number {
728                1 => {
729                    crate::rt::read_repeated_message_into(wire_type, is, &mut self.values)?;
730                },
731                _ => {
732                    crate::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
733                },
734            };
735        }
736        ::std::result::Result::Ok(())
737    }
738
739    // Compute sizes of nested messages
740    #[allow(unused_variables)]
741    fn compute_size(&self) -> u32 {
742        let mut my_size = 0;
743        for value in &self.values {
744            let len = value.compute_size();
745            my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len;
746        };
747        my_size += crate::rt::unknown_fields_size(self.get_unknown_fields());
748        self.cached_size.set(my_size);
749        my_size
750    }
751
752    fn write_to_with_cached_sizes(&self, os: &mut crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> {
753        for v in &self.values {
754            os.write_tag(1, crate::wire_format::WireTypeLengthDelimited)?;
755            os.write_raw_varint32(v.get_cached_size())?;
756            v.write_to_with_cached_sizes(os)?;
757        };
758        os.write_unknown_fields(self.get_unknown_fields())?;
759        ::std::result::Result::Ok(())
760    }
761
762    fn get_cached_size(&self) -> u32 {
763        self.cached_size.get()
764    }
765
766    fn get_unknown_fields(&self) -> &crate::UnknownFields {
767        &self.unknown_fields
768    }
769
770    fn mut_unknown_fields(&mut self) -> &mut crate::UnknownFields {
771        &mut self.unknown_fields
772    }
773
774    fn as_any(&self) -> &dyn (::std::any::Any) {
775        self as &dyn (::std::any::Any)
776    }
777    fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
778        self as &mut dyn (::std::any::Any)
779    }
780    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
781        self
782    }
783
784    fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor {
785        Self::descriptor_static()
786    }
787
788    fn new() -> ListValue {
789        ListValue::new()
790    }
791
792    fn descriptor_static() -> &'static crate::reflect::MessageDescriptor {
793        static descriptor: crate::rt::LazyV2<crate::reflect::MessageDescriptor> = crate::rt::LazyV2::INIT;
794        descriptor.get(|| {
795            let mut fields = ::std::vec::Vec::new();
796            fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage<Value>>(
797                "values",
798                |m: &ListValue| { &m.values },
799                |m: &mut ListValue| { &mut m.values },
800            ));
801            crate::reflect::MessageDescriptor::new_pb_name::<ListValue>(
802                "ListValue",
803                fields,
804                file_descriptor_proto()
805            )
806        })
807    }
808
809    fn default_instance() -> &'static ListValue {
810        static instance: crate::rt::LazyV2<ListValue> = crate::rt::LazyV2::INIT;
811        instance.get(ListValue::new)
812    }
813}
814
815impl crate::Clear for ListValue {
816    fn clear(&mut self) {
817        self.values.clear();
818        self.unknown_fields.clear();
819    }
820}
821
822impl ::std::fmt::Debug for ListValue {
823    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
824        crate::text_format::fmt(self, f)
825    }
826}
827
828impl crate::reflect::ProtobufValue for ListValue {
829    fn as_ref(&self) -> crate::reflect::ReflectValueRef {
830        crate::reflect::ReflectValueRef::Message(self)
831    }
832}
833
834#[derive(Clone,PartialEq,Eq,Debug,Hash)]
835#[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))]
836pub enum NullValue {
837    NULL_VALUE = 0,
838}
839
840impl crate::ProtobufEnum for NullValue {
841    fn value(&self) -> i32 {
842        *self as i32
843    }
844
845    fn from_i32(value: i32) -> ::std::option::Option<NullValue> {
846        match value {
847            0 => ::std::option::Option::Some(NullValue::NULL_VALUE),
848            _ => ::std::option::Option::None
849        }
850    }
851
852    fn values() -> &'static [Self] {
853        static values: &'static [NullValue] = &[
854            NullValue::NULL_VALUE,
855        ];
856        values
857    }
858
859    fn enum_descriptor_static() -> &'static crate::reflect::EnumDescriptor {
860        static descriptor: crate::rt::LazyV2<crate::reflect::EnumDescriptor> = crate::rt::LazyV2::INIT;
861        descriptor.get(|| {
862            crate::reflect::EnumDescriptor::new_pb_name::<NullValue>("NullValue", file_descriptor_proto())
863        })
864    }
865}
866
867impl ::std::marker::Copy for NullValue {
868}
869
870impl ::std::default::Default for NullValue {
871    fn default() -> Self {
872        NullValue::NULL_VALUE
873    }
874}
875
876impl crate::reflect::ProtobufValue for NullValue {
877    fn as_ref(&self) -> crate::reflect::ReflectValueRef {
878        crate::reflect::ReflectValueRef::Enum(crate::ProtobufEnum::descriptor(self))
879    }
880}
881
882static file_descriptor_proto_data: &'static [u8] = b"\
883    \n\x1cgoogle/protobuf/struct.proto\x12\x0fgoogle.protobuf\"\x98\x01\n\
884    \x06Struct\x12;\n\x06fields\x18\x01\x20\x03(\x0b2#.google.protobuf.Struc\
885    t.FieldsEntryR\x06fields\x1aQ\n\x0bFieldsEntry\x12\x10\n\x03key\x18\x01\
886    \x20\x01(\tR\x03key\x12,\n\x05value\x18\x02\x20\x01(\x0b2\x16.google.pro\
887    tobuf.ValueR\x05value:\x028\x01\"\xb2\x02\n\x05Value\x12;\n\nnull_value\
888    \x18\x01\x20\x01(\x0e2\x1a.google.protobuf.NullValueH\0R\tnullValue\x12#\
889    \n\x0cnumber_value\x18\x02\x20\x01(\x01H\0R\x0bnumberValue\x12#\n\x0cstr\
890    ing_value\x18\x03\x20\x01(\tH\0R\x0bstringValue\x12\x1f\n\nbool_value\
891    \x18\x04\x20\x01(\x08H\0R\tboolValue\x12<\n\x0cstruct_value\x18\x05\x20\
892    \x01(\x0b2\x17.google.protobuf.StructH\0R\x0bstructValue\x12;\n\nlist_va\
893    lue\x18\x06\x20\x01(\x0b2\x1a.google.protobuf.ListValueH\0R\tlistValueB\
894    \x06\n\x04kind\";\n\tListValue\x12.\n\x06values\x18\x01\x20\x03(\x0b2\
895    \x16.google.protobuf.ValueR\x06values*\x1b\n\tNullValue\x12\x0e\n\nNULL_\
896    VALUE\x10\0B\x7f\n\x13com.google.protobufB\x0bStructProtoP\x01Z/google.g\
897    olang.org/protobuf/types/known/structpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\
898    \x02\x1eGoogle.Protobuf.WellKnownTypesJ\x99\x1d\n\x06\x12\x04\x1e\0^\x01\
899    \n\xcc\x0c\n\x01\x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Protocol\x20Buffers\
900    \x20-\x20Google's\x20data\x20interchange\x20format\n\x20Copyright\x20200\
901    8\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20https://devel\
902    opers.google.com/protocol-buffers/\n\n\x20Redistribution\x20and\x20use\
903    \x20in\x20source\x20and\x20binary\x20forms,\x20with\x20or\x20without\n\
904    \x20modification,\x20are\x20permitted\x20provided\x20that\x20the\x20foll\
905    owing\x20conditions\x20are\n\x20met:\n\n\x20\x20\x20\x20\x20*\x20Redistr\
906    ibutions\x20of\x20source\x20code\x20must\x20retain\x20the\x20above\x20co\
907    pyright\n\x20notice,\x20this\x20list\x20of\x20conditions\x20and\x20the\
908    \x20following\x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Redistributions\
909    \x20in\x20binary\x20form\x20must\x20reproduce\x20the\x20above\n\x20copyr\
910    ight\x20notice,\x20this\x20list\x20of\x20conditions\x20and\x20the\x20fol\
911    lowing\x20disclaimer\n\x20in\x20the\x20documentation\x20and/or\x20other\
912    \x20materials\x20provided\x20with\x20the\n\x20distribution.\n\x20\x20\
913    \x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\x20Inc.\x20nor\
914    \x20the\x20names\x20of\x20its\n\x20contributors\x20may\x20be\x20used\x20\
915    to\x20endorse\x20or\x20promote\x20products\x20derived\x20from\n\x20this\
916    \x20software\x20without\x20specific\x20prior\x20written\x20permission.\n\
917    \n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIGHT\x20HO\
918    LDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20EXPRESS\
919    \x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\x20LIMITE\
920    D\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABILITY\x20AND\
921    \x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20DISCLAIMED.\
922    \x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\x20OR\x20C\
923    ONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIRECT,\x20INC\
924    IDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\
925    \x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREMENT\x20OF\
926    \x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE,\n\x20DA\
927    TA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOWEVER\x20C\
928    AUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WHETHER\x20\
929    IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INCLUDING\
930    \x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\x20OUT\
931    \x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\x20ADVIS\
932    ED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\n\x01\
933    \x02\x12\x03\x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\x12\
934    \x03\"\0;\n\x08\n\x01\x08\x12\x03#\0\x1f\n\t\n\x02\x08\x1f\x12\x03#\0\
935    \x1f\n\x08\n\x01\x08\x12\x03$\0F\n\t\n\x02\x08\x0b\x12\x03$\0F\n\x08\n\
936    \x01\x08\x12\x03%\0,\n\t\n\x02\x08\x01\x12\x03%\0,\n\x08\n\x01\x08\x12\
937    \x03&\0,\n\t\n\x02\x08\x08\x12\x03&\0,\n\x08\n\x01\x08\x12\x03'\0\"\n\t\
938    \n\x02\x08\n\x12\x03'\0\"\n\x08\n\x01\x08\x12\x03(\0!\n\t\n\x02\x08$\x12\
939    \x03(\0!\n\xb3\x03\n\x02\x04\0\x12\x042\05\x01\x1a\xa6\x03\x20`Struct`\
940    \x20represents\x20a\x20structured\x20data\x20value,\x20consisting\x20of\
941    \x20fields\n\x20which\x20map\x20to\x20dynamically\x20typed\x20values.\
942    \x20In\x20some\x20languages,\x20`Struct`\n\x20might\x20be\x20supported\
943    \x20by\x20a\x20native\x20representation.\x20For\x20example,\x20in\n\x20s\
944    cripting\x20languages\x20like\x20JS\x20a\x20struct\x20is\x20represented\
945    \x20as\x20an\n\x20object.\x20The\x20details\x20of\x20that\x20representat\
946    ion\x20are\x20described\x20together\n\x20with\x20the\x20proto\x20support\
947    \x20for\x20the\x20language.\n\n\x20The\x20JSON\x20representation\x20for\
948    \x20`Struct`\x20is\x20JSON\x20object.\n\n\n\n\x03\x04\0\x01\x12\x032\x08\
949    \x0e\n9\n\x04\x04\0\x02\0\x12\x034\x02\x20\x1a,\x20Unordered\x20map\x20o\
950    f\x20dynamically\x20typed\x20values.\n\n\x0c\n\x05\x04\0\x02\0\x06\x12\
951    \x034\x02\x14\n\x0c\n\x05\x04\0\x02\0\x01\x12\x034\x15\x1b\n\x0c\n\x05\
952    \x04\0\x02\0\x03\x12\x034\x1e\x1f\n\xc3\x02\n\x02\x04\x01\x12\x04=\0M\
953    \x01\x1a\xb6\x02\x20`Value`\x20represents\x20a\x20dynamically\x20typed\
954    \x20value\x20which\x20can\x20be\x20either\n\x20null,\x20a\x20number,\x20\
955    a\x20string,\x20a\x20boolean,\x20a\x20recursive\x20struct\x20value,\x20o\
956    r\x20a\n\x20list\x20of\x20values.\x20A\x20producer\x20of\x20value\x20is\
957    \x20expected\x20to\x20set\x20one\x20of\x20that\n\x20variants,\x20absence\
958    \x20of\x20any\x20variant\x20indicates\x20an\x20error.\n\n\x20The\x20JSON\
959    \x20representation\x20for\x20`Value`\x20is\x20JSON\x20value.\n\n\n\n\x03\
960    \x04\x01\x01\x12\x03=\x08\r\n\"\n\x04\x04\x01\x08\0\x12\x04?\x02L\x03\
961    \x1a\x14\x20The\x20kind\x20of\x20value.\n\n\x0c\n\x05\x04\x01\x08\0\x01\
962    \x12\x03?\x08\x0c\n'\n\x04\x04\x01\x02\0\x12\x03A\x04\x1d\x1a\x1a\x20Rep\
963    resents\x20a\x20null\x20value.\n\n\x0c\n\x05\x04\x01\x02\0\x06\x12\x03A\
964    \x04\r\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03A\x0e\x18\n\x0c\n\x05\x04\
965    \x01\x02\0\x03\x12\x03A\x1b\x1c\n)\n\x04\x04\x01\x02\x01\x12\x03C\x04\
966    \x1c\x1a\x1c\x20Represents\x20a\x20double\x20value.\n\n\x0c\n\x05\x04\
967    \x01\x02\x01\x05\x12\x03C\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03C\
968    \x0b\x17\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03C\x1a\x1b\n)\n\x04\x04\
969    \x01\x02\x02\x12\x03E\x04\x1c\x1a\x1c\x20Represents\x20a\x20string\x20va\
970    lue.\n\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03E\x04\n\n\x0c\n\x05\x04\
971    \x01\x02\x02\x01\x12\x03E\x0b\x17\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\
972    \x03E\x1a\x1b\n*\n\x04\x04\x01\x02\x03\x12\x03G\x04\x18\x1a\x1d\x20Repre\
973    sents\x20a\x20boolean\x20value.\n\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\
974    \x03G\x04\x08\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03G\t\x13\n\x0c\n\x05\
975    \x04\x01\x02\x03\x03\x12\x03G\x16\x17\n-\n\x04\x04\x01\x02\x04\x12\x03I\
976    \x04\x1c\x1a\x20\x20Represents\x20a\x20structured\x20value.\n\n\x0c\n\
977    \x05\x04\x01\x02\x04\x06\x12\x03I\x04\n\n\x0c\n\x05\x04\x01\x02\x04\x01\
978    \x12\x03I\x0b\x17\n\x0c\n\x05\x04\x01\x02\x04\x03\x12\x03I\x1a\x1b\n-\n\
979    \x04\x04\x01\x02\x05\x12\x03K\x04\x1d\x1a\x20\x20Represents\x20a\x20repe\
980    ated\x20`Value`.\n\n\x0c\n\x05\x04\x01\x02\x05\x06\x12\x03K\x04\r\n\x0c\
981    \n\x05\x04\x01\x02\x05\x01\x12\x03K\x0e\x18\n\x0c\n\x05\x04\x01\x02\x05\
982    \x03\x12\x03K\x1b\x1c\n\xa9\x01\n\x02\x05\0\x12\x04S\0V\x01\x1a\x9c\x01\
983    \x20`NullValue`\x20is\x20a\x20singleton\x20enumeration\x20to\x20represen\
984    t\x20the\x20null\x20value\x20for\x20the\n\x20`Value`\x20type\x20union.\n\
985    \n\x20\x20The\x20JSON\x20representation\x20for\x20`NullValue`\x20is\x20J\
986    SON\x20`null`.\n\n\n\n\x03\x05\0\x01\x12\x03S\x05\x0e\n\x1a\n\x04\x05\0\
987    \x02\0\x12\x03U\x02\x11\x1a\r\x20Null\x20value.\n\n\x0c\n\x05\x05\0\x02\
988    \0\x01\x12\x03U\x02\x0c\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03U\x0f\x10\n\
989    \x82\x01\n\x02\x04\x02\x12\x04[\0^\x01\x1av\x20`ListValue`\x20is\x20a\
990    \x20wrapper\x20around\x20a\x20repeated\x20field\x20of\x20values.\n\n\x20\
991    The\x20JSON\x20representation\x20for\x20`ListValue`\x20is\x20JSON\x20arr\
992    ay.\n\n\n\n\x03\x04\x02\x01\x12\x03[\x08\x11\n:\n\x04\x04\x02\x02\0\x12\
993    \x03]\x02\x1c\x1a-\x20Repeated\x20field\x20of\x20dynamically\x20typed\
994    \x20values.\n\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03]\x02\n\n\x0c\n\x05\
995    \x04\x02\x02\0\x06\x12\x03]\x0b\x10\n\x0c\n\x05\x04\x02\x02\0\x01\x12\
996    \x03]\x11\x17\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03]\x1a\x1bb\x06proto3\
997";
998
999static file_descriptor_proto_lazy: crate::rt::LazyV2<crate::descriptor::FileDescriptorProto> = crate::rt::LazyV2::INIT;
1000
1001fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto {
1002    crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
1003}
1004
1005pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto {
1006    file_descriptor_proto_lazy.get(|| {
1007        parse_descriptor_proto()
1008    })
1009}