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