// Automatically generated rust module for 'test.proto' file #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(unused_imports)] #![allow(unknown_lints)] #![allow(clippy::all)] #![cfg_attr(rustfmt, rustfmt_skip)] use quick_protobuf::{MessageInfo, MessageRead, MessageWrite, BytesReader, Writer, WriterBackend, Result}; use quick_protobuf::sizeofs::*; use super::*; #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, Default, PartialEq, Clone)] pub struct Message { pub data: Vec, } impl<'a> MessageRead<'a> for Message { fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result { let mut msg = Self::default(); while !r.is_eof() { match r.next_tag(bytes) { Ok(10) => msg.data = r.read_bytes(bytes)?.to_owned(), Ok(t) => { r.read_unknown(bytes, t)?; } Err(e) => return Err(e), } } Ok(msg) } } impl MessageWrite for Message { fn get_size(&self) -> usize { 0 + if self.data.is_empty() { 0 } else { 1 + sizeof_len((&self.data).len()) } } fn write_message(&self, w: &mut Writer) -> Result<()> { if !self.data.is_empty() { w.write_with_tag(10, |w| w.write_bytes(&**&self.data))?; } Ok(()) } }