1#![allow(non_snake_case)]
4#![allow(non_upper_case_globals)]
5#![allow(non_camel_case_types)]
6#![allow(unused_imports)]
7#![allow(unknown_lints)]
8#![allow(clippy::all)]
9#![cfg_attr(rustfmt, rustfmt_skip)]
10
11
12use std::collections::HashMap;
13type KVMap<K, V> = HashMap<K, V>;
14use quick_protobuf::{MessageInfo, MessageRead, MessageWrite, BytesReader, Writer, WriterBackend, Result};
15use quick_protobuf::sizeofs::*;
16use super::*;
17
18#[allow(clippy::derive_partial_eq_without_eq)]
19#[derive(Debug, Default, PartialEq, Clone)]
20pub struct Msg {
21 pub header: Option<usp::Header>,
22 pub body: Option<usp::Body>,
23}
24
25impl<'a> MessageRead<'a> for Msg {
26 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
27 let mut msg = Self::default();
28 while !r.is_eof() {
29 match r.next_tag(bytes) {
30 Ok(10) => msg.header = Some(r.read_message::<usp::Header>(bytes)?),
31 Ok(18) => msg.body = Some(r.read_message::<usp::Body>(bytes)?),
32 Ok(t) => { r.read_unknown(bytes, t)?; }
33 Err(e) => return Err(e),
34 }
35 }
36 Ok(msg)
37 }
38}
39
40impl MessageWrite for Msg {
41 fn get_size(&self) -> usize {
42 0
43 + self.header.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
44 + self.body.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
45 }
46
47 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
48 if let Some(ref s) = self.header { w.write_with_tag(10, |w| w.write_message(s))?; }
49 if let Some(ref s) = self.body { w.write_with_tag(18, |w| w.write_message(s))?; }
50 Ok(())
51 }
52}
53
54#[allow(clippy::derive_partial_eq_without_eq)]
55#[derive(Debug, Default, PartialEq, Clone)]
56pub struct Header {
57 pub msg_id: String,
58 pub msg_type: usp::mod_Header::MsgType,
59}
60
61impl<'a> MessageRead<'a> for Header {
62 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
63 let mut msg = Self::default();
64 while !r.is_eof() {
65 match r.next_tag(bytes) {
66 Ok(10) => msg.msg_id = r.read_string(bytes)?.to_owned(),
67 Ok(16) => msg.msg_type = r.read_enum(bytes)?,
68 Ok(t) => { r.read_unknown(bytes, t)?; }
69 Err(e) => return Err(e),
70 }
71 }
72 Ok(msg)
73 }
74}
75
76impl MessageWrite for Header {
77 fn get_size(&self) -> usize {
78 0
79 + if self.msg_id == String::default() { 0 } else { 1 + sizeof_len((&self.msg_id).len()) }
80 + if self.msg_type == usp::mod_Header::MsgType::ERROR { 0 } else { 1 + sizeof_varint(*(&self.msg_type) as u64) }
81 }
82
83 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
84 if self.msg_id != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.msg_id))?; }
85 if self.msg_type != usp::mod_Header::MsgType::ERROR { w.write_with_tag(16, |w| w.write_enum(*&self.msg_type as i32))?; }
86 Ok(())
87 }
88}
89
90pub mod mod_Header {
91
92
93#[derive(Debug, PartialEq, Eq, Clone, Copy)]
94pub enum MsgType {
95 ERROR = 0,
96 GET = 1,
97 GET_RESP = 2,
98 NOTIFY = 3,
99 SET = 4,
100 SET_RESP = 5,
101 OPERATE = 6,
102 OPERATE_RESP = 7,
103 ADD = 8,
104 ADD_RESP = 9,
105 DELETE = 10,
106 DELETE_RESP = 11,
107 GET_SUPPORTED_DM = 12,
108 GET_SUPPORTED_DM_RESP = 13,
109 GET_INSTANCES = 14,
110 GET_INSTANCES_RESP = 15,
111 NOTIFY_RESP = 16,
112 GET_SUPPORTED_PROTO = 17,
113 GET_SUPPORTED_PROTO_RESP = 18,
114 REGISTER = 19,
115 REGISTER_RESP = 20,
116 DEREGISTER = 21,
117 DEREGISTER_RESP = 22,
118}
119
120impl Default for MsgType {
121 fn default() -> Self {
122 MsgType::ERROR
123 }
124}
125
126impl From<i32> for MsgType {
127 fn from(i: i32) -> Self {
128 match i {
129 0 => MsgType::ERROR,
130 1 => MsgType::GET,
131 2 => MsgType::GET_RESP,
132 3 => MsgType::NOTIFY,
133 4 => MsgType::SET,
134 5 => MsgType::SET_RESP,
135 6 => MsgType::OPERATE,
136 7 => MsgType::OPERATE_RESP,
137 8 => MsgType::ADD,
138 9 => MsgType::ADD_RESP,
139 10 => MsgType::DELETE,
140 11 => MsgType::DELETE_RESP,
141 12 => MsgType::GET_SUPPORTED_DM,
142 13 => MsgType::GET_SUPPORTED_DM_RESP,
143 14 => MsgType::GET_INSTANCES,
144 15 => MsgType::GET_INSTANCES_RESP,
145 16 => MsgType::NOTIFY_RESP,
146 17 => MsgType::GET_SUPPORTED_PROTO,
147 18 => MsgType::GET_SUPPORTED_PROTO_RESP,
148 19 => MsgType::REGISTER,
149 20 => MsgType::REGISTER_RESP,
150 21 => MsgType::DEREGISTER,
151 22 => MsgType::DEREGISTER_RESP,
152 _ => Self::default(),
153 }
154 }
155}
156
157impl<'a> From<&'a str> for MsgType {
158 fn from(s: &'a str) -> Self {
159 match s {
160 "ERROR" => MsgType::ERROR,
161 "GET" => MsgType::GET,
162 "GET_RESP" => MsgType::GET_RESP,
163 "NOTIFY" => MsgType::NOTIFY,
164 "SET" => MsgType::SET,
165 "SET_RESP" => MsgType::SET_RESP,
166 "OPERATE" => MsgType::OPERATE,
167 "OPERATE_RESP" => MsgType::OPERATE_RESP,
168 "ADD" => MsgType::ADD,
169 "ADD_RESP" => MsgType::ADD_RESP,
170 "DELETE" => MsgType::DELETE,
171 "DELETE_RESP" => MsgType::DELETE_RESP,
172 "GET_SUPPORTED_DM" => MsgType::GET_SUPPORTED_DM,
173 "GET_SUPPORTED_DM_RESP" => MsgType::GET_SUPPORTED_DM_RESP,
174 "GET_INSTANCES" => MsgType::GET_INSTANCES,
175 "GET_INSTANCES_RESP" => MsgType::GET_INSTANCES_RESP,
176 "NOTIFY_RESP" => MsgType::NOTIFY_RESP,
177 "GET_SUPPORTED_PROTO" => MsgType::GET_SUPPORTED_PROTO,
178 "GET_SUPPORTED_PROTO_RESP" => MsgType::GET_SUPPORTED_PROTO_RESP,
179 "REGISTER" => MsgType::REGISTER,
180 "REGISTER_RESP" => MsgType::REGISTER_RESP,
181 "DEREGISTER" => MsgType::DEREGISTER,
182 "DEREGISTER_RESP" => MsgType::DEREGISTER_RESP,
183 _ => Self::default(),
184 }
185 }
186}
187
188}
189
190#[allow(clippy::derive_partial_eq_without_eq)]
191#[derive(Debug, Default, PartialEq, Clone)]
192pub struct Body {
193 pub msg_body: usp::mod_Body::OneOfmsg_body,
194}
195
196impl<'a> MessageRead<'a> for Body {
197 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
198 let mut msg = Self::default();
199 while !r.is_eof() {
200 match r.next_tag(bytes) {
201 Ok(10) => msg.msg_body = usp::mod_Body::OneOfmsg_body::request(r.read_message::<usp::Request>(bytes)?),
202 Ok(18) => msg.msg_body = usp::mod_Body::OneOfmsg_body::response(r.read_message::<usp::Response>(bytes)?),
203 Ok(26) => msg.msg_body = usp::mod_Body::OneOfmsg_body::error(r.read_message::<usp::Error>(bytes)?),
204 Ok(t) => { r.read_unknown(bytes, t)?; }
205 Err(e) => return Err(e),
206 }
207 }
208 Ok(msg)
209 }
210}
211
212impl MessageWrite for Body {
213 fn get_size(&self) -> usize {
214 0
215 + match self.msg_body {
216 usp::mod_Body::OneOfmsg_body::request(ref m) => 1 + sizeof_len((m).get_size()),
217 usp::mod_Body::OneOfmsg_body::response(ref m) => 1 + sizeof_len((m).get_size()),
218 usp::mod_Body::OneOfmsg_body::error(ref m) => 1 + sizeof_len((m).get_size()),
219 usp::mod_Body::OneOfmsg_body::None => 0,
220 } }
221
222 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
223 match self.msg_body { usp::mod_Body::OneOfmsg_body::request(ref m) => { w.write_with_tag(10, |w| w.write_message(m))? },
224 usp::mod_Body::OneOfmsg_body::response(ref m) => { w.write_with_tag(18, |w| w.write_message(m))? },
225 usp::mod_Body::OneOfmsg_body::error(ref m) => { w.write_with_tag(26, |w| w.write_message(m))? },
226 usp::mod_Body::OneOfmsg_body::None => {},
227 } Ok(())
228 }
229}
230
231pub mod mod_Body {
232
233use super::*;
234
235#[derive(Debug, PartialEq, Clone)]
236pub enum OneOfmsg_body {
237 request(usp::Request),
238 response(usp::Response),
239 error(usp::Error),
240 None,
241}
242
243impl Default for OneOfmsg_body {
244 fn default() -> Self {
245 OneOfmsg_body::None
246 }
247}
248
249}
250
251#[allow(clippy::derive_partial_eq_without_eq)]
252#[derive(Debug, Default, PartialEq, Clone)]
253pub struct Request {
254 pub req_type: usp::mod_Request::OneOfreq_type,
255}
256
257impl<'a> MessageRead<'a> for Request {
258 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
259 let mut msg = Self::default();
260 while !r.is_eof() {
261 match r.next_tag(bytes) {
262 Ok(10) => msg.req_type = usp::mod_Request::OneOfreq_type::get(r.read_message::<usp::Get>(bytes)?),
263 Ok(18) => msg.req_type = usp::mod_Request::OneOfreq_type::get_supported_dm(r.read_message::<usp::GetSupportedDM>(bytes)?),
264 Ok(26) => msg.req_type = usp::mod_Request::OneOfreq_type::get_instances(r.read_message::<usp::GetInstances>(bytes)?),
265 Ok(34) => msg.req_type = usp::mod_Request::OneOfreq_type::set(r.read_message::<usp::Set>(bytes)?),
266 Ok(42) => msg.req_type = usp::mod_Request::OneOfreq_type::add(r.read_message::<usp::Add>(bytes)?),
267 Ok(50) => msg.req_type = usp::mod_Request::OneOfreq_type::delete(r.read_message::<usp::Delete>(bytes)?),
268 Ok(58) => msg.req_type = usp::mod_Request::OneOfreq_type::operate(r.read_message::<usp::Operate>(bytes)?),
269 Ok(66) => msg.req_type = usp::mod_Request::OneOfreq_type::notify(r.read_message::<usp::Notify>(bytes)?),
270 Ok(74) => msg.req_type = usp::mod_Request::OneOfreq_type::get_supported_protocol(r.read_message::<usp::GetSupportedProtocol>(bytes)?),
271 Ok(82) => msg.req_type = usp::mod_Request::OneOfreq_type::register(r.read_message::<usp::Register>(bytes)?),
272 Ok(90) => msg.req_type = usp::mod_Request::OneOfreq_type::deregister(r.read_message::<usp::Deregister>(bytes)?),
273 Ok(t) => { r.read_unknown(bytes, t)?; }
274 Err(e) => return Err(e),
275 }
276 }
277 Ok(msg)
278 }
279}
280
281impl MessageWrite for Request {
282 fn get_size(&self) -> usize {
283 0
284 + match self.req_type {
285 usp::mod_Request::OneOfreq_type::get(ref m) => 1 + sizeof_len((m).get_size()),
286 usp::mod_Request::OneOfreq_type::get_supported_dm(ref m) => 1 + sizeof_len((m).get_size()),
287 usp::mod_Request::OneOfreq_type::get_instances(ref m) => 1 + sizeof_len((m).get_size()),
288 usp::mod_Request::OneOfreq_type::set(ref m) => 1 + sizeof_len((m).get_size()),
289 usp::mod_Request::OneOfreq_type::add(ref m) => 1 + sizeof_len((m).get_size()),
290 usp::mod_Request::OneOfreq_type::delete(ref m) => 1 + sizeof_len((m).get_size()),
291 usp::mod_Request::OneOfreq_type::operate(ref m) => 1 + sizeof_len((m).get_size()),
292 usp::mod_Request::OneOfreq_type::notify(ref m) => 1 + sizeof_len((m).get_size()),
293 usp::mod_Request::OneOfreq_type::get_supported_protocol(ref m) => 1 + sizeof_len((m).get_size()),
294 usp::mod_Request::OneOfreq_type::register(ref m) => 1 + sizeof_len((m).get_size()),
295 usp::mod_Request::OneOfreq_type::deregister(ref m) => 1 + sizeof_len((m).get_size()),
296 usp::mod_Request::OneOfreq_type::None => 0,
297 } }
298
299 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
300 match self.req_type { usp::mod_Request::OneOfreq_type::get(ref m) => { w.write_with_tag(10, |w| w.write_message(m))? },
301 usp::mod_Request::OneOfreq_type::get_supported_dm(ref m) => { w.write_with_tag(18, |w| w.write_message(m))? },
302 usp::mod_Request::OneOfreq_type::get_instances(ref m) => { w.write_with_tag(26, |w| w.write_message(m))? },
303 usp::mod_Request::OneOfreq_type::set(ref m) => { w.write_with_tag(34, |w| w.write_message(m))? },
304 usp::mod_Request::OneOfreq_type::add(ref m) => { w.write_with_tag(42, |w| w.write_message(m))? },
305 usp::mod_Request::OneOfreq_type::delete(ref m) => { w.write_with_tag(50, |w| w.write_message(m))? },
306 usp::mod_Request::OneOfreq_type::operate(ref m) => { w.write_with_tag(58, |w| w.write_message(m))? },
307 usp::mod_Request::OneOfreq_type::notify(ref m) => { w.write_with_tag(66, |w| w.write_message(m))? },
308 usp::mod_Request::OneOfreq_type::get_supported_protocol(ref m) => { w.write_with_tag(74, |w| w.write_message(m))? },
309 usp::mod_Request::OneOfreq_type::register(ref m) => { w.write_with_tag(82, |w| w.write_message(m))? },
310 usp::mod_Request::OneOfreq_type::deregister(ref m) => { w.write_with_tag(90, |w| w.write_message(m))? },
311 usp::mod_Request::OneOfreq_type::None => {},
312 } Ok(())
313 }
314}
315
316pub mod mod_Request {
317
318use super::*;
319
320#[derive(Debug, PartialEq, Clone)]
321pub enum OneOfreq_type {
322 get(usp::Get),
323 get_supported_dm(usp::GetSupportedDM),
324 get_instances(usp::GetInstances),
325 set(usp::Set),
326 add(usp::Add),
327 delete(usp::Delete),
328 operate(usp::Operate),
329 notify(usp::Notify),
330 get_supported_protocol(usp::GetSupportedProtocol),
331 register(usp::Register),
332 deregister(usp::Deregister),
333 None,
334}
335
336impl Default for OneOfreq_type {
337 fn default() -> Self {
338 OneOfreq_type::None
339 }
340}
341
342}
343
344#[allow(clippy::derive_partial_eq_without_eq)]
345#[derive(Debug, Default, PartialEq, Clone)]
346pub struct Response {
347 pub resp_type: usp::mod_Response::OneOfresp_type,
348}
349
350impl<'a> MessageRead<'a> for Response {
351 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
352 let mut msg = Self::default();
353 while !r.is_eof() {
354 match r.next_tag(bytes) {
355 Ok(10) => msg.resp_type = usp::mod_Response::OneOfresp_type::get_resp(r.read_message::<usp::GetResp>(bytes)?),
356 Ok(18) => msg.resp_type = usp::mod_Response::OneOfresp_type::get_supported_dm_resp(r.read_message::<usp::GetSupportedDMResp>(bytes)?),
357 Ok(26) => msg.resp_type = usp::mod_Response::OneOfresp_type::get_instances_resp(r.read_message::<usp::GetInstancesResp>(bytes)?),
358 Ok(34) => msg.resp_type = usp::mod_Response::OneOfresp_type::set_resp(r.read_message::<usp::SetResp>(bytes)?),
359 Ok(42) => msg.resp_type = usp::mod_Response::OneOfresp_type::add_resp(r.read_message::<usp::AddResp>(bytes)?),
360 Ok(50) => msg.resp_type = usp::mod_Response::OneOfresp_type::delete_resp(r.read_message::<usp::DeleteResp>(bytes)?),
361 Ok(58) => msg.resp_type = usp::mod_Response::OneOfresp_type::operate_resp(r.read_message::<usp::OperateResp>(bytes)?),
362 Ok(66) => msg.resp_type = usp::mod_Response::OneOfresp_type::notify_resp(r.read_message::<usp::NotifyResp>(bytes)?),
363 Ok(74) => msg.resp_type = usp::mod_Response::OneOfresp_type::get_supported_protocol_resp(r.read_message::<usp::GetSupportedProtocolResp>(bytes)?),
364 Ok(82) => msg.resp_type = usp::mod_Response::OneOfresp_type::register_resp(r.read_message::<usp::RegisterResp>(bytes)?),
365 Ok(90) => msg.resp_type = usp::mod_Response::OneOfresp_type::deregister_resp(r.read_message::<usp::DeregisterResp>(bytes)?),
366 Ok(t) => { r.read_unknown(bytes, t)?; }
367 Err(e) => return Err(e),
368 }
369 }
370 Ok(msg)
371 }
372}
373
374impl MessageWrite for Response {
375 fn get_size(&self) -> usize {
376 0
377 + match self.resp_type {
378 usp::mod_Response::OneOfresp_type::get_resp(ref m) => 1 + sizeof_len((m).get_size()),
379 usp::mod_Response::OneOfresp_type::get_supported_dm_resp(ref m) => 1 + sizeof_len((m).get_size()),
380 usp::mod_Response::OneOfresp_type::get_instances_resp(ref m) => 1 + sizeof_len((m).get_size()),
381 usp::mod_Response::OneOfresp_type::set_resp(ref m) => 1 + sizeof_len((m).get_size()),
382 usp::mod_Response::OneOfresp_type::add_resp(ref m) => 1 + sizeof_len((m).get_size()),
383 usp::mod_Response::OneOfresp_type::delete_resp(ref m) => 1 + sizeof_len((m).get_size()),
384 usp::mod_Response::OneOfresp_type::operate_resp(ref m) => 1 + sizeof_len((m).get_size()),
385 usp::mod_Response::OneOfresp_type::notify_resp(ref m) => 1 + sizeof_len((m).get_size()),
386 usp::mod_Response::OneOfresp_type::get_supported_protocol_resp(ref m) => 1 + sizeof_len((m).get_size()),
387 usp::mod_Response::OneOfresp_type::register_resp(ref m) => 1 + sizeof_len((m).get_size()),
388 usp::mod_Response::OneOfresp_type::deregister_resp(ref m) => 1 + sizeof_len((m).get_size()),
389 usp::mod_Response::OneOfresp_type::None => 0,
390 } }
391
392 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
393 match self.resp_type { usp::mod_Response::OneOfresp_type::get_resp(ref m) => { w.write_with_tag(10, |w| w.write_message(m))? },
394 usp::mod_Response::OneOfresp_type::get_supported_dm_resp(ref m) => { w.write_with_tag(18, |w| w.write_message(m))? },
395 usp::mod_Response::OneOfresp_type::get_instances_resp(ref m) => { w.write_with_tag(26, |w| w.write_message(m))? },
396 usp::mod_Response::OneOfresp_type::set_resp(ref m) => { w.write_with_tag(34, |w| w.write_message(m))? },
397 usp::mod_Response::OneOfresp_type::add_resp(ref m) => { w.write_with_tag(42, |w| w.write_message(m))? },
398 usp::mod_Response::OneOfresp_type::delete_resp(ref m) => { w.write_with_tag(50, |w| w.write_message(m))? },
399 usp::mod_Response::OneOfresp_type::operate_resp(ref m) => { w.write_with_tag(58, |w| w.write_message(m))? },
400 usp::mod_Response::OneOfresp_type::notify_resp(ref m) => { w.write_with_tag(66, |w| w.write_message(m))? },
401 usp::mod_Response::OneOfresp_type::get_supported_protocol_resp(ref m) => { w.write_with_tag(74, |w| w.write_message(m))? },
402 usp::mod_Response::OneOfresp_type::register_resp(ref m) => { w.write_with_tag(82, |w| w.write_message(m))? },
403 usp::mod_Response::OneOfresp_type::deregister_resp(ref m) => { w.write_with_tag(90, |w| w.write_message(m))? },
404 usp::mod_Response::OneOfresp_type::None => {},
405 } Ok(())
406 }
407}
408
409pub mod mod_Response {
410
411use super::*;
412
413#[derive(Debug, PartialEq, Clone)]
414pub enum OneOfresp_type {
415 get_resp(usp::GetResp),
416 get_supported_dm_resp(usp::GetSupportedDMResp),
417 get_instances_resp(usp::GetInstancesResp),
418 set_resp(usp::SetResp),
419 add_resp(usp::AddResp),
420 delete_resp(usp::DeleteResp),
421 operate_resp(usp::OperateResp),
422 notify_resp(usp::NotifyResp),
423 get_supported_protocol_resp(usp::GetSupportedProtocolResp),
424 register_resp(usp::RegisterResp),
425 deregister_resp(usp::DeregisterResp),
426 None,
427}
428
429impl Default for OneOfresp_type {
430 fn default() -> Self {
431 OneOfresp_type::None
432 }
433}
434
435}
436
437#[allow(clippy::derive_partial_eq_without_eq)]
438#[derive(Debug, Default, PartialEq, Clone)]
439pub struct Error {
440 pub err_code: u32,
441 pub err_msg: String,
442 pub param_errs: Vec<usp::mod_Error::ParamError>,
443}
444
445impl<'a> MessageRead<'a> for Error {
446 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
447 let mut msg = Self::default();
448 while !r.is_eof() {
449 match r.next_tag(bytes) {
450 Ok(13) => msg.err_code = r.read_fixed32(bytes)?,
451 Ok(18) => msg.err_msg = r.read_string(bytes)?.to_owned(),
452 Ok(26) => msg.param_errs.push(r.read_message::<usp::mod_Error::ParamError>(bytes)?),
453 Ok(t) => { r.read_unknown(bytes, t)?; }
454 Err(e) => return Err(e),
455 }
456 }
457 Ok(msg)
458 }
459}
460
461impl MessageWrite for Error {
462 fn get_size(&self) -> usize {
463 0
464 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
465 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
466 + self.param_errs.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
467 }
468
469 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
470 if self.err_code != 0u32 { w.write_with_tag(13, |w| w.write_fixed32(*&self.err_code))?; }
471 if self.err_msg != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.err_msg))?; }
472 for s in &self.param_errs { w.write_with_tag(26, |w| w.write_message(s))?; }
473 Ok(())
474 }
475}
476
477pub mod mod_Error {
478
479use super::*;
480
481#[allow(clippy::derive_partial_eq_without_eq)]
482#[derive(Debug, Default, PartialEq, Clone)]
483pub struct ParamError {
484 pub param_path: String,
485 pub err_code: u32,
486 pub err_msg: String,
487}
488
489impl<'a> MessageRead<'a> for ParamError {
490 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
491 let mut msg = Self::default();
492 while !r.is_eof() {
493 match r.next_tag(bytes) {
494 Ok(10) => msg.param_path = r.read_string(bytes)?.to_owned(),
495 Ok(21) => msg.err_code = r.read_fixed32(bytes)?,
496 Ok(26) => msg.err_msg = r.read_string(bytes)?.to_owned(),
497 Ok(t) => { r.read_unknown(bytes, t)?; }
498 Err(e) => return Err(e),
499 }
500 }
501 Ok(msg)
502 }
503}
504
505impl MessageWrite for ParamError {
506 fn get_size(&self) -> usize {
507 0
508 + if self.param_path == String::default() { 0 } else { 1 + sizeof_len((&self.param_path).len()) }
509 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
510 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
511 }
512
513 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
514 if self.param_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.param_path))?; }
515 if self.err_code != 0u32 { w.write_with_tag(21, |w| w.write_fixed32(*&self.err_code))?; }
516 if self.err_msg != String::default() { w.write_with_tag(26, |w| w.write_string(&**&self.err_msg))?; }
517 Ok(())
518 }
519}
520
521}
522
523#[allow(clippy::derive_partial_eq_without_eq)]
524#[derive(Debug, Default, PartialEq, Clone)]
525pub struct Get {
526 pub param_paths: Vec<String>,
527 pub max_depth: u32,
528}
529
530impl<'a> MessageRead<'a> for Get {
531 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
532 let mut msg = Self::default();
533 while !r.is_eof() {
534 match r.next_tag(bytes) {
535 Ok(10) => msg.param_paths.push(r.read_string(bytes)?.to_owned()),
536 Ok(21) => msg.max_depth = r.read_fixed32(bytes)?,
537 Ok(t) => { r.read_unknown(bytes, t)?; }
538 Err(e) => return Err(e),
539 }
540 }
541 Ok(msg)
542 }
543}
544
545impl MessageWrite for Get {
546 fn get_size(&self) -> usize {
547 0
548 + self.param_paths.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
549 + if self.max_depth == 0u32 { 0 } else { 1 + 4 }
550 }
551
552 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
553 for s in &self.param_paths { w.write_with_tag(10, |w| w.write_string(&**s))?; }
554 if self.max_depth != 0u32 { w.write_with_tag(21, |w| w.write_fixed32(*&self.max_depth))?; }
555 Ok(())
556 }
557}
558
559#[allow(clippy::derive_partial_eq_without_eq)]
560#[derive(Debug, Default, PartialEq, Clone)]
561pub struct GetResp {
562 pub req_path_results: Vec<usp::mod_GetResp::RequestedPathResult>,
563}
564
565impl<'a> MessageRead<'a> for GetResp {
566 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
567 let mut msg = Self::default();
568 while !r.is_eof() {
569 match r.next_tag(bytes) {
570 Ok(10) => msg.req_path_results.push(r.read_message::<usp::mod_GetResp::RequestedPathResult>(bytes)?),
571 Ok(t) => { r.read_unknown(bytes, t)?; }
572 Err(e) => return Err(e),
573 }
574 }
575 Ok(msg)
576 }
577}
578
579impl MessageWrite for GetResp {
580 fn get_size(&self) -> usize {
581 0
582 + self.req_path_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
583 }
584
585 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
586 for s in &self.req_path_results { w.write_with_tag(10, |w| w.write_message(s))?; }
587 Ok(())
588 }
589}
590
591pub mod mod_GetResp {
592
593use std::collections::HashMap;
594type KVMap<K, V> = HashMap<K, V>;
595use super::*;
596
597#[allow(clippy::derive_partial_eq_without_eq)]
598#[derive(Debug, Default, PartialEq, Clone)]
599pub struct RequestedPathResult {
600 pub requested_path: String,
601 pub err_code: u32,
602 pub err_msg: String,
603 pub resolved_path_results: Vec<usp::mod_GetResp::ResolvedPathResult>,
604}
605
606impl<'a> MessageRead<'a> for RequestedPathResult {
607 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
608 let mut msg = Self::default();
609 while !r.is_eof() {
610 match r.next_tag(bytes) {
611 Ok(10) => msg.requested_path = r.read_string(bytes)?.to_owned(),
612 Ok(21) => msg.err_code = r.read_fixed32(bytes)?,
613 Ok(26) => msg.err_msg = r.read_string(bytes)?.to_owned(),
614 Ok(34) => msg.resolved_path_results.push(r.read_message::<usp::mod_GetResp::ResolvedPathResult>(bytes)?),
615 Ok(t) => { r.read_unknown(bytes, t)?; }
616 Err(e) => return Err(e),
617 }
618 }
619 Ok(msg)
620 }
621}
622
623impl MessageWrite for RequestedPathResult {
624 fn get_size(&self) -> usize {
625 0
626 + if self.requested_path == String::default() { 0 } else { 1 + sizeof_len((&self.requested_path).len()) }
627 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
628 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
629 + self.resolved_path_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
630 }
631
632 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
633 if self.requested_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.requested_path))?; }
634 if self.err_code != 0u32 { w.write_with_tag(21, |w| w.write_fixed32(*&self.err_code))?; }
635 if self.err_msg != String::default() { w.write_with_tag(26, |w| w.write_string(&**&self.err_msg))?; }
636 for s in &self.resolved_path_results { w.write_with_tag(34, |w| w.write_message(s))?; }
637 Ok(())
638 }
639}
640
641#[allow(clippy::derive_partial_eq_without_eq)]
642#[derive(Debug, Default, PartialEq, Clone)]
643pub struct ResolvedPathResult {
644 pub resolved_path: String,
645 pub result_params: KVMap<String, String>,
646}
647
648impl<'a> MessageRead<'a> for ResolvedPathResult {
649 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
650 let mut msg = Self::default();
651 while !r.is_eof() {
652 match r.next_tag(bytes) {
653 Ok(10) => msg.resolved_path = r.read_string(bytes)?.to_owned(),
654 Ok(18) => {
655 let (key, value) = r.read_map(bytes, |r, bytes| Ok(r.read_string(bytes)?.to_owned()), |r, bytes| Ok(r.read_string(bytes)?.to_owned()))?;
656 msg.result_params.insert(key, value);
657 }
658 Ok(t) => { r.read_unknown(bytes, t)?; }
659 Err(e) => return Err(e),
660 }
661 }
662 Ok(msg)
663 }
664}
665
666impl MessageWrite for ResolvedPathResult {
667 fn get_size(&self) -> usize {
668 0
669 + if self.resolved_path == String::default() { 0 } else { 1 + sizeof_len((&self.resolved_path).len()) }
670 + self.result_params.iter().map(|(k, v)| 1 + sizeof_len(2 + sizeof_len((k).len()) + sizeof_len((v).len()))).sum::<usize>()
671 }
672
673 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
674 if self.resolved_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.resolved_path))?; }
675 for (k, v) in self.result_params.iter() { w.write_with_tag(18, |w| w.write_map(2 + sizeof_len((k).len()) + sizeof_len((v).len()), 10, |w| w.write_string(&**k), 18, |w| w.write_string(&**v)))?; }
676 Ok(())
677 }
678}
679
680}
681
682#[allow(clippy::derive_partial_eq_without_eq)]
683#[derive(Debug, Default, PartialEq, Clone)]
684pub struct GetSupportedDM {
685 pub obj_paths: Vec<String>,
686 pub first_level_only: bool,
687 pub return_commands: bool,
688 pub return_events: bool,
689 pub return_params: bool,
690 pub return_unique_key_sets: bool,
691}
692
693impl<'a> MessageRead<'a> for GetSupportedDM {
694 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
695 let mut msg = Self::default();
696 while !r.is_eof() {
697 match r.next_tag(bytes) {
698 Ok(10) => msg.obj_paths.push(r.read_string(bytes)?.to_owned()),
699 Ok(16) => msg.first_level_only = r.read_bool(bytes)?,
700 Ok(24) => msg.return_commands = r.read_bool(bytes)?,
701 Ok(32) => msg.return_events = r.read_bool(bytes)?,
702 Ok(40) => msg.return_params = r.read_bool(bytes)?,
703 Ok(48) => msg.return_unique_key_sets = r.read_bool(bytes)?,
704 Ok(t) => { r.read_unknown(bytes, t)?; }
705 Err(e) => return Err(e),
706 }
707 }
708 Ok(msg)
709 }
710}
711
712impl MessageWrite for GetSupportedDM {
713 fn get_size(&self) -> usize {
714 0
715 + self.obj_paths.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
716 + if self.first_level_only == false { 0 } else { 1 + sizeof_varint(*(&self.first_level_only) as u64) }
717 + if self.return_commands == false { 0 } else { 1 + sizeof_varint(*(&self.return_commands) as u64) }
718 + if self.return_events == false { 0 } else { 1 + sizeof_varint(*(&self.return_events) as u64) }
719 + if self.return_params == false { 0 } else { 1 + sizeof_varint(*(&self.return_params) as u64) }
720 + if self.return_unique_key_sets == false { 0 } else { 1 + sizeof_varint(*(&self.return_unique_key_sets) as u64) }
721 }
722
723 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
724 for s in &self.obj_paths { w.write_with_tag(10, |w| w.write_string(&**s))?; }
725 if self.first_level_only != false { w.write_with_tag(16, |w| w.write_bool(*&self.first_level_only))?; }
726 if self.return_commands != false { w.write_with_tag(24, |w| w.write_bool(*&self.return_commands))?; }
727 if self.return_events != false { w.write_with_tag(32, |w| w.write_bool(*&self.return_events))?; }
728 if self.return_params != false { w.write_with_tag(40, |w| w.write_bool(*&self.return_params))?; }
729 if self.return_unique_key_sets != false { w.write_with_tag(48, |w| w.write_bool(*&self.return_unique_key_sets))?; }
730 Ok(())
731 }
732}
733
734#[allow(clippy::derive_partial_eq_without_eq)]
735#[derive(Debug, Default, PartialEq, Clone)]
736pub struct GetSupportedDMResp {
737 pub req_obj_results: Vec<usp::mod_GetSupportedDMResp::RequestedObjectResult>,
738}
739
740impl<'a> MessageRead<'a> for GetSupportedDMResp {
741 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
742 let mut msg = Self::default();
743 while !r.is_eof() {
744 match r.next_tag(bytes) {
745 Ok(10) => msg.req_obj_results.push(r.read_message::<usp::mod_GetSupportedDMResp::RequestedObjectResult>(bytes)?),
746 Ok(t) => { r.read_unknown(bytes, t)?; }
747 Err(e) => return Err(e),
748 }
749 }
750 Ok(msg)
751 }
752}
753
754impl MessageWrite for GetSupportedDMResp {
755 fn get_size(&self) -> usize {
756 0
757 + self.req_obj_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
758 }
759
760 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
761 for s in &self.req_obj_results { w.write_with_tag(10, |w| w.write_message(s))?; }
762 Ok(())
763 }
764}
765
766pub mod mod_GetSupportedDMResp {
767
768use super::*;
769
770#[allow(clippy::derive_partial_eq_without_eq)]
771#[derive(Debug, Default, PartialEq, Clone)]
772pub struct RequestedObjectResult {
773 pub req_obj_path: String,
774 pub err_code: u32,
775 pub err_msg: String,
776 pub data_model_inst_uri: String,
777 pub supported_objs: Vec<usp::mod_GetSupportedDMResp::SupportedObjectResult>,
778}
779
780impl<'a> MessageRead<'a> for RequestedObjectResult {
781 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
782 let mut msg = Self::default();
783 while !r.is_eof() {
784 match r.next_tag(bytes) {
785 Ok(10) => msg.req_obj_path = r.read_string(bytes)?.to_owned(),
786 Ok(21) => msg.err_code = r.read_fixed32(bytes)?,
787 Ok(26) => msg.err_msg = r.read_string(bytes)?.to_owned(),
788 Ok(34) => msg.data_model_inst_uri = r.read_string(bytes)?.to_owned(),
789 Ok(42) => msg.supported_objs.push(r.read_message::<usp::mod_GetSupportedDMResp::SupportedObjectResult>(bytes)?),
790 Ok(t) => { r.read_unknown(bytes, t)?; }
791 Err(e) => return Err(e),
792 }
793 }
794 Ok(msg)
795 }
796}
797
798impl MessageWrite for RequestedObjectResult {
799 fn get_size(&self) -> usize {
800 0
801 + if self.req_obj_path == String::default() { 0 } else { 1 + sizeof_len((&self.req_obj_path).len()) }
802 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
803 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
804 + if self.data_model_inst_uri == String::default() { 0 } else { 1 + sizeof_len((&self.data_model_inst_uri).len()) }
805 + self.supported_objs.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
806 }
807
808 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
809 if self.req_obj_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.req_obj_path))?; }
810 if self.err_code != 0u32 { w.write_with_tag(21, |w| w.write_fixed32(*&self.err_code))?; }
811 if self.err_msg != String::default() { w.write_with_tag(26, |w| w.write_string(&**&self.err_msg))?; }
812 if self.data_model_inst_uri != String::default() { w.write_with_tag(34, |w| w.write_string(&**&self.data_model_inst_uri))?; }
813 for s in &self.supported_objs { w.write_with_tag(42, |w| w.write_message(s))?; }
814 Ok(())
815 }
816}
817
818#[allow(clippy::derive_partial_eq_without_eq)]
819#[derive(Debug, Default, PartialEq, Clone)]
820pub struct SupportedObjectResult {
821 pub supported_obj_path: String,
822 pub access: usp::mod_GetSupportedDMResp::ObjAccessType,
823 pub is_multi_instance: bool,
824 pub supported_commands: Vec<usp::mod_GetSupportedDMResp::SupportedCommandResult>,
825 pub supported_events: Vec<usp::mod_GetSupportedDMResp::SupportedEventResult>,
826 pub supported_params: Vec<usp::mod_GetSupportedDMResp::SupportedParamResult>,
827 pub divergent_paths: Vec<String>,
828 pub unique_key_sets: Vec<usp::mod_GetSupportedDMResp::SupportedUniqueKeySet>,
829}
830
831impl<'a> MessageRead<'a> for SupportedObjectResult {
832 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
833 let mut msg = Self::default();
834 while !r.is_eof() {
835 match r.next_tag(bytes) {
836 Ok(10) => msg.supported_obj_path = r.read_string(bytes)?.to_owned(),
837 Ok(16) => msg.access = r.read_enum(bytes)?,
838 Ok(24) => msg.is_multi_instance = r.read_bool(bytes)?,
839 Ok(34) => msg.supported_commands.push(r.read_message::<usp::mod_GetSupportedDMResp::SupportedCommandResult>(bytes)?),
840 Ok(42) => msg.supported_events.push(r.read_message::<usp::mod_GetSupportedDMResp::SupportedEventResult>(bytes)?),
841 Ok(50) => msg.supported_params.push(r.read_message::<usp::mod_GetSupportedDMResp::SupportedParamResult>(bytes)?),
842 Ok(58) => msg.divergent_paths.push(r.read_string(bytes)?.to_owned()),
843 Ok(66) => msg.unique_key_sets.push(r.read_message::<usp::mod_GetSupportedDMResp::SupportedUniqueKeySet>(bytes)?),
844 Ok(t) => { r.read_unknown(bytes, t)?; }
845 Err(e) => return Err(e),
846 }
847 }
848 Ok(msg)
849 }
850}
851
852impl MessageWrite for SupportedObjectResult {
853 fn get_size(&self) -> usize {
854 0
855 + if self.supported_obj_path == String::default() { 0 } else { 1 + sizeof_len((&self.supported_obj_path).len()) }
856 + if self.access == usp::mod_GetSupportedDMResp::ObjAccessType::OBJ_READ_ONLY { 0 } else { 1 + sizeof_varint(*(&self.access) as u64) }
857 + if self.is_multi_instance == false { 0 } else { 1 + sizeof_varint(*(&self.is_multi_instance) as u64) }
858 + self.supported_commands.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
859 + self.supported_events.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
860 + self.supported_params.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
861 + self.divergent_paths.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
862 + self.unique_key_sets.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
863 }
864
865 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
866 if self.supported_obj_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.supported_obj_path))?; }
867 if self.access != usp::mod_GetSupportedDMResp::ObjAccessType::OBJ_READ_ONLY { w.write_with_tag(16, |w| w.write_enum(*&self.access as i32))?; }
868 if self.is_multi_instance != false { w.write_with_tag(24, |w| w.write_bool(*&self.is_multi_instance))?; }
869 for s in &self.supported_commands { w.write_with_tag(34, |w| w.write_message(s))?; }
870 for s in &self.supported_events { w.write_with_tag(42, |w| w.write_message(s))?; }
871 for s in &self.supported_params { w.write_with_tag(50, |w| w.write_message(s))?; }
872 for s in &self.divergent_paths { w.write_with_tag(58, |w| w.write_string(&**s))?; }
873 for s in &self.unique_key_sets { w.write_with_tag(66, |w| w.write_message(s))?; }
874 Ok(())
875 }
876}
877
878#[allow(clippy::derive_partial_eq_without_eq)]
879#[derive(Debug, Default, PartialEq, Clone)]
880pub struct SupportedParamResult {
881 pub param_name: String,
882 pub access: usp::mod_GetSupportedDMResp::ParamAccessType,
883 pub value_type: usp::mod_GetSupportedDMResp::ParamValueType,
884 pub value_change: usp::mod_GetSupportedDMResp::ValueChangeType,
885}
886
887impl<'a> MessageRead<'a> for SupportedParamResult {
888 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
889 let mut msg = Self::default();
890 while !r.is_eof() {
891 match r.next_tag(bytes) {
892 Ok(10) => msg.param_name = r.read_string(bytes)?.to_owned(),
893 Ok(16) => msg.access = r.read_enum(bytes)?,
894 Ok(24) => msg.value_type = r.read_enum(bytes)?,
895 Ok(32) => msg.value_change = r.read_enum(bytes)?,
896 Ok(t) => { r.read_unknown(bytes, t)?; }
897 Err(e) => return Err(e),
898 }
899 }
900 Ok(msg)
901 }
902}
903
904impl MessageWrite for SupportedParamResult {
905 fn get_size(&self) -> usize {
906 0
907 + if self.param_name == String::default() { 0 } else { 1 + sizeof_len((&self.param_name).len()) }
908 + if self.access == usp::mod_GetSupportedDMResp::ParamAccessType::PARAM_READ_ONLY { 0 } else { 1 + sizeof_varint(*(&self.access) as u64) }
909 + if self.value_type == usp::mod_GetSupportedDMResp::ParamValueType::PARAM_UNKNOWN { 0 } else { 1 + sizeof_varint(*(&self.value_type) as u64) }
910 + if self.value_change == usp::mod_GetSupportedDMResp::ValueChangeType::VALUE_CHANGE_UNKNOWN { 0 } else { 1 + sizeof_varint(*(&self.value_change) as u64) }
911 }
912
913 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
914 if self.param_name != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.param_name))?; }
915 if self.access != usp::mod_GetSupportedDMResp::ParamAccessType::PARAM_READ_ONLY { w.write_with_tag(16, |w| w.write_enum(*&self.access as i32))?; }
916 if self.value_type != usp::mod_GetSupportedDMResp::ParamValueType::PARAM_UNKNOWN { w.write_with_tag(24, |w| w.write_enum(*&self.value_type as i32))?; }
917 if self.value_change != usp::mod_GetSupportedDMResp::ValueChangeType::VALUE_CHANGE_UNKNOWN { w.write_with_tag(32, |w| w.write_enum(*&self.value_change as i32))?; }
918 Ok(())
919 }
920}
921
922#[allow(clippy::derive_partial_eq_without_eq)]
923#[derive(Debug, Default, PartialEq, Clone)]
924pub struct SupportedCommandResult {
925 pub command_name: String,
926 pub input_arg_names: Vec<String>,
927 pub output_arg_names: Vec<String>,
928 pub command_type: usp::mod_GetSupportedDMResp::CmdType,
929}
930
931impl<'a> MessageRead<'a> for SupportedCommandResult {
932 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
933 let mut msg = Self::default();
934 while !r.is_eof() {
935 match r.next_tag(bytes) {
936 Ok(10) => msg.command_name = r.read_string(bytes)?.to_owned(),
937 Ok(18) => msg.input_arg_names.push(r.read_string(bytes)?.to_owned()),
938 Ok(26) => msg.output_arg_names.push(r.read_string(bytes)?.to_owned()),
939 Ok(32) => msg.command_type = r.read_enum(bytes)?,
940 Ok(t) => { r.read_unknown(bytes, t)?; }
941 Err(e) => return Err(e),
942 }
943 }
944 Ok(msg)
945 }
946}
947
948impl MessageWrite for SupportedCommandResult {
949 fn get_size(&self) -> usize {
950 0
951 + if self.command_name == String::default() { 0 } else { 1 + sizeof_len((&self.command_name).len()) }
952 + self.input_arg_names.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
953 + self.output_arg_names.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
954 + if self.command_type == usp::mod_GetSupportedDMResp::CmdType::CMD_UNKNOWN { 0 } else { 1 + sizeof_varint(*(&self.command_type) as u64) }
955 }
956
957 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
958 if self.command_name != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.command_name))?; }
959 for s in &self.input_arg_names { w.write_with_tag(18, |w| w.write_string(&**s))?; }
960 for s in &self.output_arg_names { w.write_with_tag(26, |w| w.write_string(&**s))?; }
961 if self.command_type != usp::mod_GetSupportedDMResp::CmdType::CMD_UNKNOWN { w.write_with_tag(32, |w| w.write_enum(*&self.command_type as i32))?; }
962 Ok(())
963 }
964}
965
966#[allow(clippy::derive_partial_eq_without_eq)]
967#[derive(Debug, Default, PartialEq, Clone)]
968pub struct SupportedEventResult {
969 pub event_name: String,
970 pub arg_names: Vec<String>,
971}
972
973impl<'a> MessageRead<'a> for SupportedEventResult {
974 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
975 let mut msg = Self::default();
976 while !r.is_eof() {
977 match r.next_tag(bytes) {
978 Ok(10) => msg.event_name = r.read_string(bytes)?.to_owned(),
979 Ok(18) => msg.arg_names.push(r.read_string(bytes)?.to_owned()),
980 Ok(t) => { r.read_unknown(bytes, t)?; }
981 Err(e) => return Err(e),
982 }
983 }
984 Ok(msg)
985 }
986}
987
988impl MessageWrite for SupportedEventResult {
989 fn get_size(&self) -> usize {
990 0
991 + if self.event_name == String::default() { 0 } else { 1 + sizeof_len((&self.event_name).len()) }
992 + self.arg_names.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
993 }
994
995 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
996 if self.event_name != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.event_name))?; }
997 for s in &self.arg_names { w.write_with_tag(18, |w| w.write_string(&**s))?; }
998 Ok(())
999 }
1000}
1001
1002#[allow(clippy::derive_partial_eq_without_eq)]
1003#[derive(Debug, Default, PartialEq, Clone)]
1004pub struct SupportedUniqueKeySet {
1005 pub key_names: Vec<String>,
1006}
1007
1008impl<'a> MessageRead<'a> for SupportedUniqueKeySet {
1009 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1010 let mut msg = Self::default();
1011 while !r.is_eof() {
1012 match r.next_tag(bytes) {
1013 Ok(10) => msg.key_names.push(r.read_string(bytes)?.to_owned()),
1014 Ok(t) => { r.read_unknown(bytes, t)?; }
1015 Err(e) => return Err(e),
1016 }
1017 }
1018 Ok(msg)
1019 }
1020}
1021
1022impl MessageWrite for SupportedUniqueKeySet {
1023 fn get_size(&self) -> usize {
1024 0
1025 + self.key_names.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
1026 }
1027
1028 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1029 for s in &self.key_names { w.write_with_tag(10, |w| w.write_string(&**s))?; }
1030 Ok(())
1031 }
1032}
1033
1034#[derive(Debug, PartialEq, Eq, Clone, Copy)]
1035pub enum ParamAccessType {
1036 PARAM_READ_ONLY = 0,
1037 PARAM_READ_WRITE = 1,
1038 PARAM_WRITE_ONLY = 2,
1039}
1040
1041impl Default for ParamAccessType {
1042 fn default() -> Self {
1043 ParamAccessType::PARAM_READ_ONLY
1044 }
1045}
1046
1047impl From<i32> for ParamAccessType {
1048 fn from(i: i32) -> Self {
1049 match i {
1050 0 => ParamAccessType::PARAM_READ_ONLY,
1051 1 => ParamAccessType::PARAM_READ_WRITE,
1052 2 => ParamAccessType::PARAM_WRITE_ONLY,
1053 _ => Self::default(),
1054 }
1055 }
1056}
1057
1058impl<'a> From<&'a str> for ParamAccessType {
1059 fn from(s: &'a str) -> Self {
1060 match s {
1061 "PARAM_READ_ONLY" => ParamAccessType::PARAM_READ_ONLY,
1062 "PARAM_READ_WRITE" => ParamAccessType::PARAM_READ_WRITE,
1063 "PARAM_WRITE_ONLY" => ParamAccessType::PARAM_WRITE_ONLY,
1064 _ => Self::default(),
1065 }
1066 }
1067}
1068
1069#[derive(Debug, PartialEq, Eq, Clone, Copy)]
1070pub enum ObjAccessType {
1071 OBJ_READ_ONLY = 0,
1072 OBJ_ADD_DELETE = 1,
1073 OBJ_ADD_ONLY = 2,
1074 OBJ_DELETE_ONLY = 3,
1075}
1076
1077impl Default for ObjAccessType {
1078 fn default() -> Self {
1079 ObjAccessType::OBJ_READ_ONLY
1080 }
1081}
1082
1083impl From<i32> for ObjAccessType {
1084 fn from(i: i32) -> Self {
1085 match i {
1086 0 => ObjAccessType::OBJ_READ_ONLY,
1087 1 => ObjAccessType::OBJ_ADD_DELETE,
1088 2 => ObjAccessType::OBJ_ADD_ONLY,
1089 3 => ObjAccessType::OBJ_DELETE_ONLY,
1090 _ => Self::default(),
1091 }
1092 }
1093}
1094
1095impl<'a> From<&'a str> for ObjAccessType {
1096 fn from(s: &'a str) -> Self {
1097 match s {
1098 "OBJ_READ_ONLY" => ObjAccessType::OBJ_READ_ONLY,
1099 "OBJ_ADD_DELETE" => ObjAccessType::OBJ_ADD_DELETE,
1100 "OBJ_ADD_ONLY" => ObjAccessType::OBJ_ADD_ONLY,
1101 "OBJ_DELETE_ONLY" => ObjAccessType::OBJ_DELETE_ONLY,
1102 _ => Self::default(),
1103 }
1104 }
1105}
1106
1107#[derive(Debug, PartialEq, Eq, Clone, Copy)]
1108pub enum ParamValueType {
1109 PARAM_UNKNOWN = 0,
1110 PARAM_BASE_64 = 1,
1111 PARAM_BOOLEAN = 2,
1112 PARAM_DATE_TIME = 3,
1113 PARAM_DECIMAL = 4,
1114 PARAM_HEX_BINARY = 5,
1115 PARAM_INT = 6,
1116 PARAM_LONG = 7,
1117 PARAM_STRING = 8,
1118 PARAM_UNSIGNED_INT = 9,
1119 PARAM_UNSIGNED_LONG = 10,
1120}
1121
1122impl Default for ParamValueType {
1123 fn default() -> Self {
1124 ParamValueType::PARAM_UNKNOWN
1125 }
1126}
1127
1128impl From<i32> for ParamValueType {
1129 fn from(i: i32) -> Self {
1130 match i {
1131 0 => ParamValueType::PARAM_UNKNOWN,
1132 1 => ParamValueType::PARAM_BASE_64,
1133 2 => ParamValueType::PARAM_BOOLEAN,
1134 3 => ParamValueType::PARAM_DATE_TIME,
1135 4 => ParamValueType::PARAM_DECIMAL,
1136 5 => ParamValueType::PARAM_HEX_BINARY,
1137 6 => ParamValueType::PARAM_INT,
1138 7 => ParamValueType::PARAM_LONG,
1139 8 => ParamValueType::PARAM_STRING,
1140 9 => ParamValueType::PARAM_UNSIGNED_INT,
1141 10 => ParamValueType::PARAM_UNSIGNED_LONG,
1142 _ => Self::default(),
1143 }
1144 }
1145}
1146
1147impl<'a> From<&'a str> for ParamValueType {
1148 fn from(s: &'a str) -> Self {
1149 match s {
1150 "PARAM_UNKNOWN" => ParamValueType::PARAM_UNKNOWN,
1151 "PARAM_BASE_64" => ParamValueType::PARAM_BASE_64,
1152 "PARAM_BOOLEAN" => ParamValueType::PARAM_BOOLEAN,
1153 "PARAM_DATE_TIME" => ParamValueType::PARAM_DATE_TIME,
1154 "PARAM_DECIMAL" => ParamValueType::PARAM_DECIMAL,
1155 "PARAM_HEX_BINARY" => ParamValueType::PARAM_HEX_BINARY,
1156 "PARAM_INT" => ParamValueType::PARAM_INT,
1157 "PARAM_LONG" => ParamValueType::PARAM_LONG,
1158 "PARAM_STRING" => ParamValueType::PARAM_STRING,
1159 "PARAM_UNSIGNED_INT" => ParamValueType::PARAM_UNSIGNED_INT,
1160 "PARAM_UNSIGNED_LONG" => ParamValueType::PARAM_UNSIGNED_LONG,
1161 _ => Self::default(),
1162 }
1163 }
1164}
1165
1166#[derive(Debug, PartialEq, Eq, Clone, Copy)]
1167pub enum ValueChangeType {
1168 VALUE_CHANGE_UNKNOWN = 0,
1169 VALUE_CHANGE_ALLOWED = 1,
1170 VALUE_CHANGE_WILL_IGNORE = 2,
1171}
1172
1173impl Default for ValueChangeType {
1174 fn default() -> Self {
1175 ValueChangeType::VALUE_CHANGE_UNKNOWN
1176 }
1177}
1178
1179impl From<i32> for ValueChangeType {
1180 fn from(i: i32) -> Self {
1181 match i {
1182 0 => ValueChangeType::VALUE_CHANGE_UNKNOWN,
1183 1 => ValueChangeType::VALUE_CHANGE_ALLOWED,
1184 2 => ValueChangeType::VALUE_CHANGE_WILL_IGNORE,
1185 _ => Self::default(),
1186 }
1187 }
1188}
1189
1190impl<'a> From<&'a str> for ValueChangeType {
1191 fn from(s: &'a str) -> Self {
1192 match s {
1193 "VALUE_CHANGE_UNKNOWN" => ValueChangeType::VALUE_CHANGE_UNKNOWN,
1194 "VALUE_CHANGE_ALLOWED" => ValueChangeType::VALUE_CHANGE_ALLOWED,
1195 "VALUE_CHANGE_WILL_IGNORE" => ValueChangeType::VALUE_CHANGE_WILL_IGNORE,
1196 _ => Self::default(),
1197 }
1198 }
1199}
1200
1201#[derive(Debug, PartialEq, Eq, Clone, Copy)]
1202pub enum CmdType {
1203 CMD_UNKNOWN = 0,
1204 CMD_SYNC = 1,
1205 CMD_ASYNC = 2,
1206}
1207
1208impl Default for CmdType {
1209 fn default() -> Self {
1210 CmdType::CMD_UNKNOWN
1211 }
1212}
1213
1214impl From<i32> for CmdType {
1215 fn from(i: i32) -> Self {
1216 match i {
1217 0 => CmdType::CMD_UNKNOWN,
1218 1 => CmdType::CMD_SYNC,
1219 2 => CmdType::CMD_ASYNC,
1220 _ => Self::default(),
1221 }
1222 }
1223}
1224
1225impl<'a> From<&'a str> for CmdType {
1226 fn from(s: &'a str) -> Self {
1227 match s {
1228 "CMD_UNKNOWN" => CmdType::CMD_UNKNOWN,
1229 "CMD_SYNC" => CmdType::CMD_SYNC,
1230 "CMD_ASYNC" => CmdType::CMD_ASYNC,
1231 _ => Self::default(),
1232 }
1233 }
1234}
1235
1236}
1237
1238#[allow(clippy::derive_partial_eq_without_eq)]
1239#[derive(Debug, Default, PartialEq, Clone)]
1240pub struct GetInstances {
1241 pub obj_paths: Vec<String>,
1242 pub first_level_only: bool,
1243}
1244
1245impl<'a> MessageRead<'a> for GetInstances {
1246 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1247 let mut msg = Self::default();
1248 while !r.is_eof() {
1249 match r.next_tag(bytes) {
1250 Ok(10) => msg.obj_paths.push(r.read_string(bytes)?.to_owned()),
1251 Ok(16) => msg.first_level_only = r.read_bool(bytes)?,
1252 Ok(t) => { r.read_unknown(bytes, t)?; }
1253 Err(e) => return Err(e),
1254 }
1255 }
1256 Ok(msg)
1257 }
1258}
1259
1260impl MessageWrite for GetInstances {
1261 fn get_size(&self) -> usize {
1262 0
1263 + self.obj_paths.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
1264 + if self.first_level_only == false { 0 } else { 1 + sizeof_varint(*(&self.first_level_only) as u64) }
1265 }
1266
1267 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1268 for s in &self.obj_paths { w.write_with_tag(10, |w| w.write_string(&**s))?; }
1269 if self.first_level_only != false { w.write_with_tag(16, |w| w.write_bool(*&self.first_level_only))?; }
1270 Ok(())
1271 }
1272}
1273
1274#[allow(clippy::derive_partial_eq_without_eq)]
1275#[derive(Debug, Default, PartialEq, Clone)]
1276pub struct GetInstancesResp {
1277 pub req_path_results: Vec<usp::mod_GetInstancesResp::RequestedPathResult>,
1278}
1279
1280impl<'a> MessageRead<'a> for GetInstancesResp {
1281 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1282 let mut msg = Self::default();
1283 while !r.is_eof() {
1284 match r.next_tag(bytes) {
1285 Ok(10) => msg.req_path_results.push(r.read_message::<usp::mod_GetInstancesResp::RequestedPathResult>(bytes)?),
1286 Ok(t) => { r.read_unknown(bytes, t)?; }
1287 Err(e) => return Err(e),
1288 }
1289 }
1290 Ok(msg)
1291 }
1292}
1293
1294impl MessageWrite for GetInstancesResp {
1295 fn get_size(&self) -> usize {
1296 0
1297 + self.req_path_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
1298 }
1299
1300 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1301 for s in &self.req_path_results { w.write_with_tag(10, |w| w.write_message(s))?; }
1302 Ok(())
1303 }
1304}
1305
1306pub mod mod_GetInstancesResp {
1307
1308use std::collections::HashMap;
1309type KVMap<K, V> = HashMap<K, V>;
1310use super::*;
1311
1312#[allow(clippy::derive_partial_eq_without_eq)]
1313#[derive(Debug, Default, PartialEq, Clone)]
1314pub struct RequestedPathResult {
1315 pub requested_path: String,
1316 pub err_code: u32,
1317 pub err_msg: String,
1318 pub curr_insts: Vec<usp::mod_GetInstancesResp::CurrInstance>,
1319}
1320
1321impl<'a> MessageRead<'a> for RequestedPathResult {
1322 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1323 let mut msg = Self::default();
1324 while !r.is_eof() {
1325 match r.next_tag(bytes) {
1326 Ok(10) => msg.requested_path = r.read_string(bytes)?.to_owned(),
1327 Ok(21) => msg.err_code = r.read_fixed32(bytes)?,
1328 Ok(26) => msg.err_msg = r.read_string(bytes)?.to_owned(),
1329 Ok(34) => msg.curr_insts.push(r.read_message::<usp::mod_GetInstancesResp::CurrInstance>(bytes)?),
1330 Ok(t) => { r.read_unknown(bytes, t)?; }
1331 Err(e) => return Err(e),
1332 }
1333 }
1334 Ok(msg)
1335 }
1336}
1337
1338impl MessageWrite for RequestedPathResult {
1339 fn get_size(&self) -> usize {
1340 0
1341 + if self.requested_path == String::default() { 0 } else { 1 + sizeof_len((&self.requested_path).len()) }
1342 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
1343 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
1344 + self.curr_insts.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
1345 }
1346
1347 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1348 if self.requested_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.requested_path))?; }
1349 if self.err_code != 0u32 { w.write_with_tag(21, |w| w.write_fixed32(*&self.err_code))?; }
1350 if self.err_msg != String::default() { w.write_with_tag(26, |w| w.write_string(&**&self.err_msg))?; }
1351 for s in &self.curr_insts { w.write_with_tag(34, |w| w.write_message(s))?; }
1352 Ok(())
1353 }
1354}
1355
1356#[allow(clippy::derive_partial_eq_without_eq)]
1357#[derive(Debug, Default, PartialEq, Clone)]
1358pub struct CurrInstance {
1359 pub instantiated_obj_path: String,
1360 pub unique_keys: KVMap<String, String>,
1361}
1362
1363impl<'a> MessageRead<'a> for CurrInstance {
1364 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1365 let mut msg = Self::default();
1366 while !r.is_eof() {
1367 match r.next_tag(bytes) {
1368 Ok(10) => msg.instantiated_obj_path = r.read_string(bytes)?.to_owned(),
1369 Ok(18) => {
1370 let (key, value) = r.read_map(bytes, |r, bytes| Ok(r.read_string(bytes)?.to_owned()), |r, bytes| Ok(r.read_string(bytes)?.to_owned()))?;
1371 msg.unique_keys.insert(key, value);
1372 }
1373 Ok(t) => { r.read_unknown(bytes, t)?; }
1374 Err(e) => return Err(e),
1375 }
1376 }
1377 Ok(msg)
1378 }
1379}
1380
1381impl MessageWrite for CurrInstance {
1382 fn get_size(&self) -> usize {
1383 0
1384 + if self.instantiated_obj_path == String::default() { 0 } else { 1 + sizeof_len((&self.instantiated_obj_path).len()) }
1385 + self.unique_keys.iter().map(|(k, v)| 1 + sizeof_len(2 + sizeof_len((k).len()) + sizeof_len((v).len()))).sum::<usize>()
1386 }
1387
1388 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1389 if self.instantiated_obj_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.instantiated_obj_path))?; }
1390 for (k, v) in self.unique_keys.iter() { w.write_with_tag(18, |w| w.write_map(2 + sizeof_len((k).len()) + sizeof_len((v).len()), 10, |w| w.write_string(&**k), 18, |w| w.write_string(&**v)))?; }
1391 Ok(())
1392 }
1393}
1394
1395}
1396
1397#[allow(clippy::derive_partial_eq_without_eq)]
1398#[derive(Debug, Default, PartialEq, Clone)]
1399pub struct GetSupportedProtocol {
1400 pub controller_supported_protocol_versions: String,
1401}
1402
1403impl<'a> MessageRead<'a> for GetSupportedProtocol {
1404 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1405 let mut msg = Self::default();
1406 while !r.is_eof() {
1407 match r.next_tag(bytes) {
1408 Ok(10) => msg.controller_supported_protocol_versions = r.read_string(bytes)?.to_owned(),
1409 Ok(t) => { r.read_unknown(bytes, t)?; }
1410 Err(e) => return Err(e),
1411 }
1412 }
1413 Ok(msg)
1414 }
1415}
1416
1417impl MessageWrite for GetSupportedProtocol {
1418 fn get_size(&self) -> usize {
1419 0
1420 + if self.controller_supported_protocol_versions == String::default() { 0 } else { 1 + sizeof_len((&self.controller_supported_protocol_versions).len()) }
1421 }
1422
1423 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1424 if self.controller_supported_protocol_versions != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.controller_supported_protocol_versions))?; }
1425 Ok(())
1426 }
1427}
1428
1429#[allow(clippy::derive_partial_eq_without_eq)]
1430#[derive(Debug, Default, PartialEq, Clone)]
1431pub struct GetSupportedProtocolResp {
1432 pub agent_supported_protocol_versions: String,
1433}
1434
1435impl<'a> MessageRead<'a> for GetSupportedProtocolResp {
1436 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1437 let mut msg = Self::default();
1438 while !r.is_eof() {
1439 match r.next_tag(bytes) {
1440 Ok(10) => msg.agent_supported_protocol_versions = r.read_string(bytes)?.to_owned(),
1441 Ok(t) => { r.read_unknown(bytes, t)?; }
1442 Err(e) => return Err(e),
1443 }
1444 }
1445 Ok(msg)
1446 }
1447}
1448
1449impl MessageWrite for GetSupportedProtocolResp {
1450 fn get_size(&self) -> usize {
1451 0
1452 + if self.agent_supported_protocol_versions == String::default() { 0 } else { 1 + sizeof_len((&self.agent_supported_protocol_versions).len()) }
1453 }
1454
1455 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1456 if self.agent_supported_protocol_versions != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.agent_supported_protocol_versions))?; }
1457 Ok(())
1458 }
1459}
1460
1461#[allow(clippy::derive_partial_eq_without_eq)]
1462#[derive(Debug, Default, PartialEq, Clone)]
1463pub struct Add {
1464 pub allow_partial: bool,
1465 pub create_objs: Vec<usp::mod_Add::CreateObject>,
1466}
1467
1468impl<'a> MessageRead<'a> for Add {
1469 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1470 let mut msg = Self::default();
1471 while !r.is_eof() {
1472 match r.next_tag(bytes) {
1473 Ok(8) => msg.allow_partial = r.read_bool(bytes)?,
1474 Ok(18) => msg.create_objs.push(r.read_message::<usp::mod_Add::CreateObject>(bytes)?),
1475 Ok(t) => { r.read_unknown(bytes, t)?; }
1476 Err(e) => return Err(e),
1477 }
1478 }
1479 Ok(msg)
1480 }
1481}
1482
1483impl MessageWrite for Add {
1484 fn get_size(&self) -> usize {
1485 0
1486 + if self.allow_partial == false { 0 } else { 1 + sizeof_varint(*(&self.allow_partial) as u64) }
1487 + self.create_objs.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
1488 }
1489
1490 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1491 if self.allow_partial != false { w.write_with_tag(8, |w| w.write_bool(*&self.allow_partial))?; }
1492 for s in &self.create_objs { w.write_with_tag(18, |w| w.write_message(s))?; }
1493 Ok(())
1494 }
1495}
1496
1497pub mod mod_Add {
1498
1499use super::*;
1500
1501#[allow(clippy::derive_partial_eq_without_eq)]
1502#[derive(Debug, Default, PartialEq, Clone)]
1503pub struct CreateObject {
1504 pub obj_path: String,
1505 pub param_settings: Vec<usp::mod_Add::CreateParamSetting>,
1506}
1507
1508impl<'a> MessageRead<'a> for CreateObject {
1509 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1510 let mut msg = Self::default();
1511 while !r.is_eof() {
1512 match r.next_tag(bytes) {
1513 Ok(10) => msg.obj_path = r.read_string(bytes)?.to_owned(),
1514 Ok(18) => msg.param_settings.push(r.read_message::<usp::mod_Add::CreateParamSetting>(bytes)?),
1515 Ok(t) => { r.read_unknown(bytes, t)?; }
1516 Err(e) => return Err(e),
1517 }
1518 }
1519 Ok(msg)
1520 }
1521}
1522
1523impl MessageWrite for CreateObject {
1524 fn get_size(&self) -> usize {
1525 0
1526 + if self.obj_path == String::default() { 0 } else { 1 + sizeof_len((&self.obj_path).len()) }
1527 + self.param_settings.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
1528 }
1529
1530 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1531 if self.obj_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.obj_path))?; }
1532 for s in &self.param_settings { w.write_with_tag(18, |w| w.write_message(s))?; }
1533 Ok(())
1534 }
1535}
1536
1537#[allow(clippy::derive_partial_eq_without_eq)]
1538#[derive(Debug, Default, PartialEq, Clone)]
1539pub struct CreateParamSetting {
1540 pub param: String,
1541 pub value: String,
1542 pub required: bool,
1543}
1544
1545impl<'a> MessageRead<'a> for CreateParamSetting {
1546 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1547 let mut msg = Self::default();
1548 while !r.is_eof() {
1549 match r.next_tag(bytes) {
1550 Ok(10) => msg.param = r.read_string(bytes)?.to_owned(),
1551 Ok(18) => msg.value = r.read_string(bytes)?.to_owned(),
1552 Ok(24) => msg.required = r.read_bool(bytes)?,
1553 Ok(t) => { r.read_unknown(bytes, t)?; }
1554 Err(e) => return Err(e),
1555 }
1556 }
1557 Ok(msg)
1558 }
1559}
1560
1561impl MessageWrite for CreateParamSetting {
1562 fn get_size(&self) -> usize {
1563 0
1564 + if self.param == String::default() { 0 } else { 1 + sizeof_len((&self.param).len()) }
1565 + if self.value == String::default() { 0 } else { 1 + sizeof_len((&self.value).len()) }
1566 + if self.required == false { 0 } else { 1 + sizeof_varint(*(&self.required) as u64) }
1567 }
1568
1569 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1570 if self.param != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.param))?; }
1571 if self.value != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.value))?; }
1572 if self.required != false { w.write_with_tag(24, |w| w.write_bool(*&self.required))?; }
1573 Ok(())
1574 }
1575}
1576
1577}
1578
1579#[allow(clippy::derive_partial_eq_without_eq)]
1580#[derive(Debug, Default, PartialEq, Clone)]
1581pub struct AddResp {
1582 pub created_obj_results: Vec<usp::mod_AddResp::CreatedObjectResult>,
1583}
1584
1585impl<'a> MessageRead<'a> for AddResp {
1586 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1587 let mut msg = Self::default();
1588 while !r.is_eof() {
1589 match r.next_tag(bytes) {
1590 Ok(10) => msg.created_obj_results.push(r.read_message::<usp::mod_AddResp::CreatedObjectResult>(bytes)?),
1591 Ok(t) => { r.read_unknown(bytes, t)?; }
1592 Err(e) => return Err(e),
1593 }
1594 }
1595 Ok(msg)
1596 }
1597}
1598
1599impl MessageWrite for AddResp {
1600 fn get_size(&self) -> usize {
1601 0
1602 + self.created_obj_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
1603 }
1604
1605 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1606 for s in &self.created_obj_results { w.write_with_tag(10, |w| w.write_message(s))?; }
1607 Ok(())
1608 }
1609}
1610
1611pub mod mod_AddResp {
1612
1613use super::*;
1614
1615#[allow(clippy::derive_partial_eq_without_eq)]
1616#[derive(Debug, Default, PartialEq, Clone)]
1617pub struct CreatedObjectResult {
1618 pub requested_path: String,
1619 pub oper_status: Option<usp::mod_AddResp::mod_CreatedObjectResult::OperationStatus>,
1620}
1621
1622impl<'a> MessageRead<'a> for CreatedObjectResult {
1623 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1624 let mut msg = Self::default();
1625 while !r.is_eof() {
1626 match r.next_tag(bytes) {
1627 Ok(10) => msg.requested_path = r.read_string(bytes)?.to_owned(),
1628 Ok(18) => msg.oper_status = Some(r.read_message::<usp::mod_AddResp::mod_CreatedObjectResult::OperationStatus>(bytes)?),
1629 Ok(t) => { r.read_unknown(bytes, t)?; }
1630 Err(e) => return Err(e),
1631 }
1632 }
1633 Ok(msg)
1634 }
1635}
1636
1637impl MessageWrite for CreatedObjectResult {
1638 fn get_size(&self) -> usize {
1639 0
1640 + if self.requested_path == String::default() { 0 } else { 1 + sizeof_len((&self.requested_path).len()) }
1641 + self.oper_status.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
1642 }
1643
1644 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1645 if self.requested_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.requested_path))?; }
1646 if let Some(ref s) = self.oper_status { w.write_with_tag(18, |w| w.write_message(s))?; }
1647 Ok(())
1648 }
1649}
1650
1651pub mod mod_CreatedObjectResult {
1652
1653use super::*;
1654
1655#[allow(clippy::derive_partial_eq_without_eq)]
1656#[derive(Debug, Default, PartialEq, Clone)]
1657pub struct OperationStatus {
1658 pub oper_status: usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OneOfoper_status,
1659}
1660
1661impl<'a> MessageRead<'a> for OperationStatus {
1662 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1663 let mut msg = Self::default();
1664 while !r.is_eof() {
1665 match r.next_tag(bytes) {
1666 Ok(10) => msg.oper_status = usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_failure(r.read_message::<usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OperationFailure>(bytes)?),
1667 Ok(18) => msg.oper_status = usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_success(r.read_message::<usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OperationSuccess>(bytes)?),
1668 Ok(t) => { r.read_unknown(bytes, t)?; }
1669 Err(e) => return Err(e),
1670 }
1671 }
1672 Ok(msg)
1673 }
1674}
1675
1676impl MessageWrite for OperationStatus {
1677 fn get_size(&self) -> usize {
1678 0
1679 + match self.oper_status {
1680 usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => 1 + sizeof_len((m).get_size()),
1681 usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => 1 + sizeof_len((m).get_size()),
1682 usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OneOfoper_status::None => 0,
1683 } }
1684
1685 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1686 match self.oper_status { usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => { w.write_with_tag(10, |w| w.write_message(m))? },
1687 usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => { w.write_with_tag(18, |w| w.write_message(m))? },
1688 usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OneOfoper_status::None => {},
1689 } Ok(())
1690 }
1691}
1692
1693pub mod mod_OperationStatus {
1694
1695use std::collections::HashMap;
1696type KVMap<K, V> = HashMap<K, V>;
1697use super::*;
1698
1699#[allow(clippy::derive_partial_eq_without_eq)]
1700#[derive(Debug, Default, PartialEq, Clone)]
1701pub struct OperationFailure {
1702 pub err_code: u32,
1703 pub err_msg: String,
1704}
1705
1706impl<'a> MessageRead<'a> for OperationFailure {
1707 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1708 let mut msg = Self::default();
1709 while !r.is_eof() {
1710 match r.next_tag(bytes) {
1711 Ok(13) => msg.err_code = r.read_fixed32(bytes)?,
1712 Ok(18) => msg.err_msg = r.read_string(bytes)?.to_owned(),
1713 Ok(t) => { r.read_unknown(bytes, t)?; }
1714 Err(e) => return Err(e),
1715 }
1716 }
1717 Ok(msg)
1718 }
1719}
1720
1721impl MessageWrite for OperationFailure {
1722 fn get_size(&self) -> usize {
1723 0
1724 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
1725 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
1726 }
1727
1728 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1729 if self.err_code != 0u32 { w.write_with_tag(13, |w| w.write_fixed32(*&self.err_code))?; }
1730 if self.err_msg != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.err_msg))?; }
1731 Ok(())
1732 }
1733}
1734
1735#[allow(clippy::derive_partial_eq_without_eq)]
1736#[derive(Debug, Default, PartialEq, Clone)]
1737pub struct OperationSuccess {
1738 pub instantiated_path: String,
1739 pub param_errs: Vec<usp::mod_AddResp::ParameterError>,
1740 pub unique_keys: KVMap<String, String>,
1741}
1742
1743impl<'a> MessageRead<'a> for OperationSuccess {
1744 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1745 let mut msg = Self::default();
1746 while !r.is_eof() {
1747 match r.next_tag(bytes) {
1748 Ok(10) => msg.instantiated_path = r.read_string(bytes)?.to_owned(),
1749 Ok(18) => msg.param_errs.push(r.read_message::<usp::mod_AddResp::ParameterError>(bytes)?),
1750 Ok(26) => {
1751 let (key, value) = r.read_map(bytes, |r, bytes| Ok(r.read_string(bytes)?.to_owned()), |r, bytes| Ok(r.read_string(bytes)?.to_owned()))?;
1752 msg.unique_keys.insert(key, value);
1753 }
1754 Ok(t) => { r.read_unknown(bytes, t)?; }
1755 Err(e) => return Err(e),
1756 }
1757 }
1758 Ok(msg)
1759 }
1760}
1761
1762impl MessageWrite for OperationSuccess {
1763 fn get_size(&self) -> usize {
1764 0
1765 + if self.instantiated_path == String::default() { 0 } else { 1 + sizeof_len((&self.instantiated_path).len()) }
1766 + self.param_errs.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
1767 + self.unique_keys.iter().map(|(k, v)| 1 + sizeof_len(2 + sizeof_len((k).len()) + sizeof_len((v).len()))).sum::<usize>()
1768 }
1769
1770 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1771 if self.instantiated_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.instantiated_path))?; }
1772 for s in &self.param_errs { w.write_with_tag(18, |w| w.write_message(s))?; }
1773 for (k, v) in self.unique_keys.iter() { w.write_with_tag(26, |w| w.write_map(2 + sizeof_len((k).len()) + sizeof_len((v).len()), 10, |w| w.write_string(&**k), 18, |w| w.write_string(&**v)))?; }
1774 Ok(())
1775 }
1776}
1777
1778#[derive(Debug, PartialEq, Clone)]
1779pub enum OneOfoper_status {
1780 oper_failure(usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OperationFailure),
1781 oper_success(usp::mod_AddResp::mod_CreatedObjectResult::mod_OperationStatus::OperationSuccess),
1782 None,
1783}
1784
1785impl Default for OneOfoper_status {
1786 fn default() -> Self {
1787 OneOfoper_status::None
1788 }
1789}
1790
1791}
1792
1793}
1794
1795#[allow(clippy::derive_partial_eq_without_eq)]
1796#[derive(Debug, Default, PartialEq, Clone)]
1797pub struct ParameterError {
1798 pub param: String,
1799 pub err_code: u32,
1800 pub err_msg: String,
1801}
1802
1803impl<'a> MessageRead<'a> for ParameterError {
1804 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1805 let mut msg = Self::default();
1806 while !r.is_eof() {
1807 match r.next_tag(bytes) {
1808 Ok(10) => msg.param = r.read_string(bytes)?.to_owned(),
1809 Ok(21) => msg.err_code = r.read_fixed32(bytes)?,
1810 Ok(26) => msg.err_msg = r.read_string(bytes)?.to_owned(),
1811 Ok(t) => { r.read_unknown(bytes, t)?; }
1812 Err(e) => return Err(e),
1813 }
1814 }
1815 Ok(msg)
1816 }
1817}
1818
1819impl MessageWrite for ParameterError {
1820 fn get_size(&self) -> usize {
1821 0
1822 + if self.param == String::default() { 0 } else { 1 + sizeof_len((&self.param).len()) }
1823 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
1824 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
1825 }
1826
1827 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1828 if self.param != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.param))?; }
1829 if self.err_code != 0u32 { w.write_with_tag(21, |w| w.write_fixed32(*&self.err_code))?; }
1830 if self.err_msg != String::default() { w.write_with_tag(26, |w| w.write_string(&**&self.err_msg))?; }
1831 Ok(())
1832 }
1833}
1834
1835}
1836
1837#[allow(clippy::derive_partial_eq_without_eq)]
1838#[derive(Debug, Default, PartialEq, Clone)]
1839pub struct Delete {
1840 pub allow_partial: bool,
1841 pub obj_paths: Vec<String>,
1842}
1843
1844impl<'a> MessageRead<'a> for Delete {
1845 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1846 let mut msg = Self::default();
1847 while !r.is_eof() {
1848 match r.next_tag(bytes) {
1849 Ok(8) => msg.allow_partial = r.read_bool(bytes)?,
1850 Ok(18) => msg.obj_paths.push(r.read_string(bytes)?.to_owned()),
1851 Ok(t) => { r.read_unknown(bytes, t)?; }
1852 Err(e) => return Err(e),
1853 }
1854 }
1855 Ok(msg)
1856 }
1857}
1858
1859impl MessageWrite for Delete {
1860 fn get_size(&self) -> usize {
1861 0
1862 + if self.allow_partial == false { 0 } else { 1 + sizeof_varint(*(&self.allow_partial) as u64) }
1863 + self.obj_paths.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
1864 }
1865
1866 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1867 if self.allow_partial != false { w.write_with_tag(8, |w| w.write_bool(*&self.allow_partial))?; }
1868 for s in &self.obj_paths { w.write_with_tag(18, |w| w.write_string(&**s))?; }
1869 Ok(())
1870 }
1871}
1872
1873#[allow(clippy::derive_partial_eq_without_eq)]
1874#[derive(Debug, Default, PartialEq, Clone)]
1875pub struct DeleteResp {
1876 pub deleted_obj_results: Vec<usp::mod_DeleteResp::DeletedObjectResult>,
1877}
1878
1879impl<'a> MessageRead<'a> for DeleteResp {
1880 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1881 let mut msg = Self::default();
1882 while !r.is_eof() {
1883 match r.next_tag(bytes) {
1884 Ok(10) => msg.deleted_obj_results.push(r.read_message::<usp::mod_DeleteResp::DeletedObjectResult>(bytes)?),
1885 Ok(t) => { r.read_unknown(bytes, t)?; }
1886 Err(e) => return Err(e),
1887 }
1888 }
1889 Ok(msg)
1890 }
1891}
1892
1893impl MessageWrite for DeleteResp {
1894 fn get_size(&self) -> usize {
1895 0
1896 + self.deleted_obj_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
1897 }
1898
1899 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1900 for s in &self.deleted_obj_results { w.write_with_tag(10, |w| w.write_message(s))?; }
1901 Ok(())
1902 }
1903}
1904
1905pub mod mod_DeleteResp {
1906
1907use super::*;
1908
1909#[allow(clippy::derive_partial_eq_without_eq)]
1910#[derive(Debug, Default, PartialEq, Clone)]
1911pub struct DeletedObjectResult {
1912 pub requested_path: String,
1913 pub oper_status: Option<usp::mod_DeleteResp::mod_DeletedObjectResult::OperationStatus>,
1914}
1915
1916impl<'a> MessageRead<'a> for DeletedObjectResult {
1917 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1918 let mut msg = Self::default();
1919 while !r.is_eof() {
1920 match r.next_tag(bytes) {
1921 Ok(10) => msg.requested_path = r.read_string(bytes)?.to_owned(),
1922 Ok(18) => msg.oper_status = Some(r.read_message::<usp::mod_DeleteResp::mod_DeletedObjectResult::OperationStatus>(bytes)?),
1923 Ok(t) => { r.read_unknown(bytes, t)?; }
1924 Err(e) => return Err(e),
1925 }
1926 }
1927 Ok(msg)
1928 }
1929}
1930
1931impl MessageWrite for DeletedObjectResult {
1932 fn get_size(&self) -> usize {
1933 0
1934 + if self.requested_path == String::default() { 0 } else { 1 + sizeof_len((&self.requested_path).len()) }
1935 + self.oper_status.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
1936 }
1937
1938 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1939 if self.requested_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.requested_path))?; }
1940 if let Some(ref s) = self.oper_status { w.write_with_tag(18, |w| w.write_message(s))?; }
1941 Ok(())
1942 }
1943}
1944
1945pub mod mod_DeletedObjectResult {
1946
1947use super::*;
1948
1949#[allow(clippy::derive_partial_eq_without_eq)]
1950#[derive(Debug, Default, PartialEq, Clone)]
1951pub struct OperationStatus {
1952 pub oper_status: usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OneOfoper_status,
1953}
1954
1955impl<'a> MessageRead<'a> for OperationStatus {
1956 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
1957 let mut msg = Self::default();
1958 while !r.is_eof() {
1959 match r.next_tag(bytes) {
1960 Ok(10) => msg.oper_status = usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OneOfoper_status::oper_failure(r.read_message::<usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OperationFailure>(bytes)?),
1961 Ok(18) => msg.oper_status = usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OneOfoper_status::oper_success(r.read_message::<usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OperationSuccess>(bytes)?),
1962 Ok(t) => { r.read_unknown(bytes, t)?; }
1963 Err(e) => return Err(e),
1964 }
1965 }
1966 Ok(msg)
1967 }
1968}
1969
1970impl MessageWrite for OperationStatus {
1971 fn get_size(&self) -> usize {
1972 0
1973 + match self.oper_status {
1974 usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => 1 + sizeof_len((m).get_size()),
1975 usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => 1 + sizeof_len((m).get_size()),
1976 usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OneOfoper_status::None => 0,
1977 } }
1978
1979 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
1980 match self.oper_status { usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => { w.write_with_tag(10, |w| w.write_message(m))? },
1981 usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => { w.write_with_tag(18, |w| w.write_message(m))? },
1982 usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OneOfoper_status::None => {},
1983 } Ok(())
1984 }
1985}
1986
1987pub mod mod_OperationStatus {
1988
1989use super::*;
1990
1991#[allow(clippy::derive_partial_eq_without_eq)]
1992#[derive(Debug, Default, PartialEq, Clone)]
1993pub struct OperationFailure {
1994 pub err_code: u32,
1995 pub err_msg: String,
1996}
1997
1998impl<'a> MessageRead<'a> for OperationFailure {
1999 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2000 let mut msg = Self::default();
2001 while !r.is_eof() {
2002 match r.next_tag(bytes) {
2003 Ok(13) => msg.err_code = r.read_fixed32(bytes)?,
2004 Ok(18) => msg.err_msg = r.read_string(bytes)?.to_owned(),
2005 Ok(t) => { r.read_unknown(bytes, t)?; }
2006 Err(e) => return Err(e),
2007 }
2008 }
2009 Ok(msg)
2010 }
2011}
2012
2013impl MessageWrite for OperationFailure {
2014 fn get_size(&self) -> usize {
2015 0
2016 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
2017 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
2018 }
2019
2020 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2021 if self.err_code != 0u32 { w.write_with_tag(13, |w| w.write_fixed32(*&self.err_code))?; }
2022 if self.err_msg != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.err_msg))?; }
2023 Ok(())
2024 }
2025}
2026
2027#[allow(clippy::derive_partial_eq_without_eq)]
2028#[derive(Debug, Default, PartialEq, Clone)]
2029pub struct OperationSuccess {
2030 pub affected_paths: Vec<String>,
2031 pub unaffected_path_errs: Vec<usp::mod_DeleteResp::UnaffectedPathError>,
2032}
2033
2034impl<'a> MessageRead<'a> for OperationSuccess {
2035 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2036 let mut msg = Self::default();
2037 while !r.is_eof() {
2038 match r.next_tag(bytes) {
2039 Ok(10) => msg.affected_paths.push(r.read_string(bytes)?.to_owned()),
2040 Ok(18) => msg.unaffected_path_errs.push(r.read_message::<usp::mod_DeleteResp::UnaffectedPathError>(bytes)?),
2041 Ok(t) => { r.read_unknown(bytes, t)?; }
2042 Err(e) => return Err(e),
2043 }
2044 }
2045 Ok(msg)
2046 }
2047}
2048
2049impl MessageWrite for OperationSuccess {
2050 fn get_size(&self) -> usize {
2051 0
2052 + self.affected_paths.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
2053 + self.unaffected_path_errs.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
2054 }
2055
2056 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2057 for s in &self.affected_paths { w.write_with_tag(10, |w| w.write_string(&**s))?; }
2058 for s in &self.unaffected_path_errs { w.write_with_tag(18, |w| w.write_message(s))?; }
2059 Ok(())
2060 }
2061}
2062
2063#[derive(Debug, PartialEq, Clone)]
2064pub enum OneOfoper_status {
2065 oper_failure(usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OperationFailure),
2066 oper_success(usp::mod_DeleteResp::mod_DeletedObjectResult::mod_OperationStatus::OperationSuccess),
2067 None,
2068}
2069
2070impl Default for OneOfoper_status {
2071 fn default() -> Self {
2072 OneOfoper_status::None
2073 }
2074}
2075
2076}
2077
2078}
2079
2080#[allow(clippy::derive_partial_eq_without_eq)]
2081#[derive(Debug, Default, PartialEq, Clone)]
2082pub struct UnaffectedPathError {
2083 pub unaffected_path: String,
2084 pub err_code: u32,
2085 pub err_msg: String,
2086}
2087
2088impl<'a> MessageRead<'a> for UnaffectedPathError {
2089 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2090 let mut msg = Self::default();
2091 while !r.is_eof() {
2092 match r.next_tag(bytes) {
2093 Ok(10) => msg.unaffected_path = r.read_string(bytes)?.to_owned(),
2094 Ok(21) => msg.err_code = r.read_fixed32(bytes)?,
2095 Ok(26) => msg.err_msg = r.read_string(bytes)?.to_owned(),
2096 Ok(t) => { r.read_unknown(bytes, t)?; }
2097 Err(e) => return Err(e),
2098 }
2099 }
2100 Ok(msg)
2101 }
2102}
2103
2104impl MessageWrite for UnaffectedPathError {
2105 fn get_size(&self) -> usize {
2106 0
2107 + if self.unaffected_path == String::default() { 0 } else { 1 + sizeof_len((&self.unaffected_path).len()) }
2108 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
2109 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
2110 }
2111
2112 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2113 if self.unaffected_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.unaffected_path))?; }
2114 if self.err_code != 0u32 { w.write_with_tag(21, |w| w.write_fixed32(*&self.err_code))?; }
2115 if self.err_msg != String::default() { w.write_with_tag(26, |w| w.write_string(&**&self.err_msg))?; }
2116 Ok(())
2117 }
2118}
2119
2120}
2121
2122#[allow(clippy::derive_partial_eq_without_eq)]
2123#[derive(Debug, Default, PartialEq, Clone)]
2124pub struct Set {
2125 pub allow_partial: bool,
2126 pub update_objs: Vec<usp::mod_Set::UpdateObject>,
2127}
2128
2129impl<'a> MessageRead<'a> for Set {
2130 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2131 let mut msg = Self::default();
2132 while !r.is_eof() {
2133 match r.next_tag(bytes) {
2134 Ok(8) => msg.allow_partial = r.read_bool(bytes)?,
2135 Ok(18) => msg.update_objs.push(r.read_message::<usp::mod_Set::UpdateObject>(bytes)?),
2136 Ok(t) => { r.read_unknown(bytes, t)?; }
2137 Err(e) => return Err(e),
2138 }
2139 }
2140 Ok(msg)
2141 }
2142}
2143
2144impl MessageWrite for Set {
2145 fn get_size(&self) -> usize {
2146 0
2147 + if self.allow_partial == false { 0 } else { 1 + sizeof_varint(*(&self.allow_partial) as u64) }
2148 + self.update_objs.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
2149 }
2150
2151 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2152 if self.allow_partial != false { w.write_with_tag(8, |w| w.write_bool(*&self.allow_partial))?; }
2153 for s in &self.update_objs { w.write_with_tag(18, |w| w.write_message(s))?; }
2154 Ok(())
2155 }
2156}
2157
2158pub mod mod_Set {
2159
2160use super::*;
2161
2162#[allow(clippy::derive_partial_eq_without_eq)]
2163#[derive(Debug, Default, PartialEq, Clone)]
2164pub struct UpdateObject {
2165 pub obj_path: String,
2166 pub param_settings: Vec<usp::mod_Set::UpdateParamSetting>,
2167}
2168
2169impl<'a> MessageRead<'a> for UpdateObject {
2170 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2171 let mut msg = Self::default();
2172 while !r.is_eof() {
2173 match r.next_tag(bytes) {
2174 Ok(10) => msg.obj_path = r.read_string(bytes)?.to_owned(),
2175 Ok(18) => msg.param_settings.push(r.read_message::<usp::mod_Set::UpdateParamSetting>(bytes)?),
2176 Ok(t) => { r.read_unknown(bytes, t)?; }
2177 Err(e) => return Err(e),
2178 }
2179 }
2180 Ok(msg)
2181 }
2182}
2183
2184impl MessageWrite for UpdateObject {
2185 fn get_size(&self) -> usize {
2186 0
2187 + if self.obj_path == String::default() { 0 } else { 1 + sizeof_len((&self.obj_path).len()) }
2188 + self.param_settings.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
2189 }
2190
2191 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2192 if self.obj_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.obj_path))?; }
2193 for s in &self.param_settings { w.write_with_tag(18, |w| w.write_message(s))?; }
2194 Ok(())
2195 }
2196}
2197
2198#[allow(clippy::derive_partial_eq_without_eq)]
2199#[derive(Debug, Default, PartialEq, Clone)]
2200pub struct UpdateParamSetting {
2201 pub param: String,
2202 pub value: String,
2203 pub required: bool,
2204}
2205
2206impl<'a> MessageRead<'a> for UpdateParamSetting {
2207 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2208 let mut msg = Self::default();
2209 while !r.is_eof() {
2210 match r.next_tag(bytes) {
2211 Ok(10) => msg.param = r.read_string(bytes)?.to_owned(),
2212 Ok(18) => msg.value = r.read_string(bytes)?.to_owned(),
2213 Ok(24) => msg.required = r.read_bool(bytes)?,
2214 Ok(t) => { r.read_unknown(bytes, t)?; }
2215 Err(e) => return Err(e),
2216 }
2217 }
2218 Ok(msg)
2219 }
2220}
2221
2222impl MessageWrite for UpdateParamSetting {
2223 fn get_size(&self) -> usize {
2224 0
2225 + if self.param == String::default() { 0 } else { 1 + sizeof_len((&self.param).len()) }
2226 + if self.value == String::default() { 0 } else { 1 + sizeof_len((&self.value).len()) }
2227 + if self.required == false { 0 } else { 1 + sizeof_varint(*(&self.required) as u64) }
2228 }
2229
2230 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2231 if self.param != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.param))?; }
2232 if self.value != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.value))?; }
2233 if self.required != false { w.write_with_tag(24, |w| w.write_bool(*&self.required))?; }
2234 Ok(())
2235 }
2236}
2237
2238}
2239
2240#[allow(clippy::derive_partial_eq_without_eq)]
2241#[derive(Debug, Default, PartialEq, Clone)]
2242pub struct SetResp {
2243 pub updated_obj_results: Vec<usp::mod_SetResp::UpdatedObjectResult>,
2244}
2245
2246impl<'a> MessageRead<'a> for SetResp {
2247 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2248 let mut msg = Self::default();
2249 while !r.is_eof() {
2250 match r.next_tag(bytes) {
2251 Ok(10) => msg.updated_obj_results.push(r.read_message::<usp::mod_SetResp::UpdatedObjectResult>(bytes)?),
2252 Ok(t) => { r.read_unknown(bytes, t)?; }
2253 Err(e) => return Err(e),
2254 }
2255 }
2256 Ok(msg)
2257 }
2258}
2259
2260impl MessageWrite for SetResp {
2261 fn get_size(&self) -> usize {
2262 0
2263 + self.updated_obj_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
2264 }
2265
2266 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2267 for s in &self.updated_obj_results { w.write_with_tag(10, |w| w.write_message(s))?; }
2268 Ok(())
2269 }
2270}
2271
2272pub mod mod_SetResp {
2273
2274use std::collections::HashMap;
2275type KVMap<K, V> = HashMap<K, V>;
2276use super::*;
2277
2278#[allow(clippy::derive_partial_eq_without_eq)]
2279#[derive(Debug, Default, PartialEq, Clone)]
2280pub struct UpdatedObjectResult {
2281 pub requested_path: String,
2282 pub oper_status: Option<usp::mod_SetResp::mod_UpdatedObjectResult::OperationStatus>,
2283}
2284
2285impl<'a> MessageRead<'a> for UpdatedObjectResult {
2286 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2287 let mut msg = Self::default();
2288 while !r.is_eof() {
2289 match r.next_tag(bytes) {
2290 Ok(10) => msg.requested_path = r.read_string(bytes)?.to_owned(),
2291 Ok(18) => msg.oper_status = Some(r.read_message::<usp::mod_SetResp::mod_UpdatedObjectResult::OperationStatus>(bytes)?),
2292 Ok(t) => { r.read_unknown(bytes, t)?; }
2293 Err(e) => return Err(e),
2294 }
2295 }
2296 Ok(msg)
2297 }
2298}
2299
2300impl MessageWrite for UpdatedObjectResult {
2301 fn get_size(&self) -> usize {
2302 0
2303 + if self.requested_path == String::default() { 0 } else { 1 + sizeof_len((&self.requested_path).len()) }
2304 + self.oper_status.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
2305 }
2306
2307 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2308 if self.requested_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.requested_path))?; }
2309 if let Some(ref s) = self.oper_status { w.write_with_tag(18, |w| w.write_message(s))?; }
2310 Ok(())
2311 }
2312}
2313
2314pub mod mod_UpdatedObjectResult {
2315
2316use super::*;
2317
2318#[allow(clippy::derive_partial_eq_without_eq)]
2319#[derive(Debug, Default, PartialEq, Clone)]
2320pub struct OperationStatus {
2321 pub oper_status: usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OneOfoper_status,
2322}
2323
2324impl<'a> MessageRead<'a> for OperationStatus {
2325 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2326 let mut msg = Self::default();
2327 while !r.is_eof() {
2328 match r.next_tag(bytes) {
2329 Ok(10) => msg.oper_status = usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_failure(r.read_message::<usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OperationFailure>(bytes)?),
2330 Ok(18) => msg.oper_status = usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_success(r.read_message::<usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OperationSuccess>(bytes)?),
2331 Ok(t) => { r.read_unknown(bytes, t)?; }
2332 Err(e) => return Err(e),
2333 }
2334 }
2335 Ok(msg)
2336 }
2337}
2338
2339impl MessageWrite for OperationStatus {
2340 fn get_size(&self) -> usize {
2341 0
2342 + match self.oper_status {
2343 usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => 1 + sizeof_len((m).get_size()),
2344 usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => 1 + sizeof_len((m).get_size()),
2345 usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OneOfoper_status::None => 0,
2346 } }
2347
2348 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2349 match self.oper_status { usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => { w.write_with_tag(10, |w| w.write_message(m))? },
2350 usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => { w.write_with_tag(18, |w| w.write_message(m))? },
2351 usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OneOfoper_status::None => {},
2352 } Ok(())
2353 }
2354}
2355
2356pub mod mod_OperationStatus {
2357
2358use super::*;
2359
2360#[allow(clippy::derive_partial_eq_without_eq)]
2361#[derive(Debug, Default, PartialEq, Clone)]
2362pub struct OperationFailure {
2363 pub err_code: u32,
2364 pub err_msg: String,
2365 pub updated_inst_failures: Vec<usp::mod_SetResp::UpdatedInstanceFailure>,
2366}
2367
2368impl<'a> MessageRead<'a> for OperationFailure {
2369 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2370 let mut msg = Self::default();
2371 while !r.is_eof() {
2372 match r.next_tag(bytes) {
2373 Ok(13) => msg.err_code = r.read_fixed32(bytes)?,
2374 Ok(18) => msg.err_msg = r.read_string(bytes)?.to_owned(),
2375 Ok(26) => msg.updated_inst_failures.push(r.read_message::<usp::mod_SetResp::UpdatedInstanceFailure>(bytes)?),
2376 Ok(t) => { r.read_unknown(bytes, t)?; }
2377 Err(e) => return Err(e),
2378 }
2379 }
2380 Ok(msg)
2381 }
2382}
2383
2384impl MessageWrite for OperationFailure {
2385 fn get_size(&self) -> usize {
2386 0
2387 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
2388 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
2389 + self.updated_inst_failures.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
2390 }
2391
2392 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2393 if self.err_code != 0u32 { w.write_with_tag(13, |w| w.write_fixed32(*&self.err_code))?; }
2394 if self.err_msg != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.err_msg))?; }
2395 for s in &self.updated_inst_failures { w.write_with_tag(26, |w| w.write_message(s))?; }
2396 Ok(())
2397 }
2398}
2399
2400#[allow(clippy::derive_partial_eq_without_eq)]
2401#[derive(Debug, Default, PartialEq, Clone)]
2402pub struct OperationSuccess {
2403 pub updated_inst_results: Vec<usp::mod_SetResp::UpdatedInstanceResult>,
2404}
2405
2406impl<'a> MessageRead<'a> for OperationSuccess {
2407 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2408 let mut msg = Self::default();
2409 while !r.is_eof() {
2410 match r.next_tag(bytes) {
2411 Ok(10) => msg.updated_inst_results.push(r.read_message::<usp::mod_SetResp::UpdatedInstanceResult>(bytes)?),
2412 Ok(t) => { r.read_unknown(bytes, t)?; }
2413 Err(e) => return Err(e),
2414 }
2415 }
2416 Ok(msg)
2417 }
2418}
2419
2420impl MessageWrite for OperationSuccess {
2421 fn get_size(&self) -> usize {
2422 0
2423 + self.updated_inst_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
2424 }
2425
2426 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2427 for s in &self.updated_inst_results { w.write_with_tag(10, |w| w.write_message(s))?; }
2428 Ok(())
2429 }
2430}
2431
2432#[derive(Debug, PartialEq, Clone)]
2433pub enum OneOfoper_status {
2434 oper_failure(usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OperationFailure),
2435 oper_success(usp::mod_SetResp::mod_UpdatedObjectResult::mod_OperationStatus::OperationSuccess),
2436 None,
2437}
2438
2439impl Default for OneOfoper_status {
2440 fn default() -> Self {
2441 OneOfoper_status::None
2442 }
2443}
2444
2445}
2446
2447}
2448
2449#[allow(clippy::derive_partial_eq_without_eq)]
2450#[derive(Debug, Default, PartialEq, Clone)]
2451pub struct UpdatedInstanceFailure {
2452 pub affected_path: String,
2453 pub param_errs: Vec<usp::mod_SetResp::ParameterError>,
2454}
2455
2456impl<'a> MessageRead<'a> for UpdatedInstanceFailure {
2457 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2458 let mut msg = Self::default();
2459 while !r.is_eof() {
2460 match r.next_tag(bytes) {
2461 Ok(10) => msg.affected_path = r.read_string(bytes)?.to_owned(),
2462 Ok(18) => msg.param_errs.push(r.read_message::<usp::mod_SetResp::ParameterError>(bytes)?),
2463 Ok(t) => { r.read_unknown(bytes, t)?; }
2464 Err(e) => return Err(e),
2465 }
2466 }
2467 Ok(msg)
2468 }
2469}
2470
2471impl MessageWrite for UpdatedInstanceFailure {
2472 fn get_size(&self) -> usize {
2473 0
2474 + if self.affected_path == String::default() { 0 } else { 1 + sizeof_len((&self.affected_path).len()) }
2475 + self.param_errs.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
2476 }
2477
2478 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2479 if self.affected_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.affected_path))?; }
2480 for s in &self.param_errs { w.write_with_tag(18, |w| w.write_message(s))?; }
2481 Ok(())
2482 }
2483}
2484
2485#[allow(clippy::derive_partial_eq_without_eq)]
2486#[derive(Debug, Default, PartialEq, Clone)]
2487pub struct UpdatedInstanceResult {
2488 pub affected_path: String,
2489 pub param_errs: Vec<usp::mod_SetResp::ParameterError>,
2490 pub updated_params: KVMap<String, String>,
2491}
2492
2493impl<'a> MessageRead<'a> for UpdatedInstanceResult {
2494 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2495 let mut msg = Self::default();
2496 while !r.is_eof() {
2497 match r.next_tag(bytes) {
2498 Ok(10) => msg.affected_path = r.read_string(bytes)?.to_owned(),
2499 Ok(18) => msg.param_errs.push(r.read_message::<usp::mod_SetResp::ParameterError>(bytes)?),
2500 Ok(26) => {
2501 let (key, value) = r.read_map(bytes, |r, bytes| Ok(r.read_string(bytes)?.to_owned()), |r, bytes| Ok(r.read_string(bytes)?.to_owned()))?;
2502 msg.updated_params.insert(key, value);
2503 }
2504 Ok(t) => { r.read_unknown(bytes, t)?; }
2505 Err(e) => return Err(e),
2506 }
2507 }
2508 Ok(msg)
2509 }
2510}
2511
2512impl MessageWrite for UpdatedInstanceResult {
2513 fn get_size(&self) -> usize {
2514 0
2515 + if self.affected_path == String::default() { 0 } else { 1 + sizeof_len((&self.affected_path).len()) }
2516 + self.param_errs.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
2517 + self.updated_params.iter().map(|(k, v)| 1 + sizeof_len(2 + sizeof_len((k).len()) + sizeof_len((v).len()))).sum::<usize>()
2518 }
2519
2520 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2521 if self.affected_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.affected_path))?; }
2522 for s in &self.param_errs { w.write_with_tag(18, |w| w.write_message(s))?; }
2523 for (k, v) in self.updated_params.iter() { w.write_with_tag(26, |w| w.write_map(2 + sizeof_len((k).len()) + sizeof_len((v).len()), 10, |w| w.write_string(&**k), 18, |w| w.write_string(&**v)))?; }
2524 Ok(())
2525 }
2526}
2527
2528#[allow(clippy::derive_partial_eq_without_eq)]
2529#[derive(Debug, Default, PartialEq, Clone)]
2530pub struct ParameterError {
2531 pub param: String,
2532 pub err_code: u32,
2533 pub err_msg: String,
2534}
2535
2536impl<'a> MessageRead<'a> for ParameterError {
2537 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2538 let mut msg = Self::default();
2539 while !r.is_eof() {
2540 match r.next_tag(bytes) {
2541 Ok(10) => msg.param = r.read_string(bytes)?.to_owned(),
2542 Ok(21) => msg.err_code = r.read_fixed32(bytes)?,
2543 Ok(26) => msg.err_msg = r.read_string(bytes)?.to_owned(),
2544 Ok(t) => { r.read_unknown(bytes, t)?; }
2545 Err(e) => return Err(e),
2546 }
2547 }
2548 Ok(msg)
2549 }
2550}
2551
2552impl MessageWrite for ParameterError {
2553 fn get_size(&self) -> usize {
2554 0
2555 + if self.param == String::default() { 0 } else { 1 + sizeof_len((&self.param).len()) }
2556 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
2557 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
2558 }
2559
2560 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2561 if self.param != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.param))?; }
2562 if self.err_code != 0u32 { w.write_with_tag(21, |w| w.write_fixed32(*&self.err_code))?; }
2563 if self.err_msg != String::default() { w.write_with_tag(26, |w| w.write_string(&**&self.err_msg))?; }
2564 Ok(())
2565 }
2566}
2567
2568}
2569
2570#[allow(clippy::derive_partial_eq_without_eq)]
2571#[derive(Debug, Default, PartialEq, Clone)]
2572pub struct Operate {
2573 pub command: String,
2574 pub command_key: String,
2575 pub send_resp: bool,
2576 pub input_args: KVMap<String, String>,
2577}
2578
2579impl<'a> MessageRead<'a> for Operate {
2580 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2581 let mut msg = Self::default();
2582 while !r.is_eof() {
2583 match r.next_tag(bytes) {
2584 Ok(10) => msg.command = r.read_string(bytes)?.to_owned(),
2585 Ok(18) => msg.command_key = r.read_string(bytes)?.to_owned(),
2586 Ok(24) => msg.send_resp = r.read_bool(bytes)?,
2587 Ok(34) => {
2588 let (key, value) = r.read_map(bytes, |r, bytes| Ok(r.read_string(bytes)?.to_owned()), |r, bytes| Ok(r.read_string(bytes)?.to_owned()))?;
2589 msg.input_args.insert(key, value);
2590 }
2591 Ok(t) => { r.read_unknown(bytes, t)?; }
2592 Err(e) => return Err(e),
2593 }
2594 }
2595 Ok(msg)
2596 }
2597}
2598
2599impl MessageWrite for Operate {
2600 fn get_size(&self) -> usize {
2601 0
2602 + if self.command == String::default() { 0 } else { 1 + sizeof_len((&self.command).len()) }
2603 + if self.command_key == String::default() { 0 } else { 1 + sizeof_len((&self.command_key).len()) }
2604 + if self.send_resp == false { 0 } else { 1 + sizeof_varint(*(&self.send_resp) as u64) }
2605 + self.input_args.iter().map(|(k, v)| 1 + sizeof_len(2 + sizeof_len((k).len()) + sizeof_len((v).len()))).sum::<usize>()
2606 }
2607
2608 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2609 if self.command != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.command))?; }
2610 if self.command_key != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.command_key))?; }
2611 if self.send_resp != false { w.write_with_tag(24, |w| w.write_bool(*&self.send_resp))?; }
2612 for (k, v) in self.input_args.iter() { w.write_with_tag(34, |w| w.write_map(2 + sizeof_len((k).len()) + sizeof_len((v).len()), 10, |w| w.write_string(&**k), 18, |w| w.write_string(&**v)))?; }
2613 Ok(())
2614 }
2615}
2616
2617#[allow(clippy::derive_partial_eq_without_eq)]
2618#[derive(Debug, Default, PartialEq, Clone)]
2619pub struct OperateResp {
2620 pub operation_results: Vec<usp::mod_OperateResp::OperationResult>,
2621}
2622
2623impl<'a> MessageRead<'a> for OperateResp {
2624 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2625 let mut msg = Self::default();
2626 while !r.is_eof() {
2627 match r.next_tag(bytes) {
2628 Ok(10) => msg.operation_results.push(r.read_message::<usp::mod_OperateResp::OperationResult>(bytes)?),
2629 Ok(t) => { r.read_unknown(bytes, t)?; }
2630 Err(e) => return Err(e),
2631 }
2632 }
2633 Ok(msg)
2634 }
2635}
2636
2637impl MessageWrite for OperateResp {
2638 fn get_size(&self) -> usize {
2639 0
2640 + self.operation_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
2641 }
2642
2643 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2644 for s in &self.operation_results { w.write_with_tag(10, |w| w.write_message(s))?; }
2645 Ok(())
2646 }
2647}
2648
2649pub mod mod_OperateResp {
2650
2651use super::*;
2652
2653#[allow(clippy::derive_partial_eq_without_eq)]
2654#[derive(Debug, Default, PartialEq, Clone)]
2655pub struct OperationResult {
2656 pub executed_command: String,
2657 pub operation_resp: usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp,
2658}
2659
2660impl<'a> MessageRead<'a> for OperationResult {
2661 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2662 let mut msg = Self::default();
2663 while !r.is_eof() {
2664 match r.next_tag(bytes) {
2665 Ok(10) => msg.executed_command = r.read_string(bytes)?.to_owned(),
2666 Ok(18) => msg.operation_resp = usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::req_obj_path(r.read_string(bytes)?.to_owned()),
2667 Ok(26) => msg.operation_resp = usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::req_output_args(r.read_message::<usp::mod_OperateResp::mod_OperationResult::OutputArgs>(bytes)?),
2668 Ok(34) => msg.operation_resp = usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::cmd_failure(r.read_message::<usp::mod_OperateResp::mod_OperationResult::CommandFailure>(bytes)?),
2669 Ok(t) => { r.read_unknown(bytes, t)?; }
2670 Err(e) => return Err(e),
2671 }
2672 }
2673 Ok(msg)
2674 }
2675}
2676
2677impl MessageWrite for OperationResult {
2678 fn get_size(&self) -> usize {
2679 0
2680 + if self.executed_command == String::default() { 0 } else { 1 + sizeof_len((&self.executed_command).len()) }
2681 + match self.operation_resp {
2682 usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::req_obj_path(ref m) => 1 + sizeof_len((m).len()),
2683 usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::req_output_args(ref m) => 1 + sizeof_len((m).get_size()),
2684 usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::cmd_failure(ref m) => 1 + sizeof_len((m).get_size()),
2685 usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::None => 0,
2686 } }
2687
2688 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2689 if self.executed_command != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.executed_command))?; }
2690 match self.operation_resp { usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::req_obj_path(ref m) => { w.write_with_tag(18, |w| w.write_string(&**m))? },
2691 usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::req_output_args(ref m) => { w.write_with_tag(26, |w| w.write_message(m))? },
2692 usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::cmd_failure(ref m) => { w.write_with_tag(34, |w| w.write_message(m))? },
2693 usp::mod_OperateResp::mod_OperationResult::OneOfoperation_resp::None => {},
2694 } Ok(())
2695 }
2696}
2697
2698pub mod mod_OperationResult {
2699
2700use std::collections::HashMap;
2701type KVMap<K, V> = HashMap<K, V>;
2702use super::*;
2703
2704#[allow(clippy::derive_partial_eq_without_eq)]
2705#[derive(Debug, Default, PartialEq, Clone)]
2706pub struct OutputArgs {
2707 pub output_args: KVMap<String, String>,
2708}
2709
2710impl<'a> MessageRead<'a> for OutputArgs {
2711 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2712 let mut msg = Self::default();
2713 while !r.is_eof() {
2714 match r.next_tag(bytes) {
2715 Ok(10) => {
2716 let (key, value) = r.read_map(bytes, |r, bytes| Ok(r.read_string(bytes)?.to_owned()), |r, bytes| Ok(r.read_string(bytes)?.to_owned()))?;
2717 msg.output_args.insert(key, value);
2718 }
2719 Ok(t) => { r.read_unknown(bytes, t)?; }
2720 Err(e) => return Err(e),
2721 }
2722 }
2723 Ok(msg)
2724 }
2725}
2726
2727impl MessageWrite for OutputArgs {
2728 fn get_size(&self) -> usize {
2729 0
2730 + self.output_args.iter().map(|(k, v)| 1 + sizeof_len(2 + sizeof_len((k).len()) + sizeof_len((v).len()))).sum::<usize>()
2731 }
2732
2733 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2734 for (k, v) in self.output_args.iter() { w.write_with_tag(10, |w| w.write_map(2 + sizeof_len((k).len()) + sizeof_len((v).len()), 10, |w| w.write_string(&**k), 18, |w| w.write_string(&**v)))?; }
2735 Ok(())
2736 }
2737}
2738
2739#[allow(clippy::derive_partial_eq_without_eq)]
2740#[derive(Debug, Default, PartialEq, Clone)]
2741pub struct CommandFailure {
2742 pub err_code: u32,
2743 pub err_msg: String,
2744}
2745
2746impl<'a> MessageRead<'a> for CommandFailure {
2747 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2748 let mut msg = Self::default();
2749 while !r.is_eof() {
2750 match r.next_tag(bytes) {
2751 Ok(13) => msg.err_code = r.read_fixed32(bytes)?,
2752 Ok(18) => msg.err_msg = r.read_string(bytes)?.to_owned(),
2753 Ok(t) => { r.read_unknown(bytes, t)?; }
2754 Err(e) => return Err(e),
2755 }
2756 }
2757 Ok(msg)
2758 }
2759}
2760
2761impl MessageWrite for CommandFailure {
2762 fn get_size(&self) -> usize {
2763 0
2764 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
2765 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
2766 }
2767
2768 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2769 if self.err_code != 0u32 { w.write_with_tag(13, |w| w.write_fixed32(*&self.err_code))?; }
2770 if self.err_msg != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.err_msg))?; }
2771 Ok(())
2772 }
2773}
2774
2775#[derive(Debug, PartialEq, Clone)]
2776pub enum OneOfoperation_resp {
2777 req_obj_path(String),
2778 req_output_args(usp::mod_OperateResp::mod_OperationResult::OutputArgs),
2779 cmd_failure(usp::mod_OperateResp::mod_OperationResult::CommandFailure),
2780 None,
2781}
2782
2783impl Default for OneOfoperation_resp {
2784 fn default() -> Self {
2785 OneOfoperation_resp::None
2786 }
2787}
2788
2789}
2790
2791}
2792
2793#[allow(clippy::derive_partial_eq_without_eq)]
2794#[derive(Debug, Default, PartialEq, Clone)]
2795pub struct Notify {
2796 pub subscription_id: String,
2797 pub send_resp: bool,
2798 pub notification: usp::mod_Notify::OneOfnotification,
2799}
2800
2801impl<'a> MessageRead<'a> for Notify {
2802 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2803 let mut msg = Self::default();
2804 while !r.is_eof() {
2805 match r.next_tag(bytes) {
2806 Ok(10) => msg.subscription_id = r.read_string(bytes)?.to_owned(),
2807 Ok(16) => msg.send_resp = r.read_bool(bytes)?,
2808 Ok(26) => msg.notification = usp::mod_Notify::OneOfnotification::event(r.read_message::<usp::mod_Notify::Event>(bytes)?),
2809 Ok(34) => msg.notification = usp::mod_Notify::OneOfnotification::value_change(r.read_message::<usp::mod_Notify::ValueChange>(bytes)?),
2810 Ok(42) => msg.notification = usp::mod_Notify::OneOfnotification::obj_creation(r.read_message::<usp::mod_Notify::ObjectCreation>(bytes)?),
2811 Ok(50) => msg.notification = usp::mod_Notify::OneOfnotification::obj_deletion(r.read_message::<usp::mod_Notify::ObjectDeletion>(bytes)?),
2812 Ok(58) => msg.notification = usp::mod_Notify::OneOfnotification::oper_complete(r.read_message::<usp::mod_Notify::OperationComplete>(bytes)?),
2813 Ok(66) => msg.notification = usp::mod_Notify::OneOfnotification::on_board_req(r.read_message::<usp::mod_Notify::OnBoardRequest>(bytes)?),
2814 Ok(t) => { r.read_unknown(bytes, t)?; }
2815 Err(e) => return Err(e),
2816 }
2817 }
2818 Ok(msg)
2819 }
2820}
2821
2822impl MessageWrite for Notify {
2823 fn get_size(&self) -> usize {
2824 0
2825 + if self.subscription_id == String::default() { 0 } else { 1 + sizeof_len((&self.subscription_id).len()) }
2826 + if self.send_resp == false { 0 } else { 1 + sizeof_varint(*(&self.send_resp) as u64) }
2827 + match self.notification {
2828 usp::mod_Notify::OneOfnotification::event(ref m) => 1 + sizeof_len((m).get_size()),
2829 usp::mod_Notify::OneOfnotification::value_change(ref m) => 1 + sizeof_len((m).get_size()),
2830 usp::mod_Notify::OneOfnotification::obj_creation(ref m) => 1 + sizeof_len((m).get_size()),
2831 usp::mod_Notify::OneOfnotification::obj_deletion(ref m) => 1 + sizeof_len((m).get_size()),
2832 usp::mod_Notify::OneOfnotification::oper_complete(ref m) => 1 + sizeof_len((m).get_size()),
2833 usp::mod_Notify::OneOfnotification::on_board_req(ref m) => 1 + sizeof_len((m).get_size()),
2834 usp::mod_Notify::OneOfnotification::None => 0,
2835 } }
2836
2837 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2838 if self.subscription_id != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.subscription_id))?; }
2839 if self.send_resp != false { w.write_with_tag(16, |w| w.write_bool(*&self.send_resp))?; }
2840 match self.notification { usp::mod_Notify::OneOfnotification::event(ref m) => { w.write_with_tag(26, |w| w.write_message(m))? },
2841 usp::mod_Notify::OneOfnotification::value_change(ref m) => { w.write_with_tag(34, |w| w.write_message(m))? },
2842 usp::mod_Notify::OneOfnotification::obj_creation(ref m) => { w.write_with_tag(42, |w| w.write_message(m))? },
2843 usp::mod_Notify::OneOfnotification::obj_deletion(ref m) => { w.write_with_tag(50, |w| w.write_message(m))? },
2844 usp::mod_Notify::OneOfnotification::oper_complete(ref m) => { w.write_with_tag(58, |w| w.write_message(m))? },
2845 usp::mod_Notify::OneOfnotification::on_board_req(ref m) => { w.write_with_tag(66, |w| w.write_message(m))? },
2846 usp::mod_Notify::OneOfnotification::None => {},
2847 } Ok(())
2848 }
2849}
2850
2851pub mod mod_Notify {
2852
2853use std::collections::HashMap;
2854type KVMap<K, V> = HashMap<K, V>;
2855use super::*;
2856
2857#[allow(clippy::derive_partial_eq_without_eq)]
2858#[derive(Debug, Default, PartialEq, Clone)]
2859pub struct Event {
2860 pub obj_path: String,
2861 pub event_name: String,
2862 pub params: KVMap<String, String>,
2863}
2864
2865impl<'a> MessageRead<'a> for Event {
2866 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2867 let mut msg = Self::default();
2868 while !r.is_eof() {
2869 match r.next_tag(bytes) {
2870 Ok(10) => msg.obj_path = r.read_string(bytes)?.to_owned(),
2871 Ok(18) => msg.event_name = r.read_string(bytes)?.to_owned(),
2872 Ok(26) => {
2873 let (key, value) = r.read_map(bytes, |r, bytes| Ok(r.read_string(bytes)?.to_owned()), |r, bytes| Ok(r.read_string(bytes)?.to_owned()))?;
2874 msg.params.insert(key, value);
2875 }
2876 Ok(t) => { r.read_unknown(bytes, t)?; }
2877 Err(e) => return Err(e),
2878 }
2879 }
2880 Ok(msg)
2881 }
2882}
2883
2884impl MessageWrite for Event {
2885 fn get_size(&self) -> usize {
2886 0
2887 + if self.obj_path == String::default() { 0 } else { 1 + sizeof_len((&self.obj_path).len()) }
2888 + if self.event_name == String::default() { 0 } else { 1 + sizeof_len((&self.event_name).len()) }
2889 + self.params.iter().map(|(k, v)| 1 + sizeof_len(2 + sizeof_len((k).len()) + sizeof_len((v).len()))).sum::<usize>()
2890 }
2891
2892 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2893 if self.obj_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.obj_path))?; }
2894 if self.event_name != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.event_name))?; }
2895 for (k, v) in self.params.iter() { w.write_with_tag(26, |w| w.write_map(2 + sizeof_len((k).len()) + sizeof_len((v).len()), 10, |w| w.write_string(&**k), 18, |w| w.write_string(&**v)))?; }
2896 Ok(())
2897 }
2898}
2899
2900#[allow(clippy::derive_partial_eq_without_eq)]
2901#[derive(Debug, Default, PartialEq, Clone)]
2902pub struct ValueChange {
2903 pub param_path: String,
2904 pub param_value: String,
2905}
2906
2907impl<'a> MessageRead<'a> for ValueChange {
2908 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2909 let mut msg = Self::default();
2910 while !r.is_eof() {
2911 match r.next_tag(bytes) {
2912 Ok(10) => msg.param_path = r.read_string(bytes)?.to_owned(),
2913 Ok(18) => msg.param_value = r.read_string(bytes)?.to_owned(),
2914 Ok(t) => { r.read_unknown(bytes, t)?; }
2915 Err(e) => return Err(e),
2916 }
2917 }
2918 Ok(msg)
2919 }
2920}
2921
2922impl MessageWrite for ValueChange {
2923 fn get_size(&self) -> usize {
2924 0
2925 + if self.param_path == String::default() { 0 } else { 1 + sizeof_len((&self.param_path).len()) }
2926 + if self.param_value == String::default() { 0 } else { 1 + sizeof_len((&self.param_value).len()) }
2927 }
2928
2929 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2930 if self.param_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.param_path))?; }
2931 if self.param_value != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.param_value))?; }
2932 Ok(())
2933 }
2934}
2935
2936#[allow(clippy::derive_partial_eq_without_eq)]
2937#[derive(Debug, Default, PartialEq, Clone)]
2938pub struct ObjectCreation {
2939 pub obj_path: String,
2940 pub unique_keys: KVMap<String, String>,
2941}
2942
2943impl<'a> MessageRead<'a> for ObjectCreation {
2944 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2945 let mut msg = Self::default();
2946 while !r.is_eof() {
2947 match r.next_tag(bytes) {
2948 Ok(10) => msg.obj_path = r.read_string(bytes)?.to_owned(),
2949 Ok(18) => {
2950 let (key, value) = r.read_map(bytes, |r, bytes| Ok(r.read_string(bytes)?.to_owned()), |r, bytes| Ok(r.read_string(bytes)?.to_owned()))?;
2951 msg.unique_keys.insert(key, value);
2952 }
2953 Ok(t) => { r.read_unknown(bytes, t)?; }
2954 Err(e) => return Err(e),
2955 }
2956 }
2957 Ok(msg)
2958 }
2959}
2960
2961impl MessageWrite for ObjectCreation {
2962 fn get_size(&self) -> usize {
2963 0
2964 + if self.obj_path == String::default() { 0 } else { 1 + sizeof_len((&self.obj_path).len()) }
2965 + self.unique_keys.iter().map(|(k, v)| 1 + sizeof_len(2 + sizeof_len((k).len()) + sizeof_len((v).len()))).sum::<usize>()
2966 }
2967
2968 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
2969 if self.obj_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.obj_path))?; }
2970 for (k, v) in self.unique_keys.iter() { w.write_with_tag(18, |w| w.write_map(2 + sizeof_len((k).len()) + sizeof_len((v).len()), 10, |w| w.write_string(&**k), 18, |w| w.write_string(&**v)))?; }
2971 Ok(())
2972 }
2973}
2974
2975#[allow(clippy::derive_partial_eq_without_eq)]
2976#[derive(Debug, Default, PartialEq, Clone)]
2977pub struct ObjectDeletion {
2978 pub obj_path: String,
2979}
2980
2981impl<'a> MessageRead<'a> for ObjectDeletion {
2982 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
2983 let mut msg = Self::default();
2984 while !r.is_eof() {
2985 match r.next_tag(bytes) {
2986 Ok(10) => msg.obj_path = r.read_string(bytes)?.to_owned(),
2987 Ok(t) => { r.read_unknown(bytes, t)?; }
2988 Err(e) => return Err(e),
2989 }
2990 }
2991 Ok(msg)
2992 }
2993}
2994
2995impl MessageWrite for ObjectDeletion {
2996 fn get_size(&self) -> usize {
2997 0
2998 + if self.obj_path == String::default() { 0 } else { 1 + sizeof_len((&self.obj_path).len()) }
2999 }
3000
3001 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3002 if self.obj_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.obj_path))?; }
3003 Ok(())
3004 }
3005}
3006
3007#[allow(clippy::derive_partial_eq_without_eq)]
3008#[derive(Debug, Default, PartialEq, Clone)]
3009pub struct OperationComplete {
3010 pub obj_path: String,
3011 pub command_name: String,
3012 pub command_key: String,
3013 pub operation_resp: usp::mod_Notify::mod_OperationComplete::OneOfoperation_resp,
3014}
3015
3016impl<'a> MessageRead<'a> for OperationComplete {
3017 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3018 let mut msg = Self::default();
3019 while !r.is_eof() {
3020 match r.next_tag(bytes) {
3021 Ok(10) => msg.obj_path = r.read_string(bytes)?.to_owned(),
3022 Ok(18) => msg.command_name = r.read_string(bytes)?.to_owned(),
3023 Ok(26) => msg.command_key = r.read_string(bytes)?.to_owned(),
3024 Ok(34) => msg.operation_resp = usp::mod_Notify::mod_OperationComplete::OneOfoperation_resp::req_output_args(r.read_message::<usp::mod_Notify::mod_OperationComplete::OutputArgs>(bytes)?),
3025 Ok(42) => msg.operation_resp = usp::mod_Notify::mod_OperationComplete::OneOfoperation_resp::cmd_failure(r.read_message::<usp::mod_Notify::mod_OperationComplete::CommandFailure>(bytes)?),
3026 Ok(t) => { r.read_unknown(bytes, t)?; }
3027 Err(e) => return Err(e),
3028 }
3029 }
3030 Ok(msg)
3031 }
3032}
3033
3034impl MessageWrite for OperationComplete {
3035 fn get_size(&self) -> usize {
3036 0
3037 + if self.obj_path == String::default() { 0 } else { 1 + sizeof_len((&self.obj_path).len()) }
3038 + if self.command_name == String::default() { 0 } else { 1 + sizeof_len((&self.command_name).len()) }
3039 + if self.command_key == String::default() { 0 } else { 1 + sizeof_len((&self.command_key).len()) }
3040 + match self.operation_resp {
3041 usp::mod_Notify::mod_OperationComplete::OneOfoperation_resp::req_output_args(ref m) => 1 + sizeof_len((m).get_size()),
3042 usp::mod_Notify::mod_OperationComplete::OneOfoperation_resp::cmd_failure(ref m) => 1 + sizeof_len((m).get_size()),
3043 usp::mod_Notify::mod_OperationComplete::OneOfoperation_resp::None => 0,
3044 } }
3045
3046 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3047 if self.obj_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.obj_path))?; }
3048 if self.command_name != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.command_name))?; }
3049 if self.command_key != String::default() { w.write_with_tag(26, |w| w.write_string(&**&self.command_key))?; }
3050 match self.operation_resp { usp::mod_Notify::mod_OperationComplete::OneOfoperation_resp::req_output_args(ref m) => { w.write_with_tag(34, |w| w.write_message(m))? },
3051 usp::mod_Notify::mod_OperationComplete::OneOfoperation_resp::cmd_failure(ref m) => { w.write_with_tag(42, |w| w.write_message(m))? },
3052 usp::mod_Notify::mod_OperationComplete::OneOfoperation_resp::None => {},
3053 } Ok(())
3054 }
3055}
3056
3057pub mod mod_OperationComplete {
3058
3059use std::collections::HashMap;
3060type KVMap<K, V> = HashMap<K, V>;
3061use super::*;
3062
3063#[allow(clippy::derive_partial_eq_without_eq)]
3064#[derive(Debug, Default, PartialEq, Clone)]
3065pub struct OutputArgs {
3066 pub output_args: KVMap<String, String>,
3067}
3068
3069impl<'a> MessageRead<'a> for OutputArgs {
3070 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3071 let mut msg = Self::default();
3072 while !r.is_eof() {
3073 match r.next_tag(bytes) {
3074 Ok(10) => {
3075 let (key, value) = r.read_map(bytes, |r, bytes| Ok(r.read_string(bytes)?.to_owned()), |r, bytes| Ok(r.read_string(bytes)?.to_owned()))?;
3076 msg.output_args.insert(key, value);
3077 }
3078 Ok(t) => { r.read_unknown(bytes, t)?; }
3079 Err(e) => return Err(e),
3080 }
3081 }
3082 Ok(msg)
3083 }
3084}
3085
3086impl MessageWrite for OutputArgs {
3087 fn get_size(&self) -> usize {
3088 0
3089 + self.output_args.iter().map(|(k, v)| 1 + sizeof_len(2 + sizeof_len((k).len()) + sizeof_len((v).len()))).sum::<usize>()
3090 }
3091
3092 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3093 for (k, v) in self.output_args.iter() { w.write_with_tag(10, |w| w.write_map(2 + sizeof_len((k).len()) + sizeof_len((v).len()), 10, |w| w.write_string(&**k), 18, |w| w.write_string(&**v)))?; }
3094 Ok(())
3095 }
3096}
3097
3098#[allow(clippy::derive_partial_eq_without_eq)]
3099#[derive(Debug, Default, PartialEq, Clone)]
3100pub struct CommandFailure {
3101 pub err_code: u32,
3102 pub err_msg: String,
3103}
3104
3105impl<'a> MessageRead<'a> for CommandFailure {
3106 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3107 let mut msg = Self::default();
3108 while !r.is_eof() {
3109 match r.next_tag(bytes) {
3110 Ok(13) => msg.err_code = r.read_fixed32(bytes)?,
3111 Ok(18) => msg.err_msg = r.read_string(bytes)?.to_owned(),
3112 Ok(t) => { r.read_unknown(bytes, t)?; }
3113 Err(e) => return Err(e),
3114 }
3115 }
3116 Ok(msg)
3117 }
3118}
3119
3120impl MessageWrite for CommandFailure {
3121 fn get_size(&self) -> usize {
3122 0
3123 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
3124 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
3125 }
3126
3127 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3128 if self.err_code != 0u32 { w.write_with_tag(13, |w| w.write_fixed32(*&self.err_code))?; }
3129 if self.err_msg != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.err_msg))?; }
3130 Ok(())
3131 }
3132}
3133
3134#[derive(Debug, PartialEq, Clone)]
3135pub enum OneOfoperation_resp {
3136 req_output_args(usp::mod_Notify::mod_OperationComplete::OutputArgs),
3137 cmd_failure(usp::mod_Notify::mod_OperationComplete::CommandFailure),
3138 None,
3139}
3140
3141impl Default for OneOfoperation_resp {
3142 fn default() -> Self {
3143 OneOfoperation_resp::None
3144 }
3145}
3146
3147}
3148
3149#[allow(clippy::derive_partial_eq_without_eq)]
3150#[derive(Debug, Default, PartialEq, Clone)]
3151pub struct OnBoardRequest {
3152 pub oui: String,
3153 pub product_class: String,
3154 pub serial_number: String,
3155 pub agent_supported_protocol_versions: String,
3156}
3157
3158impl<'a> MessageRead<'a> for OnBoardRequest {
3159 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3160 let mut msg = Self::default();
3161 while !r.is_eof() {
3162 match r.next_tag(bytes) {
3163 Ok(10) => msg.oui = r.read_string(bytes)?.to_owned(),
3164 Ok(18) => msg.product_class = r.read_string(bytes)?.to_owned(),
3165 Ok(26) => msg.serial_number = r.read_string(bytes)?.to_owned(),
3166 Ok(34) => msg.agent_supported_protocol_versions = r.read_string(bytes)?.to_owned(),
3167 Ok(t) => { r.read_unknown(bytes, t)?; }
3168 Err(e) => return Err(e),
3169 }
3170 }
3171 Ok(msg)
3172 }
3173}
3174
3175impl MessageWrite for OnBoardRequest {
3176 fn get_size(&self) -> usize {
3177 0
3178 + if self.oui == String::default() { 0 } else { 1 + sizeof_len((&self.oui).len()) }
3179 + if self.product_class == String::default() { 0 } else { 1 + sizeof_len((&self.product_class).len()) }
3180 + if self.serial_number == String::default() { 0 } else { 1 + sizeof_len((&self.serial_number).len()) }
3181 + if self.agent_supported_protocol_versions == String::default() { 0 } else { 1 + sizeof_len((&self.agent_supported_protocol_versions).len()) }
3182 }
3183
3184 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3185 if self.oui != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.oui))?; }
3186 if self.product_class != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.product_class))?; }
3187 if self.serial_number != String::default() { w.write_with_tag(26, |w| w.write_string(&**&self.serial_number))?; }
3188 if self.agent_supported_protocol_versions != String::default() { w.write_with_tag(34, |w| w.write_string(&**&self.agent_supported_protocol_versions))?; }
3189 Ok(())
3190 }
3191}
3192
3193#[derive(Debug, PartialEq, Clone)]
3194pub enum OneOfnotification {
3195 event(usp::mod_Notify::Event),
3196 value_change(usp::mod_Notify::ValueChange),
3197 obj_creation(usp::mod_Notify::ObjectCreation),
3198 obj_deletion(usp::mod_Notify::ObjectDeletion),
3199 oper_complete(usp::mod_Notify::OperationComplete),
3200 on_board_req(usp::mod_Notify::OnBoardRequest),
3201 None,
3202}
3203
3204impl Default for OneOfnotification {
3205 fn default() -> Self {
3206 OneOfnotification::None
3207 }
3208}
3209
3210}
3211
3212#[allow(clippy::derive_partial_eq_without_eq)]
3213#[derive(Debug, Default, PartialEq, Clone)]
3214pub struct NotifyResp {
3215 pub subscription_id: String,
3216}
3217
3218impl<'a> MessageRead<'a> for NotifyResp {
3219 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3220 let mut msg = Self::default();
3221 while !r.is_eof() {
3222 match r.next_tag(bytes) {
3223 Ok(10) => msg.subscription_id = r.read_string(bytes)?.to_owned(),
3224 Ok(t) => { r.read_unknown(bytes, t)?; }
3225 Err(e) => return Err(e),
3226 }
3227 }
3228 Ok(msg)
3229 }
3230}
3231
3232impl MessageWrite for NotifyResp {
3233 fn get_size(&self) -> usize {
3234 0
3235 + if self.subscription_id == String::default() { 0 } else { 1 + sizeof_len((&self.subscription_id).len()) }
3236 }
3237
3238 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3239 if self.subscription_id != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.subscription_id))?; }
3240 Ok(())
3241 }
3242}
3243
3244#[allow(clippy::derive_partial_eq_without_eq)]
3245#[derive(Debug, Default, PartialEq, Clone)]
3246pub struct Register {
3247 pub allow_partial: bool,
3248 pub reg_paths: Vec<usp::mod_Register::RegistrationPath>,
3249}
3250
3251impl<'a> MessageRead<'a> for Register {
3252 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3253 let mut msg = Self::default();
3254 while !r.is_eof() {
3255 match r.next_tag(bytes) {
3256 Ok(8) => msg.allow_partial = r.read_bool(bytes)?,
3257 Ok(18) => msg.reg_paths.push(r.read_message::<usp::mod_Register::RegistrationPath>(bytes)?),
3258 Ok(t) => { r.read_unknown(bytes, t)?; }
3259 Err(e) => return Err(e),
3260 }
3261 }
3262 Ok(msg)
3263 }
3264}
3265
3266impl MessageWrite for Register {
3267 fn get_size(&self) -> usize {
3268 0
3269 + if self.allow_partial == false { 0 } else { 1 + sizeof_varint(*(&self.allow_partial) as u64) }
3270 + self.reg_paths.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
3271 }
3272
3273 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3274 if self.allow_partial != false { w.write_with_tag(8, |w| w.write_bool(*&self.allow_partial))?; }
3275 for s in &self.reg_paths { w.write_with_tag(18, |w| w.write_message(s))?; }
3276 Ok(())
3277 }
3278}
3279
3280pub mod mod_Register {
3281
3282use super::*;
3283
3284#[allow(clippy::derive_partial_eq_without_eq)]
3285#[derive(Debug, Default, PartialEq, Clone)]
3286pub struct RegistrationPath {
3287 pub path: String,
3288}
3289
3290impl<'a> MessageRead<'a> for RegistrationPath {
3291 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3292 let mut msg = Self::default();
3293 while !r.is_eof() {
3294 match r.next_tag(bytes) {
3295 Ok(10) => msg.path = r.read_string(bytes)?.to_owned(),
3296 Ok(t) => { r.read_unknown(bytes, t)?; }
3297 Err(e) => return Err(e),
3298 }
3299 }
3300 Ok(msg)
3301 }
3302}
3303
3304impl MessageWrite for RegistrationPath {
3305 fn get_size(&self) -> usize {
3306 0
3307 + if self.path == String::default() { 0 } else { 1 + sizeof_len((&self.path).len()) }
3308 }
3309
3310 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3311 if self.path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.path))?; }
3312 Ok(())
3313 }
3314}
3315
3316}
3317
3318#[allow(clippy::derive_partial_eq_without_eq)]
3319#[derive(Debug, Default, PartialEq, Clone)]
3320pub struct RegisterResp {
3321 pub registered_path_results: Vec<usp::mod_RegisterResp::RegisteredPathResult>,
3322}
3323
3324impl<'a> MessageRead<'a> for RegisterResp {
3325 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3326 let mut msg = Self::default();
3327 while !r.is_eof() {
3328 match r.next_tag(bytes) {
3329 Ok(10) => msg.registered_path_results.push(r.read_message::<usp::mod_RegisterResp::RegisteredPathResult>(bytes)?),
3330 Ok(t) => { r.read_unknown(bytes, t)?; }
3331 Err(e) => return Err(e),
3332 }
3333 }
3334 Ok(msg)
3335 }
3336}
3337
3338impl MessageWrite for RegisterResp {
3339 fn get_size(&self) -> usize {
3340 0
3341 + self.registered_path_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
3342 }
3343
3344 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3345 for s in &self.registered_path_results { w.write_with_tag(10, |w| w.write_message(s))?; }
3346 Ok(())
3347 }
3348}
3349
3350pub mod mod_RegisterResp {
3351
3352use super::*;
3353
3354#[allow(clippy::derive_partial_eq_without_eq)]
3355#[derive(Debug, Default, PartialEq, Clone)]
3356pub struct RegisteredPathResult {
3357 pub requested_path: String,
3358 pub oper_status: Option<usp::mod_RegisterResp::mod_RegisteredPathResult::OperationStatus>,
3359}
3360
3361impl<'a> MessageRead<'a> for RegisteredPathResult {
3362 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3363 let mut msg = Self::default();
3364 while !r.is_eof() {
3365 match r.next_tag(bytes) {
3366 Ok(10) => msg.requested_path = r.read_string(bytes)?.to_owned(),
3367 Ok(18) => msg.oper_status = Some(r.read_message::<usp::mod_RegisterResp::mod_RegisteredPathResult::OperationStatus>(bytes)?),
3368 Ok(t) => { r.read_unknown(bytes, t)?; }
3369 Err(e) => return Err(e),
3370 }
3371 }
3372 Ok(msg)
3373 }
3374}
3375
3376impl MessageWrite for RegisteredPathResult {
3377 fn get_size(&self) -> usize {
3378 0
3379 + if self.requested_path == String::default() { 0 } else { 1 + sizeof_len((&self.requested_path).len()) }
3380 + self.oper_status.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
3381 }
3382
3383 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3384 if self.requested_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.requested_path))?; }
3385 if let Some(ref s) = self.oper_status { w.write_with_tag(18, |w| w.write_message(s))?; }
3386 Ok(())
3387 }
3388}
3389
3390pub mod mod_RegisteredPathResult {
3391
3392use super::*;
3393
3394#[allow(clippy::derive_partial_eq_without_eq)]
3395#[derive(Debug, Default, PartialEq, Clone)]
3396pub struct OperationStatus {
3397 pub oper_status: usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OneOfoper_status,
3398}
3399
3400impl<'a> MessageRead<'a> for OperationStatus {
3401 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3402 let mut msg = Self::default();
3403 while !r.is_eof() {
3404 match r.next_tag(bytes) {
3405 Ok(10) => msg.oper_status = usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_failure(r.read_message::<usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OperationFailure>(bytes)?),
3406 Ok(18) => msg.oper_status = usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_success(r.read_message::<usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OperationSuccess>(bytes)?),
3407 Ok(t) => { r.read_unknown(bytes, t)?; }
3408 Err(e) => return Err(e),
3409 }
3410 }
3411 Ok(msg)
3412 }
3413}
3414
3415impl MessageWrite for OperationStatus {
3416 fn get_size(&self) -> usize {
3417 0
3418 + match self.oper_status {
3419 usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => 1 + sizeof_len((m).get_size()),
3420 usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => 1 + sizeof_len((m).get_size()),
3421 usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OneOfoper_status::None => 0,
3422 } }
3423
3424 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3425 match self.oper_status { usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => { w.write_with_tag(10, |w| w.write_message(m))? },
3426 usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => { w.write_with_tag(18, |w| w.write_message(m))? },
3427 usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OneOfoper_status::None => {},
3428 } Ok(())
3429 }
3430}
3431
3432pub mod mod_OperationStatus {
3433
3434use super::*;
3435
3436#[allow(clippy::derive_partial_eq_without_eq)]
3437#[derive(Debug, Default, PartialEq, Clone)]
3438pub struct OperationFailure {
3439 pub err_code: u32,
3440 pub err_msg: String,
3441}
3442
3443impl<'a> MessageRead<'a> for OperationFailure {
3444 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3445 let mut msg = Self::default();
3446 while !r.is_eof() {
3447 match r.next_tag(bytes) {
3448 Ok(13) => msg.err_code = r.read_fixed32(bytes)?,
3449 Ok(18) => msg.err_msg = r.read_string(bytes)?.to_owned(),
3450 Ok(t) => { r.read_unknown(bytes, t)?; }
3451 Err(e) => return Err(e),
3452 }
3453 }
3454 Ok(msg)
3455 }
3456}
3457
3458impl MessageWrite for OperationFailure {
3459 fn get_size(&self) -> usize {
3460 0
3461 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
3462 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
3463 }
3464
3465 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3466 if self.err_code != 0u32 { w.write_with_tag(13, |w| w.write_fixed32(*&self.err_code))?; }
3467 if self.err_msg != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.err_msg))?; }
3468 Ok(())
3469 }
3470}
3471
3472#[allow(clippy::derive_partial_eq_without_eq)]
3473#[derive(Debug, Default, PartialEq, Clone)]
3474pub struct OperationSuccess {
3475 pub registered_path: String,
3476}
3477
3478impl<'a> MessageRead<'a> for OperationSuccess {
3479 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3480 let mut msg = Self::default();
3481 while !r.is_eof() {
3482 match r.next_tag(bytes) {
3483 Ok(10) => msg.registered_path = r.read_string(bytes)?.to_owned(),
3484 Ok(t) => { r.read_unknown(bytes, t)?; }
3485 Err(e) => return Err(e),
3486 }
3487 }
3488 Ok(msg)
3489 }
3490}
3491
3492impl MessageWrite for OperationSuccess {
3493 fn get_size(&self) -> usize {
3494 0
3495 + if self.registered_path == String::default() { 0 } else { 1 + sizeof_len((&self.registered_path).len()) }
3496 }
3497
3498 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3499 if self.registered_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.registered_path))?; }
3500 Ok(())
3501 }
3502}
3503
3504#[derive(Debug, PartialEq, Clone)]
3505pub enum OneOfoper_status {
3506 oper_failure(usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OperationFailure),
3507 oper_success(usp::mod_RegisterResp::mod_RegisteredPathResult::mod_OperationStatus::OperationSuccess),
3508 None,
3509}
3510
3511impl Default for OneOfoper_status {
3512 fn default() -> Self {
3513 OneOfoper_status::None
3514 }
3515}
3516
3517}
3518
3519}
3520
3521}
3522
3523#[allow(clippy::derive_partial_eq_without_eq)]
3524#[derive(Debug, Default, PartialEq, Clone)]
3525pub struct Deregister {
3526 pub paths: Vec<String>,
3527}
3528
3529impl<'a> MessageRead<'a> for Deregister {
3530 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3531 let mut msg = Self::default();
3532 while !r.is_eof() {
3533 match r.next_tag(bytes) {
3534 Ok(10) => msg.paths.push(r.read_string(bytes)?.to_owned()),
3535 Ok(t) => { r.read_unknown(bytes, t)?; }
3536 Err(e) => return Err(e),
3537 }
3538 }
3539 Ok(msg)
3540 }
3541}
3542
3543impl MessageWrite for Deregister {
3544 fn get_size(&self) -> usize {
3545 0
3546 + self.paths.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
3547 }
3548
3549 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3550 for s in &self.paths { w.write_with_tag(10, |w| w.write_string(&**s))?; }
3551 Ok(())
3552 }
3553}
3554
3555#[allow(clippy::derive_partial_eq_without_eq)]
3556#[derive(Debug, Default, PartialEq, Clone)]
3557pub struct DeregisterResp {
3558 pub deregistered_path_results: Vec<usp::mod_DeregisterResp::DeregisteredPathResult>,
3559}
3560
3561impl<'a> MessageRead<'a> for DeregisterResp {
3562 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3563 let mut msg = Self::default();
3564 while !r.is_eof() {
3565 match r.next_tag(bytes) {
3566 Ok(10) => msg.deregistered_path_results.push(r.read_message::<usp::mod_DeregisterResp::DeregisteredPathResult>(bytes)?),
3567 Ok(t) => { r.read_unknown(bytes, t)?; }
3568 Err(e) => return Err(e),
3569 }
3570 }
3571 Ok(msg)
3572 }
3573}
3574
3575impl MessageWrite for DeregisterResp {
3576 fn get_size(&self) -> usize {
3577 0
3578 + self.deregistered_path_results.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
3579 }
3580
3581 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3582 for s in &self.deregistered_path_results { w.write_with_tag(10, |w| w.write_message(s))?; }
3583 Ok(())
3584 }
3585}
3586
3587pub mod mod_DeregisterResp {
3588
3589use super::*;
3590
3591#[allow(clippy::derive_partial_eq_without_eq)]
3592#[derive(Debug, Default, PartialEq, Clone)]
3593pub struct DeregisteredPathResult {
3594 pub requested_path: String,
3595 pub oper_status: Option<usp::mod_DeregisterResp::mod_DeregisteredPathResult::OperationStatus>,
3596}
3597
3598impl<'a> MessageRead<'a> for DeregisteredPathResult {
3599 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3600 let mut msg = Self::default();
3601 while !r.is_eof() {
3602 match r.next_tag(bytes) {
3603 Ok(10) => msg.requested_path = r.read_string(bytes)?.to_owned(),
3604 Ok(18) => msg.oper_status = Some(r.read_message::<usp::mod_DeregisterResp::mod_DeregisteredPathResult::OperationStatus>(bytes)?),
3605 Ok(t) => { r.read_unknown(bytes, t)?; }
3606 Err(e) => return Err(e),
3607 }
3608 }
3609 Ok(msg)
3610 }
3611}
3612
3613impl MessageWrite for DeregisteredPathResult {
3614 fn get_size(&self) -> usize {
3615 0
3616 + if self.requested_path == String::default() { 0 } else { 1 + sizeof_len((&self.requested_path).len()) }
3617 + self.oper_status.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
3618 }
3619
3620 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3621 if self.requested_path != String::default() { w.write_with_tag(10, |w| w.write_string(&**&self.requested_path))?; }
3622 if let Some(ref s) = self.oper_status { w.write_with_tag(18, |w| w.write_message(s))?; }
3623 Ok(())
3624 }
3625}
3626
3627pub mod mod_DeregisteredPathResult {
3628
3629use super::*;
3630
3631#[allow(clippy::derive_partial_eq_without_eq)]
3632#[derive(Debug, Default, PartialEq, Clone)]
3633pub struct OperationStatus {
3634 pub oper_status: usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OneOfoper_status,
3635}
3636
3637impl<'a> MessageRead<'a> for OperationStatus {
3638 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3639 let mut msg = Self::default();
3640 while !r.is_eof() {
3641 match r.next_tag(bytes) {
3642 Ok(10) => msg.oper_status = usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_failure(r.read_message::<usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OperationFailure>(bytes)?),
3643 Ok(18) => msg.oper_status = usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_success(r.read_message::<usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OperationSuccess>(bytes)?),
3644 Ok(t) => { r.read_unknown(bytes, t)?; }
3645 Err(e) => return Err(e),
3646 }
3647 }
3648 Ok(msg)
3649 }
3650}
3651
3652impl MessageWrite for OperationStatus {
3653 fn get_size(&self) -> usize {
3654 0
3655 + match self.oper_status {
3656 usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => 1 + sizeof_len((m).get_size()),
3657 usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => 1 + sizeof_len((m).get_size()),
3658 usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OneOfoper_status::None => 0,
3659 } }
3660
3661 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3662 match self.oper_status { usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_failure(ref m) => { w.write_with_tag(10, |w| w.write_message(m))? },
3663 usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OneOfoper_status::oper_success(ref m) => { w.write_with_tag(18, |w| w.write_message(m))? },
3664 usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OneOfoper_status::None => {},
3665 } Ok(())
3666 }
3667}
3668
3669pub mod mod_OperationStatus {
3670
3671use super::*;
3672
3673#[allow(clippy::derive_partial_eq_without_eq)]
3674#[derive(Debug, Default, PartialEq, Clone)]
3675pub struct OperationFailure {
3676 pub err_code: u32,
3677 pub err_msg: String,
3678}
3679
3680impl<'a> MessageRead<'a> for OperationFailure {
3681 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3682 let mut msg = Self::default();
3683 while !r.is_eof() {
3684 match r.next_tag(bytes) {
3685 Ok(13) => msg.err_code = r.read_fixed32(bytes)?,
3686 Ok(18) => msg.err_msg = r.read_string(bytes)?.to_owned(),
3687 Ok(t) => { r.read_unknown(bytes, t)?; }
3688 Err(e) => return Err(e),
3689 }
3690 }
3691 Ok(msg)
3692 }
3693}
3694
3695impl MessageWrite for OperationFailure {
3696 fn get_size(&self) -> usize {
3697 0
3698 + if self.err_code == 0u32 { 0 } else { 1 + 4 }
3699 + if self.err_msg == String::default() { 0 } else { 1 + sizeof_len((&self.err_msg).len()) }
3700 }
3701
3702 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3703 if self.err_code != 0u32 { w.write_with_tag(13, |w| w.write_fixed32(*&self.err_code))?; }
3704 if self.err_msg != String::default() { w.write_with_tag(18, |w| w.write_string(&**&self.err_msg))?; }
3705 Ok(())
3706 }
3707}
3708
3709#[allow(clippy::derive_partial_eq_without_eq)]
3710#[derive(Debug, Default, PartialEq, Clone)]
3711pub struct OperationSuccess {
3712 pub deregistered_path: Vec<String>,
3713}
3714
3715impl<'a> MessageRead<'a> for OperationSuccess {
3716 fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self> {
3717 let mut msg = Self::default();
3718 while !r.is_eof() {
3719 match r.next_tag(bytes) {
3720 Ok(10) => msg.deregistered_path.push(r.read_string(bytes)?.to_owned()),
3721 Ok(t) => { r.read_unknown(bytes, t)?; }
3722 Err(e) => return Err(e),
3723 }
3724 }
3725 Ok(msg)
3726 }
3727}
3728
3729impl MessageWrite for OperationSuccess {
3730 fn get_size(&self) -> usize {
3731 0
3732 + self.deregistered_path.iter().map(|s| 1 + sizeof_len((s).len())).sum::<usize>()
3733 }
3734
3735 fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()> {
3736 for s in &self.deregistered_path { w.write_with_tag(10, |w| w.write_string(&**s))?; }
3737 Ok(())
3738 }
3739}
3740
3741#[derive(Debug, PartialEq, Clone)]
3742pub enum OneOfoper_status {
3743 oper_failure(usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OperationFailure),
3744 oper_success(usp::mod_DeregisterResp::mod_DeregisteredPathResult::mod_OperationStatus::OperationSuccess),
3745 None,
3746}
3747
3748impl Default for OneOfoper_status {
3749 fn default() -> Self {
3750 OneOfoper_status::None
3751 }
3752}
3753
3754}
3755
3756}
3757
3758}
3759