sleep_protocol/
request.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 Request {
26    // message fields
27    index: ::std::option::Option<u64>,
28    bytes: ::std::option::Option<u64>,
29    hash: ::std::option::Option<bool>,
30    nodes: ::std::option::Option<u64>,
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 Request {}
38
39impl Request {
40    pub fn new() -> Request {
41        ::std::default::Default::default()
42    }
43
44    pub fn default_instance() -> &'static Request {
45        static mut instance: ::protobuf::lazy::Lazy<Request> = ::protobuf::lazy::Lazy {
46            lock: ::protobuf::lazy::ONCE_INIT,
47            ptr: 0 as *const Request,
48        };
49        unsafe {
50            instance.get(Request::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 uint64 bytes = 2;
82
83    pub fn clear_bytes(&mut self) {
84        self.bytes = ::std::option::Option::None;
85    }
86
87    pub fn has_bytes(&self) -> bool {
88        self.bytes.is_some()
89    }
90
91    // Param is passed by value, moved
92    pub fn set_bytes(&mut self, v: u64) {
93        self.bytes = ::std::option::Option::Some(v);
94    }
95
96    pub fn get_bytes(&self) -> u64 {
97        self.bytes.unwrap_or(0)
98    }
99
100    fn get_bytes_for_reflect(&self) -> &::std::option::Option<u64> {
101        &self.bytes
102    }
103
104    fn mut_bytes_for_reflect(&mut self) -> &mut ::std::option::Option<u64> {
105        &mut self.bytes
106    }
107
108    // optional bool hash = 3;
109
110    pub fn clear_hash(&mut self) {
111        self.hash = ::std::option::Option::None;
112    }
113
114    pub fn has_hash(&self) -> bool {
115        self.hash.is_some()
116    }
117
118    // Param is passed by value, moved
119    pub fn set_hash(&mut self, v: bool) {
120        self.hash = ::std::option::Option::Some(v);
121    }
122
123    pub fn get_hash(&self) -> bool {
124        self.hash.unwrap_or(false)
125    }
126
127    fn get_hash_for_reflect(&self) -> &::std::option::Option<bool> {
128        &self.hash
129    }
130
131    fn mut_hash_for_reflect(&mut self) -> &mut ::std::option::Option<bool> {
132        &mut self.hash
133    }
134
135    // optional uint64 nodes = 4;
136
137    pub fn clear_nodes(&mut self) {
138        self.nodes = ::std::option::Option::None;
139    }
140
141    pub fn has_nodes(&self) -> bool {
142        self.nodes.is_some()
143    }
144
145    // Param is passed by value, moved
146    pub fn set_nodes(&mut self, v: u64) {
147        self.nodes = ::std::option::Option::Some(v);
148    }
149
150    pub fn get_nodes(&self) -> u64 {
151        self.nodes.unwrap_or(0)
152    }
153
154    fn get_nodes_for_reflect(&self) -> &::std::option::Option<u64> {
155        &self.nodes
156    }
157
158    fn mut_nodes_for_reflect(&mut self) -> &mut ::std::option::Option<u64> {
159        &mut self.nodes
160    }
161}
162
163impl ::protobuf::Message for Request {
164    fn is_initialized(&self) -> bool {
165        if self.index.is_none() {
166            return false;
167        }
168        true
169    }
170
171    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
172        while !is.eof()? {
173            let (field_number, wire_type) = is.read_tag_unpack()?;
174            match field_number {
175                1 => {
176                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
177                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
178                    }
179                    let tmp = is.read_uint64()?;
180                    self.index = ::std::option::Option::Some(tmp);
181                },
182                2 => {
183                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
184                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
185                    }
186                    let tmp = is.read_uint64()?;
187                    self.bytes = ::std::option::Option::Some(tmp);
188                },
189                3 => {
190                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
191                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
192                    }
193                    let tmp = is.read_bool()?;
194                    self.hash = ::std::option::Option::Some(tmp);
195                },
196                4 => {
197                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
198                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
199                    }
200                    let tmp = is.read_uint64()?;
201                    self.nodes = ::std::option::Option::Some(tmp);
202                },
203                _ => {
204                    ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
205                },
206            };
207        }
208        ::std::result::Result::Ok(())
209    }
210
211    // Compute sizes of nested messages
212    #[allow(unused_variables)]
213    fn compute_size(&self) -> u32 {
214        let mut my_size = 0;
215        if let Some(v) = self.index {
216            my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint);
217        }
218        if let Some(v) = self.bytes {
219            my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint);
220        }
221        if let Some(v) = self.hash {
222            my_size += 2;
223        }
224        if let Some(v) = self.nodes {
225            my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint);
226        }
227        my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
228        self.cached_size.set(my_size);
229        my_size
230    }
231
232    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
233        if let Some(v) = self.index {
234            os.write_uint64(1, v)?;
235        }
236        if let Some(v) = self.bytes {
237            os.write_uint64(2, v)?;
238        }
239        if let Some(v) = self.hash {
240            os.write_bool(3, v)?;
241        }
242        if let Some(v) = self.nodes {
243            os.write_uint64(4, v)?;
244        }
245        os.write_unknown_fields(self.get_unknown_fields())?;
246        ::std::result::Result::Ok(())
247    }
248
249    fn get_cached_size(&self) -> u32 {
250        self.cached_size.get()
251    }
252
253    fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
254        &self.unknown_fields
255    }
256
257    fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
258        &mut self.unknown_fields
259    }
260
261    fn as_any(&self) -> &::std::any::Any {
262        self as &::std::any::Any
263    }
264    fn as_any_mut(&mut self) -> &mut ::std::any::Any {
265        self as &mut ::std::any::Any
266    }
267    fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
268        self
269    }
270
271    fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
272        ::protobuf::MessageStatic::descriptor_static(None::<Self>)
273    }
274}
275
276impl ::protobuf::MessageStatic for Request {
277    fn new() -> Request {
278        Request::new()
279    }
280
281    fn descriptor_static(_: ::std::option::Option<Request>) -> &'static ::protobuf::reflect::MessageDescriptor {
282        static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
283            lock: ::protobuf::lazy::ONCE_INIT,
284            ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
285        };
286        unsafe {
287            descriptor.get(|| {
288                let mut fields = ::std::vec::Vec::new();
289                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
290                    "index",
291                    Request::get_index_for_reflect,
292                    Request::mut_index_for_reflect,
293                ));
294                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
295                    "bytes",
296                    Request::get_bytes_for_reflect,
297                    Request::mut_bytes_for_reflect,
298                ));
299                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
300                    "hash",
301                    Request::get_hash_for_reflect,
302                    Request::mut_hash_for_reflect,
303                ));
304                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
305                    "nodes",
306                    Request::get_nodes_for_reflect,
307                    Request::mut_nodes_for_reflect,
308                ));
309                ::protobuf::reflect::MessageDescriptor::new::<Request>(
310                    "Request",
311                    fields,
312                    file_descriptor_proto()
313                )
314            })
315        }
316    }
317}
318
319impl ::protobuf::Clear for Request {
320    fn clear(&mut self) {
321        self.clear_index();
322        self.clear_bytes();
323        self.clear_hash();
324        self.clear_nodes();
325        self.unknown_fields.clear();
326    }
327}
328
329impl ::std::fmt::Debug for Request {
330    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
331        ::protobuf::text_format::fmt(self, f)
332    }
333}
334
335impl ::protobuf::reflect::ProtobufValue for Request {
336    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
337        ::protobuf::reflect::ProtobufValueRef::Message(self)
338    }
339}
340
341static file_descriptor_proto_data: &'static [u8] = b"\
342    \n\rrequest.proto\"_\n\x07Request\x12\x14\n\x05index\x18\x01\x20\x02(\
343    \x04R\x05index\x12\x14\n\x05bytes\x18\x02\x20\x01(\x04R\x05bytes\x12\x12\
344    \n\x04hash\x18\x03\x20\x01(\x08R\x04hash\x12\x14\n\x05nodes\x18\x04\x20\
345    \x01(\x04R\x05nodes\
346";
347
348static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
349    lock: ::protobuf::lazy::ONCE_INIT,
350    ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
351};
352
353fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
354    ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
355}
356
357pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
358    unsafe {
359        file_descriptor_proto_lazy.get(|| {
360            parse_descriptor_proto()
361        })
362    }
363}