sleep_protocol/
handshake.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 Handshake {
26    // message fields
27    id: ::protobuf::SingularField<::std::vec::Vec<u8>>,
28    live: ::std::option::Option<bool>,
29    userData: ::protobuf::SingularField<::std::vec::Vec<u8>>,
30    extensions: ::protobuf::RepeatedField<::std::string::String>,
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 Handshake {}
38
39impl Handshake {
40    pub fn new() -> Handshake {
41        ::std::default::Default::default()
42    }
43
44    pub fn default_instance() -> &'static Handshake {
45        static mut instance: ::protobuf::lazy::Lazy<Handshake> = ::protobuf::lazy::Lazy {
46            lock: ::protobuf::lazy::ONCE_INIT,
47            ptr: 0 as *const Handshake,
48        };
49        unsafe {
50            instance.get(Handshake::new)
51        }
52    }
53
54    // optional bytes id = 1;
55
56    pub fn clear_id(&mut self) {
57        self.id.clear();
58    }
59
60    pub fn has_id(&self) -> bool {
61        self.id.is_some()
62    }
63
64    // Param is passed by value, moved
65    pub fn set_id(&mut self, v: ::std::vec::Vec<u8>) {
66        self.id = ::protobuf::SingularField::some(v);
67    }
68
69    // Mutable pointer to the field.
70    // If field is not initialized, it is initialized with default value first.
71    pub fn mut_id(&mut self) -> &mut ::std::vec::Vec<u8> {
72        if self.id.is_none() {
73            self.id.set_default();
74        }
75        self.id.as_mut().unwrap()
76    }
77
78    // Take field
79    pub fn take_id(&mut self) -> ::std::vec::Vec<u8> {
80        self.id.take().unwrap_or_else(|| ::std::vec::Vec::new())
81    }
82
83    pub fn get_id(&self) -> &[u8] {
84        match self.id.as_ref() {
85            Some(v) => &v,
86            None => &[],
87        }
88    }
89
90    fn get_id_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
91        &self.id
92    }
93
94    fn mut_id_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
95        &mut self.id
96    }
97
98    // optional bool live = 2;
99
100    pub fn clear_live(&mut self) {
101        self.live = ::std::option::Option::None;
102    }
103
104    pub fn has_live(&self) -> bool {
105        self.live.is_some()
106    }
107
108    // Param is passed by value, moved
109    pub fn set_live(&mut self, v: bool) {
110        self.live = ::std::option::Option::Some(v);
111    }
112
113    pub fn get_live(&self) -> bool {
114        self.live.unwrap_or(false)
115    }
116
117    fn get_live_for_reflect(&self) -> &::std::option::Option<bool> {
118        &self.live
119    }
120
121    fn mut_live_for_reflect(&mut self) -> &mut ::std::option::Option<bool> {
122        &mut self.live
123    }
124
125    // optional bytes userData = 3;
126
127    pub fn clear_userData(&mut self) {
128        self.userData.clear();
129    }
130
131    pub fn has_userData(&self) -> bool {
132        self.userData.is_some()
133    }
134
135    // Param is passed by value, moved
136    pub fn set_userData(&mut self, v: ::std::vec::Vec<u8>) {
137        self.userData = ::protobuf::SingularField::some(v);
138    }
139
140    // Mutable pointer to the field.
141    // If field is not initialized, it is initialized with default value first.
142    pub fn mut_userData(&mut self) -> &mut ::std::vec::Vec<u8> {
143        if self.userData.is_none() {
144            self.userData.set_default();
145        }
146        self.userData.as_mut().unwrap()
147    }
148
149    // Take field
150    pub fn take_userData(&mut self) -> ::std::vec::Vec<u8> {
151        self.userData.take().unwrap_or_else(|| ::std::vec::Vec::new())
152    }
153
154    pub fn get_userData(&self) -> &[u8] {
155        match self.userData.as_ref() {
156            Some(v) => &v,
157            None => &[],
158        }
159    }
160
161    fn get_userData_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
162        &self.userData
163    }
164
165    fn mut_userData_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
166        &mut self.userData
167    }
168
169    // repeated string extensions = 4;
170
171    pub fn clear_extensions(&mut self) {
172        self.extensions.clear();
173    }
174
175    // Param is passed by value, moved
176    pub fn set_extensions(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
177        self.extensions = v;
178    }
179
180    // Mutable pointer to the field.
181    pub fn mut_extensions(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
182        &mut self.extensions
183    }
184
185    // Take field
186    pub fn take_extensions(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
187        ::std::mem::replace(&mut self.extensions, ::protobuf::RepeatedField::new())
188    }
189
190    pub fn get_extensions(&self) -> &[::std::string::String] {
191        &self.extensions
192    }
193
194    fn get_extensions_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> {
195        &self.extensions
196    }
197
198    fn mut_extensions_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
199        &mut self.extensions
200    }
201}
202
203impl ::protobuf::Message for Handshake {
204    fn is_initialized(&self) -> bool {
205        true
206    }
207
208    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
209        while !is.eof()? {
210            let (field_number, wire_type) = is.read_tag_unpack()?;
211            match field_number {
212                1 => {
213                    ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.id)?;
214                },
215                2 => {
216                    if wire_type != ::protobuf::wire_format::WireTypeVarint {
217                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
218                    }
219                    let tmp = is.read_bool()?;
220                    self.live = ::std::option::Option::Some(tmp);
221                },
222                3 => {
223                    ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.userData)?;
224                },
225                4 => {
226                    ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.extensions)?;
227                },
228                _ => {
229                    ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
230                },
231            };
232        }
233        ::std::result::Result::Ok(())
234    }
235
236    // Compute sizes of nested messages
237    #[allow(unused_variables)]
238    fn compute_size(&self) -> u32 {
239        let mut my_size = 0;
240        if let Some(ref v) = self.id.as_ref() {
241            my_size += ::protobuf::rt::bytes_size(1, &v);
242        }
243        if let Some(v) = self.live {
244            my_size += 2;
245        }
246        if let Some(ref v) = self.userData.as_ref() {
247            my_size += ::protobuf::rt::bytes_size(3, &v);
248        }
249        for value in &self.extensions {
250            my_size += ::protobuf::rt::string_size(4, &value);
251        };
252        my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
253        self.cached_size.set(my_size);
254        my_size
255    }
256
257    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
258        if let Some(ref v) = self.id.as_ref() {
259            os.write_bytes(1, &v)?;
260        }
261        if let Some(v) = self.live {
262            os.write_bool(2, v)?;
263        }
264        if let Some(ref v) = self.userData.as_ref() {
265            os.write_bytes(3, &v)?;
266        }
267        for v in &self.extensions {
268            os.write_string(4, &v)?;
269        };
270        os.write_unknown_fields(self.get_unknown_fields())?;
271        ::std::result::Result::Ok(())
272    }
273
274    fn get_cached_size(&self) -> u32 {
275        self.cached_size.get()
276    }
277
278    fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
279        &self.unknown_fields
280    }
281
282    fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
283        &mut self.unknown_fields
284    }
285
286    fn as_any(&self) -> &::std::any::Any {
287        self as &::std::any::Any
288    }
289    fn as_any_mut(&mut self) -> &mut ::std::any::Any {
290        self as &mut ::std::any::Any
291    }
292    fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
293        self
294    }
295
296    fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
297        ::protobuf::MessageStatic::descriptor_static(None::<Self>)
298    }
299}
300
301impl ::protobuf::MessageStatic for Handshake {
302    fn new() -> Handshake {
303        Handshake::new()
304    }
305
306    fn descriptor_static(_: ::std::option::Option<Handshake>) -> &'static ::protobuf::reflect::MessageDescriptor {
307        static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
308            lock: ::protobuf::lazy::ONCE_INIT,
309            ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
310        };
311        unsafe {
312            descriptor.get(|| {
313                let mut fields = ::std::vec::Vec::new();
314                fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
315                    "id",
316                    Handshake::get_id_for_reflect,
317                    Handshake::mut_id_for_reflect,
318                ));
319                fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
320                    "live",
321                    Handshake::get_live_for_reflect,
322                    Handshake::mut_live_for_reflect,
323                ));
324                fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
325                    "userData",
326                    Handshake::get_userData_for_reflect,
327                    Handshake::mut_userData_for_reflect,
328                ));
329                fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
330                    "extensions",
331                    Handshake::get_extensions_for_reflect,
332                    Handshake::mut_extensions_for_reflect,
333                ));
334                ::protobuf::reflect::MessageDescriptor::new::<Handshake>(
335                    "Handshake",
336                    fields,
337                    file_descriptor_proto()
338                )
339            })
340        }
341    }
342}
343
344impl ::protobuf::Clear for Handshake {
345    fn clear(&mut self) {
346        self.clear_id();
347        self.clear_live();
348        self.clear_userData();
349        self.clear_extensions();
350        self.unknown_fields.clear();
351    }
352}
353
354impl ::std::fmt::Debug for Handshake {
355    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
356        ::protobuf::text_format::fmt(self, f)
357    }
358}
359
360impl ::protobuf::reflect::ProtobufValue for Handshake {
361    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
362        ::protobuf::reflect::ProtobufValueRef::Message(self)
363    }
364}
365
366static file_descriptor_proto_data: &'static [u8] = b"\
367    \n\x0fhandshake.proto\"k\n\tHandshake\x12\x0e\n\x02id\x18\x01\x20\x01(\
368    \x0cR\x02id\x12\x12\n\x04live\x18\x02\x20\x01(\x08R\x04live\x12\x1a\n\
369    \x08userData\x18\x03\x20\x01(\x0cR\x08userData\x12\x1e\n\nextensions\x18\
370    \x04\x20\x03(\tR\nextensions\
371";
372
373static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
374    lock: ::protobuf::lazy::ONCE_INIT,
375    ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
376};
377
378fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
379    ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
380}
381
382pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
383    unsafe {
384        file_descriptor_proto_lazy.get(|| {
385            parse_descriptor_proto()
386        })
387    }
388}