sleep_protocol/
data.rs

1// This file is generated. Do not edit
2// @generated
3
4// https://github.com/Manishearth/rust-clippy/issues/702
5#![allow(unknown_lints)]
6#![allow(clippy)]
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
21use protobuf::Message as Message_imported_for_functions;
22use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
23
24#[derive(PartialEq,Clone,Default)]
25pub struct Data {
26    // message fields
27    index: ::std::option::Option<u64>,
28    value: ::protobuf::SingularField<::std::vec::Vec<u8>>,
29    nodes: ::protobuf::RepeatedField<Data_Node>,
30    signature: ::protobuf::SingularField<::std::vec::Vec<u8>>,
31    // special fields
32    unknown_fields: ::protobuf::UnknownFields,
33    cached_size: ::protobuf::CachedSize,
34}
35
36// see codegen.rs for the explanation why impl Sync explicitly
37unsafe impl ::std::marker::Sync for Data {}
38
39impl Data {
40    pub fn new() -> Data {
41        ::std::default::Default::default()
42    }
43
44    pub fn default_instance() -> &'static Data {
45        static mut instance: ::protobuf::lazy::Lazy<Data> = ::protobuf::lazy::Lazy {
46            lock: ::protobuf::lazy::ONCE_INIT,
47            ptr: 0 as *const Data,
48        };
49        unsafe {
50            instance.get(Data::new)
51        }
52    }
53
54    // required uint64 index = 1;
55
56    pub fn clear_index(&mut self) {
57        self.index = ::std::option::Option::None;
58    }
59
60    pub fn has_index(&self) -> bool {
61        self.index.is_some()
62    }
63
64    // Param is passed by value, moved
65    pub fn set_index(&mut self, v: u64) {
66        self.index = ::std::option::Option::Some(v);
67    }
68
69    pub fn get_index(&self) -> u64 {
70        self.index.unwrap_or(0)
71    }
72
73    fn get_index_for_reflect(&self) -> &::std::option::Option<u64> {
74        &self.index
75    }
76
77    fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option<u64> {
78        &mut self.index
79    }
80
81    // optional bytes value = 2;
82
83    pub fn clear_value(&mut self) {
84        self.value.clear();
85    }
86
87    pub fn has_value(&self) -> bool {
88        self.value.is_some()
89    }
90
91    // Param is passed by value, moved
92    pub fn set_value(&mut self, v: ::std::vec::Vec<u8>) {
93        self.value = ::protobuf::SingularField::some(v);
94    }
95
96    // Mutable pointer to the field.
97    // If field is not initialized, it is initialized with default value first.
98    pub fn mut_value(&mut self) -> &mut ::std::vec::Vec<u8> {
99        if self.value.is_none() {
100            self.value.set_default();
101        }
102        self.value.as_mut().unwrap()
103    }
104
105    // Take field
106    pub fn take_value(&mut self) -> ::std::vec::Vec<u8> {
107        self.value.take().unwrap_or_else(|| ::std::vec::Vec::new())
108    }
109
110    pub fn get_value(&self) -> &[u8] {
111        match self.value.as_ref() {
112            Some(v) => &v,
113            None => &[],
114        }
115    }
116
117    fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
118        &self.value
119    }
120
121    fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
122        &mut self.value
123    }
124
125    // repeated .Data.Node nodes = 3;
126
127    pub fn clear_nodes(&mut self) {
128        self.nodes.clear();
129    }
130
131    // Param is passed by value, moved
132    pub fn set_nodes(&mut self, v: ::protobuf::RepeatedField<Data_Node>) {
133        self.nodes = v;
134    }
135
136    // Mutable pointer to the field.
137    pub fn mut_nodes(&mut self) -> &mut ::protobuf::RepeatedField<Data_Node> {
138        &mut self.nodes
139    }
140
141    // Take field
142    pub fn take_nodes(&mut self) -> ::protobuf::RepeatedField<Data_Node> {
143        ::std::mem::replace(&mut self.nodes, ::protobuf::RepeatedField::new())
144    }
145
146    pub fn get_nodes(&self) -> &[Data_Node] {
147        &self.nodes
148    }
149
150    fn get_nodes_for_reflect(&self) -> &::protobuf::RepeatedField<Data_Node> {
151        &self.nodes
152    }
153
154    fn mut_nodes_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<Data_Node> {
155        &mut self.nodes
156    }
157
158    // optional bytes signature = 4;
159
160    pub fn clear_signature(&mut self) {
161        self.signature.clear();
162    }
163
164    pub fn has_signature(&self) -> bool {
165        self.signature.is_some()
166    }
167
168    // Param is passed by value, moved
169    pub fn set_signature(&mut self, v: ::std::vec::Vec<u8>) {
170        self.signature = ::protobuf::SingularField::some(v);
171    }
172
173    // Mutable pointer to the field.
174    // If field is not initialized, it is initialized with default value first.
175    pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec<u8> {
176        if self.signature.is_none() {
177            self.signature.set_default();
178        }
179        self.signature.as_mut().unwrap()
180    }
181
182    // Take field
183    pub fn take_signature(&mut self) -> ::std::vec::Vec<u8> {
184        self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new())
185    }
186
187    pub fn get_signature(&self) -> &[u8] {
188        match self.signature.as_ref() {
189            Some(v) => &v,
190            None => &[],
191        }
192    }
193
194    fn get_signature_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
195        &self.signature
196    }
197
198    fn mut_signature_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
199        &mut self.signature
200    }
201}
202
203impl ::protobuf::Message for Data {
204    fn is_initialized(&self) -> bool {
205        if self.index.is_none() {
206            return false;
207        }
208        for v in &self.nodes {
209            if !v.is_initialized() {
210                return false;
211            }
212        };
213        true
214    }
215
216    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
217        while !is.eof()? {
218            let (field_number, wire_type) = is.read_tag_unpack()?;
219            match field_number {
220                1 => {
221                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
222                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
223                    }
224                    let tmp = is.read_uint64()?;
225                    self.index = ::std::option::Option::Some(tmp);
226                },
227                2 => {
228                    ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?;
229                },
230                3 => {
231                    ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.nodes)?;
232                },
233                4 => {
234                    ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.signature)?;
235                },
236                _ => {
237                    ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
238                },
239            };
240        }
241        ::std::result::Result::Ok(())
242    }
243
244    // Compute sizes of nested messages
245    #[allow(unused_variables)]
246    fn compute_size(&self) -> u32 {
247        let mut my_size = 0;
248        if let Some(v) = self.index {
249            my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint);
250        }
251        if let Some(ref v) = self.value.as_ref() {
252            my_size += ::protobuf::rt::bytes_size(2, &v);
253        }
254        for value in &self.nodes {
255            let len = value.compute_size();
256            my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
257        };
258        if let Some(ref v) = self.signature.as_ref() {
259            my_size += ::protobuf::rt::bytes_size(4, &v);
260        }
261        my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
262        self.cached_size.set(my_size);
263        my_size
264    }
265
266    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
267        if let Some(v) = self.index {
268            os.write_uint64(1, v)?;
269        }
270        if let Some(ref v) = self.value.as_ref() {
271            os.write_bytes(2, &v)?;
272        }
273        for v in &self.nodes {
274            os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
275            os.write_raw_varint32(v.get_cached_size())?;
276            v.write_to_with_cached_sizes(os)?;
277        };
278        if let Some(ref v) = self.signature.as_ref() {
279            os.write_bytes(4, &v)?;
280        }
281        os.write_unknown_fields(self.get_unknown_fields())?;
282        ::std::result::Result::Ok(())
283    }
284
285    fn get_cached_size(&self) -> u32 {
286        self.cached_size.get()
287    }
288
289    fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
290        &self.unknown_fields
291    }
292
293    fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
294        &mut self.unknown_fields
295    }
296
297    fn as_any(&self) -> &::std::any::Any {
298        self as &::std::any::Any
299    }
300    fn as_any_mut(&mut self) -> &mut ::std::any::Any {
301        self as &mut ::std::any::Any
302    }
303    fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
304        self
305    }
306
307    fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
308        ::protobuf::MessageStatic::descriptor_static(None::<Self>)
309    }
310}
311
312impl ::protobuf::MessageStatic for Data {
313    fn new() -> Data {
314        Data::new()
315    }
316
317    fn descriptor_static(_: ::std::option::Option<Data>) -> &'static ::protobuf::reflect::MessageDescriptor {
318        static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
319            lock: ::protobuf::lazy::ONCE_INIT,
320            ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
321        };
322        unsafe {
323            descriptor.get(|| {
324                let mut fields = ::std::vec::Vec::new();
325                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
326                    "index",
327                    Data::get_index_for_reflect,
328                    Data::mut_index_for_reflect,
329                ));
330                fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
331                    "value",
332                    Data::get_value_for_reflect,
333                    Data::mut_value_for_reflect,
334                ));
335                fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Data_Node>>(
336                    "nodes",
337                    Data::get_nodes_for_reflect,
338                    Data::mut_nodes_for_reflect,
339                ));
340                fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
341                    "signature",
342                    Data::get_signature_for_reflect,
343                    Data::mut_signature_for_reflect,
344                ));
345                ::protobuf::reflect::MessageDescriptor::new::<Data>(
346                    "Data",
347                    fields,
348                    file_descriptor_proto()
349                )
350            })
351        }
352    }
353}
354
355impl ::protobuf::Clear for Data {
356    fn clear(&mut self) {
357        self.clear_index();
358        self.clear_value();
359        self.clear_nodes();
360        self.clear_signature();
361        self.unknown_fields.clear();
362    }
363}
364
365impl ::std::fmt::Debug for Data {
366    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
367        ::protobuf::text_format::fmt(self, f)
368    }
369}
370
371impl ::protobuf::reflect::ProtobufValue for Data {
372    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
373        ::protobuf::reflect::ProtobufValueRef::Message(self)
374    }
375}
376
377#[derive(PartialEq,Clone,Default)]
378pub struct Data_Node {
379    // message fields
380    index: ::std::option::Option<u64>,
381    hash: ::protobuf::SingularField<::std::vec::Vec<u8>>,
382    size: ::std::option::Option<u64>,
383    // special fields
384    unknown_fields: ::protobuf::UnknownFields,
385    cached_size: ::protobuf::CachedSize,
386}
387
388// see codegen.rs for the explanation why impl Sync explicitly
389unsafe impl ::std::marker::Sync for Data_Node {}
390
391impl Data_Node {
392    pub fn new() -> Data_Node {
393        ::std::default::Default::default()
394    }
395
396    pub fn default_instance() -> &'static Data_Node {
397        static mut instance: ::protobuf::lazy::Lazy<Data_Node> = ::protobuf::lazy::Lazy {
398            lock: ::protobuf::lazy::ONCE_INIT,
399            ptr: 0 as *const Data_Node,
400        };
401        unsafe {
402            instance.get(Data_Node::new)
403        }
404    }
405
406    // required uint64 index = 1;
407
408    pub fn clear_index(&mut self) {
409        self.index = ::std::option::Option::None;
410    }
411
412    pub fn has_index(&self) -> bool {
413        self.index.is_some()
414    }
415
416    // Param is passed by value, moved
417    pub fn set_index(&mut self, v: u64) {
418        self.index = ::std::option::Option::Some(v);
419    }
420
421    pub fn get_index(&self) -> u64 {
422        self.index.unwrap_or(0)
423    }
424
425    fn get_index_for_reflect(&self) -> &::std::option::Option<u64> {
426        &self.index
427    }
428
429    fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option<u64> {
430        &mut self.index
431    }
432
433    // required bytes hash = 2;
434
435    pub fn clear_hash(&mut self) {
436        self.hash.clear();
437    }
438
439    pub fn has_hash(&self) -> bool {
440        self.hash.is_some()
441    }
442
443    // Param is passed by value, moved
444    pub fn set_hash(&mut self, v: ::std::vec::Vec<u8>) {
445        self.hash = ::protobuf::SingularField::some(v);
446    }
447
448    // Mutable pointer to the field.
449    // If field is not initialized, it is initialized with default value first.
450    pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec<u8> {
451        if self.hash.is_none() {
452            self.hash.set_default();
453        }
454        self.hash.as_mut().unwrap()
455    }
456
457    // Take field
458    pub fn take_hash(&mut self) -> ::std::vec::Vec<u8> {
459        self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new())
460    }
461
462    pub fn get_hash(&self) -> &[u8] {
463        match self.hash.as_ref() {
464            Some(v) => &v,
465            None => &[],
466        }
467    }
468
469    fn get_hash_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
470        &self.hash
471    }
472
473    fn mut_hash_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
474        &mut self.hash
475    }
476
477    // required uint64 size = 3;
478
479    pub fn clear_size(&mut self) {
480        self.size = ::std::option::Option::None;
481    }
482
483    pub fn has_size(&self) -> bool {
484        self.size.is_some()
485    }
486
487    // Param is passed by value, moved
488    pub fn set_size(&mut self, v: u64) {
489        self.size = ::std::option::Option::Some(v);
490    }
491
492    pub fn get_size(&self) -> u64 {
493        self.size.unwrap_or(0)
494    }
495
496    fn get_size_for_reflect(&self) -> &::std::option::Option<u64> {
497        &self.size
498    }
499
500    fn mut_size_for_reflect(&mut self) -> &mut ::std::option::Option<u64> {
501        &mut self.size
502    }
503}
504
505impl ::protobuf::Message for Data_Node {
506    fn is_initialized(&self) -> bool {
507        if self.index.is_none() {
508            return false;
509        }
510        if self.hash.is_none() {
511            return false;
512        }
513        if self.size.is_none() {
514            return false;
515        }
516        true
517    }
518
519    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
520        while !is.eof()? {
521            let (field_number, wire_type) = is.read_tag_unpack()?;
522            match field_number {
523                1 => {
524                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
525                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
526                    }
527                    let tmp = is.read_uint64()?;
528                    self.index = ::std::option::Option::Some(tmp);
529                },
530                2 => {
531                    ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.hash)?;
532                },
533                3 => {
534                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
535                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
536                    }
537                    let tmp = is.read_uint64()?;
538                    self.size = ::std::option::Option::Some(tmp);
539                },
540                _ => {
541                    ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
542                },
543            };
544        }
545        ::std::result::Result::Ok(())
546    }
547
548    // Compute sizes of nested messages
549    #[allow(unused_variables)]
550    fn compute_size(&self) -> u32 {
551        let mut my_size = 0;
552        if let Some(v) = self.index {
553            my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint);
554        }
555        if let Some(ref v) = self.hash.as_ref() {
556            my_size += ::protobuf::rt::bytes_size(2, &v);
557        }
558        if let Some(v) = self.size {
559            my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
560        }
561        my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
562        self.cached_size.set(my_size);
563        my_size
564    }
565
566    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
567        if let Some(v) = self.index {
568            os.write_uint64(1, v)?;
569        }
570        if let Some(ref v) = self.hash.as_ref() {
571            os.write_bytes(2, &v)?;
572        }
573        if let Some(v) = self.size {
574            os.write_uint64(3, v)?;
575        }
576        os.write_unknown_fields(self.get_unknown_fields())?;
577        ::std::result::Result::Ok(())
578    }
579
580    fn get_cached_size(&self) -> u32 {
581        self.cached_size.get()
582    }
583
584    fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
585        &self.unknown_fields
586    }
587
588    fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
589        &mut self.unknown_fields
590    }
591
592    fn as_any(&self) -> &::std::any::Any {
593        self as &::std::any::Any
594    }
595    fn as_any_mut(&mut self) -> &mut ::std::any::Any {
596        self as &mut ::std::any::Any
597    }
598    fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
599        self
600    }
601
602    fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
603        ::protobuf::MessageStatic::descriptor_static(None::<Self>)
604    }
605}
606
607impl ::protobuf::MessageStatic for Data_Node {
608    fn new() -> Data_Node {
609        Data_Node::new()
610    }
611
612    fn descriptor_static(_: ::std::option::Option<Data_Node>) -> &'static ::protobuf::reflect::MessageDescriptor {
613        static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
614            lock: ::protobuf::lazy::ONCE_INIT,
615            ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
616        };
617        unsafe {
618            descriptor.get(|| {
619                let mut fields = ::std::vec::Vec::new();
620                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
621                    "index",
622                    Data_Node::get_index_for_reflect,
623                    Data_Node::mut_index_for_reflect,
624                ));
625                fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
626                    "hash",
627                    Data_Node::get_hash_for_reflect,
628                    Data_Node::mut_hash_for_reflect,
629                ));
630                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
631                    "size",
632                    Data_Node::get_size_for_reflect,
633                    Data_Node::mut_size_for_reflect,
634                ));
635                ::protobuf::reflect::MessageDescriptor::new::<Data_Node>(
636                    "Data_Node",
637                    fields,
638                    file_descriptor_proto()
639                )
640            })
641        }
642    }
643}
644
645impl ::protobuf::Clear for Data_Node {
646    fn clear(&mut self) {
647        self.clear_index();
648        self.clear_hash();
649        self.clear_size();
650        self.unknown_fields.clear();
651    }
652}
653
654impl ::std::fmt::Debug for Data_Node {
655    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
656        ::protobuf::text_format::fmt(self, f)
657    }
658}
659
660impl ::protobuf::reflect::ProtobufValue for Data_Node {
661    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
662        ::protobuf::reflect::ProtobufValueRef::Message(self)
663    }
664}
665
666static file_descriptor_proto_data: &'static [u8] = b"\
667    \n\ndata.proto\"\xb8\x01\n\x04Data\x12\x14\n\x05index\x18\x01\x20\x02(\
668    \x04R\x05index\x12\x14\n\x05value\x18\x02\x20\x01(\x0cR\x05value\x12\x20\
669    \n\x05nodes\x18\x03\x20\x03(\x0b2\n.Data.NodeR\x05nodes\x12\x1c\n\tsigna\
670    ture\x18\x04\x20\x01(\x0cR\tsignature\x1aD\n\x04Node\x12\x14\n\x05index\
671    \x18\x01\x20\x02(\x04R\x05index\x12\x12\n\x04hash\x18\x02\x20\x02(\x0cR\
672    \x04hash\x12\x12\n\x04size\x18\x03\x20\x02(\x04R\x04size\
673";
674
675static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
676    lock: ::protobuf::lazy::ONCE_INIT,
677    ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
678};
679
680fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
681    ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
682}
683
684pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
685    unsafe {
686        file_descriptor_proto_lazy.get(|| {
687            parse_descriptor_proto()
688        })
689    }
690}