sleep_protocol/
feed.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 Feed {
26    // message fields
27    discoveryKey: ::protobuf::SingularField<::std::vec::Vec<u8>>,
28    nonce: ::protobuf::SingularField<::std::vec::Vec<u8>>,
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 Feed {}
36
37impl Feed {
38    pub fn new() -> Feed {
39        ::std::default::Default::default()
40    }
41
42    pub fn default_instance() -> &'static Feed {
43        static mut instance: ::protobuf::lazy::Lazy<Feed> = ::protobuf::lazy::Lazy {
44            lock: ::protobuf::lazy::ONCE_INIT,
45            ptr: 0 as *const Feed,
46        };
47        unsafe {
48            instance.get(Feed::new)
49        }
50    }
51
52    // required bytes discoveryKey = 1;
53
54    pub fn clear_discoveryKey(&mut self) {
55        self.discoveryKey.clear();
56    }
57
58    pub fn has_discoveryKey(&self) -> bool {
59        self.discoveryKey.is_some()
60    }
61
62    // Param is passed by value, moved
63    pub fn set_discoveryKey(&mut self, v: ::std::vec::Vec<u8>) {
64        self.discoveryKey = ::protobuf::SingularField::some(v);
65    }
66
67    // Mutable pointer to the field.
68    // If field is not initialized, it is initialized with default value first.
69    pub fn mut_discoveryKey(&mut self) -> &mut ::std::vec::Vec<u8> {
70        if self.discoveryKey.is_none() {
71            self.discoveryKey.set_default();
72        }
73        self.discoveryKey.as_mut().unwrap()
74    }
75
76    // Take field
77    pub fn take_discoveryKey(&mut self) -> ::std::vec::Vec<u8> {
78        self.discoveryKey.take().unwrap_or_else(|| ::std::vec::Vec::new())
79    }
80
81    pub fn get_discoveryKey(&self) -> &[u8] {
82        match self.discoveryKey.as_ref() {
83            Some(v) => &v,
84            None => &[],
85        }
86    }
87
88    fn get_discoveryKey_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
89        &self.discoveryKey
90    }
91
92    fn mut_discoveryKey_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
93        &mut self.discoveryKey
94    }
95
96    // optional bytes nonce = 2;
97
98    pub fn clear_nonce(&mut self) {
99        self.nonce.clear();
100    }
101
102    pub fn has_nonce(&self) -> bool {
103        self.nonce.is_some()
104    }
105
106    // Param is passed by value, moved
107    pub fn set_nonce(&mut self, v: ::std::vec::Vec<u8>) {
108        self.nonce = ::protobuf::SingularField::some(v);
109    }
110
111    // Mutable pointer to the field.
112    // If field is not initialized, it is initialized with default value first.
113    pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec<u8> {
114        if self.nonce.is_none() {
115            self.nonce.set_default();
116        }
117        self.nonce.as_mut().unwrap()
118    }
119
120    // Take field
121    pub fn take_nonce(&mut self) -> ::std::vec::Vec<u8> {
122        self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new())
123    }
124
125    pub fn get_nonce(&self) -> &[u8] {
126        match self.nonce.as_ref() {
127            Some(v) => &v,
128            None => &[],
129        }
130    }
131
132    fn get_nonce_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
133        &self.nonce
134    }
135
136    fn mut_nonce_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
137        &mut self.nonce
138    }
139}
140
141impl ::protobuf::Message for Feed {
142    fn is_initialized(&self) -> bool {
143        if self.discoveryKey.is_none() {
144            return false;
145        }
146        true
147    }
148
149    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
150        while !is.eof()? {
151            let (field_number, wire_type) = is.read_tag_unpack()?;
152            match field_number {
153                1 => {
154                    ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.discoveryKey)?;
155                },
156                2 => {
157                    ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.nonce)?;
158                },
159                _ => {
160                    ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
161                },
162            };
163        }
164        ::std::result::Result::Ok(())
165    }
166
167    // Compute sizes of nested messages
168    #[allow(unused_variables)]
169    fn compute_size(&self) -> u32 {
170        let mut my_size = 0;
171        if let Some(ref v) = self.discoveryKey.as_ref() {
172            my_size += ::protobuf::rt::bytes_size(1, &v);
173        }
174        if let Some(ref v) = self.nonce.as_ref() {
175            my_size += ::protobuf::rt::bytes_size(2, &v);
176        }
177        my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
178        self.cached_size.set(my_size);
179        my_size
180    }
181
182    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
183        if let Some(ref v) = self.discoveryKey.as_ref() {
184            os.write_bytes(1, &v)?;
185        }
186        if let Some(ref v) = self.nonce.as_ref() {
187            os.write_bytes(2, &v)?;
188        }
189        os.write_unknown_fields(self.get_unknown_fields())?;
190        ::std::result::Result::Ok(())
191    }
192
193    fn get_cached_size(&self) -> u32 {
194        self.cached_size.get()
195    }
196
197    fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
198        &self.unknown_fields
199    }
200
201    fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
202        &mut self.unknown_fields
203    }
204
205    fn as_any(&self) -> &::std::any::Any {
206        self as &::std::any::Any
207    }
208    fn as_any_mut(&mut self) -> &mut ::std::any::Any {
209        self as &mut ::std::any::Any
210    }
211    fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
212        self
213    }
214
215    fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
216        ::protobuf::MessageStatic::descriptor_static(None::<Self>)
217    }
218}
219
220impl ::protobuf::MessageStatic for Feed {
221    fn new() -> Feed {
222        Feed::new()
223    }
224
225    fn descriptor_static(_: ::std::option::Option<Feed>) -> &'static ::protobuf::reflect::MessageDescriptor {
226        static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
227            lock: ::protobuf::lazy::ONCE_INIT,
228            ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
229        };
230        unsafe {
231            descriptor.get(|| {
232                let mut fields = ::std::vec::Vec::new();
233                fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
234                    "discoveryKey",
235                    Feed::get_discoveryKey_for_reflect,
236                    Feed::mut_discoveryKey_for_reflect,
237                ));
238                fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
239                    "nonce",
240                    Feed::get_nonce_for_reflect,
241                    Feed::mut_nonce_for_reflect,
242                ));
243                ::protobuf::reflect::MessageDescriptor::new::<Feed>(
244                    "Feed",
245                    fields,
246                    file_descriptor_proto()
247                )
248            })
249        }
250    }
251}
252
253impl ::protobuf::Clear for Feed {
254    fn clear(&mut self) {
255        self.clear_discoveryKey();
256        self.clear_nonce();
257        self.unknown_fields.clear();
258    }
259}
260
261impl ::std::fmt::Debug for Feed {
262    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
263        ::protobuf::text_format::fmt(self, f)
264    }
265}
266
267impl ::protobuf::reflect::ProtobufValue for Feed {
268    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
269        ::protobuf::reflect::ProtobufValueRef::Message(self)
270    }
271}
272
273static file_descriptor_proto_data: &'static [u8] = b"\
274    \n\nfeed.proto\"@\n\x04Feed\x12\"\n\x0cdiscoveryKey\x18\x01\x20\x02(\x0c\
275    R\x0cdiscoveryKey\x12\x14\n\x05nonce\x18\x02\x20\x01(\x0cR\x05nonce\
276";
277
278static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
279    lock: ::protobuf::lazy::ONCE_INIT,
280    ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
281};
282
283fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
284    ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
285}
286
287pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
288    unsafe {
289        file_descriptor_proto_lazy.get(|| {
290            parse_descriptor_proto()
291        })
292    }
293}