sleep_protocol/
cancel.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 Cancel {
26    // message fields
27    index: ::std::option::Option<u64>,
28    bytes: ::std::option::Option<u64>,
29    hash: ::std::option::Option<bool>,
30    // special fields
31    unknown_fields: ::protobuf::UnknownFields,
32    cached_size: ::protobuf::CachedSize,
33}
34
35// see codegen.rs for the explanation why impl Sync explicitly
36unsafe impl ::std::marker::Sync for Cancel {}
37
38impl Cancel {
39    pub fn new() -> Cancel {
40        ::std::default::Default::default()
41    }
42
43    pub fn default_instance() -> &'static Cancel {
44        static mut instance: ::protobuf::lazy::Lazy<Cancel> = ::protobuf::lazy::Lazy {
45            lock: ::protobuf::lazy::ONCE_INIT,
46            ptr: 0 as *const Cancel,
47        };
48        unsafe {
49            instance.get(Cancel::new)
50        }
51    }
52
53    // required uint64 index = 1;
54
55    pub fn clear_index(&mut self) {
56        self.index = ::std::option::Option::None;
57    }
58
59    pub fn has_index(&self) -> bool {
60        self.index.is_some()
61    }
62
63    // Param is passed by value, moved
64    pub fn set_index(&mut self, v: u64) {
65        self.index = ::std::option::Option::Some(v);
66    }
67
68    pub fn get_index(&self) -> u64 {
69        self.index.unwrap_or(0)
70    }
71
72    fn get_index_for_reflect(&self) -> &::std::option::Option<u64> {
73        &self.index
74    }
75
76    fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option<u64> {
77        &mut self.index
78    }
79
80    // optional uint64 bytes = 2;
81
82    pub fn clear_bytes(&mut self) {
83        self.bytes = ::std::option::Option::None;
84    }
85
86    pub fn has_bytes(&self) -> bool {
87        self.bytes.is_some()
88    }
89
90    // Param is passed by value, moved
91    pub fn set_bytes(&mut self, v: u64) {
92        self.bytes = ::std::option::Option::Some(v);
93    }
94
95    pub fn get_bytes(&self) -> u64 {
96        self.bytes.unwrap_or(0)
97    }
98
99    fn get_bytes_for_reflect(&self) -> &::std::option::Option<u64> {
100        &self.bytes
101    }
102
103    fn mut_bytes_for_reflect(&mut self) -> &mut ::std::option::Option<u64> {
104        &mut self.bytes
105    }
106
107    // optional bool hash = 3;
108
109    pub fn clear_hash(&mut self) {
110        self.hash = ::std::option::Option::None;
111    }
112
113    pub fn has_hash(&self) -> bool {
114        self.hash.is_some()
115    }
116
117    // Param is passed by value, moved
118    pub fn set_hash(&mut self, v: bool) {
119        self.hash = ::std::option::Option::Some(v);
120    }
121
122    pub fn get_hash(&self) -> bool {
123        self.hash.unwrap_or(false)
124    }
125
126    fn get_hash_for_reflect(&self) -> &::std::option::Option<bool> {
127        &self.hash
128    }
129
130    fn mut_hash_for_reflect(&mut self) -> &mut ::std::option::Option<bool> {
131        &mut self.hash
132    }
133}
134
135impl ::protobuf::Message for Cancel {
136    fn is_initialized(&self) -> bool {
137        if self.index.is_none() {
138            return false;
139        }
140        true
141    }
142
143    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
144        while !is.eof()? {
145            let (field_number, wire_type) = is.read_tag_unpack()?;
146            match field_number {
147                1 => {
148                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
149                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
150                    }
151                    let tmp = is.read_uint64()?;
152                    self.index = ::std::option::Option::Some(tmp);
153                },
154                2 => {
155                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
156                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
157                    }
158                    let tmp = is.read_uint64()?;
159                    self.bytes = ::std::option::Option::Some(tmp);
160                },
161                3 => {
162                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
163                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
164                    }
165                    let tmp = is.read_bool()?;
166                    self.hash = ::std::option::Option::Some(tmp);
167                },
168                _ => {
169                    ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
170                },
171            };
172        }
173        ::std::result::Result::Ok(())
174    }
175
176    // Compute sizes of nested messages
177    #[allow(unused_variables)]
178    fn compute_size(&self) -> u32 {
179        let mut my_size = 0;
180        if let Some(v) = self.index {
181            my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint);
182        }
183        if let Some(v) = self.bytes {
184            my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint);
185        }
186        if let Some(v) = self.hash {
187            my_size += 2;
188        }
189        my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
190        self.cached_size.set(my_size);
191        my_size
192    }
193
194    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
195        if let Some(v) = self.index {
196            os.write_uint64(1, v)?;
197        }
198        if let Some(v) = self.bytes {
199            os.write_uint64(2, v)?;
200        }
201        if let Some(v) = self.hash {
202            os.write_bool(3, v)?;
203        }
204        os.write_unknown_fields(self.get_unknown_fields())?;
205        ::std::result::Result::Ok(())
206    }
207
208    fn get_cached_size(&self) -> u32 {
209        self.cached_size.get()
210    }
211
212    fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
213        &self.unknown_fields
214    }
215
216    fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
217        &mut self.unknown_fields
218    }
219
220    fn as_any(&self) -> &::std::any::Any {
221        self as &::std::any::Any
222    }
223    fn as_any_mut(&mut self) -> &mut ::std::any::Any {
224        self as &mut ::std::any::Any
225    }
226    fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
227        self
228    }
229
230    fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
231        ::protobuf::MessageStatic::descriptor_static(None::<Self>)
232    }
233}
234
235impl ::protobuf::MessageStatic for Cancel {
236    fn new() -> Cancel {
237        Cancel::new()
238    }
239
240    fn descriptor_static(_: ::std::option::Option<Cancel>) -> &'static ::protobuf::reflect::MessageDescriptor {
241        static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
242            lock: ::protobuf::lazy::ONCE_INIT,
243            ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
244        };
245        unsafe {
246            descriptor.get(|| {
247                let mut fields = ::std::vec::Vec::new();
248                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
249                    "index",
250                    Cancel::get_index_for_reflect,
251                    Cancel::mut_index_for_reflect,
252                ));
253                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
254                    "bytes",
255                    Cancel::get_bytes_for_reflect,
256                    Cancel::mut_bytes_for_reflect,
257                ));
258                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
259                    "hash",
260                    Cancel::get_hash_for_reflect,
261                    Cancel::mut_hash_for_reflect,
262                ));
263                ::protobuf::reflect::MessageDescriptor::new::<Cancel>(
264                    "Cancel",
265                    fields,
266                    file_descriptor_proto()
267                )
268            })
269        }
270    }
271}
272
273impl ::protobuf::Clear for Cancel {
274    fn clear(&mut self) {
275        self.clear_index();
276        self.clear_bytes();
277        self.clear_hash();
278        self.unknown_fields.clear();
279    }
280}
281
282impl ::std::fmt::Debug for Cancel {
283    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
284        ::protobuf::text_format::fmt(self, f)
285    }
286}
287
288impl ::protobuf::reflect::ProtobufValue for Cancel {
289    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
290        ::protobuf::reflect::ProtobufValueRef::Message(self)
291    }
292}
293
294static file_descriptor_proto_data: &'static [u8] = b"\
295    \n\x0ccancel.proto\"H\n\x06Cancel\x12\x14\n\x05index\x18\x01\x20\x02(\
296    \x04R\x05index\x12\x14\n\x05bytes\x18\x02\x20\x01(\x04R\x05bytes\x12\x12\
297    \n\x04hash\x18\x03\x20\x01(\x08R\x04hash\
298";
299
300static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
301    lock: ::protobuf::lazy::ONCE_INIT,
302    ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
303};
304
305fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
306    ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
307}
308
309pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
310    unsafe {
311        file_descriptor_proto_lazy.get(|| {
312            parse_descriptor_proto()
313        })
314    }
315}