ffi_response.rs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. // This file is generated by rust-protobuf 2.25.2. Do not edit
  2. // @generated
  3. // https://github.com/rust-lang/rust-clippy/issues/702
  4. #![allow(unknown_lints)]
  5. #![allow(clippy::all)]
  6. #![allow(unused_attributes)]
  7. #![cfg_attr(rustfmt, rustfmt::skip)]
  8. #![allow(box_pointers)]
  9. #![allow(dead_code)]
  10. #![allow(missing_docs)]
  11. #![allow(non_camel_case_types)]
  12. #![allow(non_snake_case)]
  13. #![allow(non_upper_case_globals)]
  14. #![allow(trivial_casts)]
  15. #![allow(unused_imports)]
  16. #![allow(unused_results)]
  17. //! Generated file from `ffi_response.proto`
  18. /// Generated files are compatible only with the same version
  19. /// of protobuf runtime.
  20. // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_25_2;
  21. #[derive(PartialEq,Clone,Default)]
  22. pub struct FFIResponse {
  23. // message fields
  24. pub payload: ::std::vec::Vec<u8>,
  25. pub code: FFIStatusCode,
  26. // special fields
  27. pub unknown_fields: ::protobuf::UnknownFields,
  28. pub cached_size: ::protobuf::CachedSize,
  29. }
  30. impl<'a> ::std::default::Default for &'a FFIResponse {
  31. fn default() -> &'a FFIResponse {
  32. <FFIResponse as ::protobuf::Message>::default_instance()
  33. }
  34. }
  35. impl FFIResponse {
  36. pub fn new() -> FFIResponse {
  37. ::std::default::Default::default()
  38. }
  39. // bytes payload = 1;
  40. pub fn get_payload(&self) -> &[u8] {
  41. &self.payload
  42. }
  43. pub fn clear_payload(&mut self) {
  44. self.payload.clear();
  45. }
  46. // Param is passed by value, moved
  47. pub fn set_payload(&mut self, v: ::std::vec::Vec<u8>) {
  48. self.payload = v;
  49. }
  50. // Mutable pointer to the field.
  51. // If field is not initialized, it is initialized with default value first.
  52. pub fn mut_payload(&mut self) -> &mut ::std::vec::Vec<u8> {
  53. &mut self.payload
  54. }
  55. // Take field
  56. pub fn take_payload(&mut self) -> ::std::vec::Vec<u8> {
  57. ::std::mem::replace(&mut self.payload, ::std::vec::Vec::new())
  58. }
  59. // .FFIStatusCode code = 2;
  60. pub fn get_code(&self) -> FFIStatusCode {
  61. self.code
  62. }
  63. pub fn clear_code(&mut self) {
  64. self.code = FFIStatusCode::Ok;
  65. }
  66. // Param is passed by value, moved
  67. pub fn set_code(&mut self, v: FFIStatusCode) {
  68. self.code = v;
  69. }
  70. }
  71. impl ::protobuf::Message for FFIResponse {
  72. fn is_initialized(&self) -> bool {
  73. true
  74. }
  75. fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  76. while !is.eof()? {
  77. let (field_number, wire_type) = is.read_tag_unpack()?;
  78. match field_number {
  79. 1 => {
  80. ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.payload)?;
  81. },
  82. 2 => {
  83. ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.code, 2, &mut self.unknown_fields)?
  84. },
  85. _ => {
  86. ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
  87. },
  88. };
  89. }
  90. ::std::result::Result::Ok(())
  91. }
  92. // Compute sizes of nested messages
  93. #[allow(unused_variables)]
  94. fn compute_size(&self) -> u32 {
  95. let mut my_size = 0;
  96. if !self.payload.is_empty() {
  97. my_size += ::protobuf::rt::bytes_size(1, &self.payload);
  98. }
  99. if self.code != FFIStatusCode::Ok {
  100. my_size += ::protobuf::rt::enum_size(2, self.code);
  101. }
  102. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  103. self.cached_size.set(my_size);
  104. my_size
  105. }
  106. fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  107. if !self.payload.is_empty() {
  108. os.write_bytes(1, &self.payload)?;
  109. }
  110. if self.code != FFIStatusCode::Ok {
  111. os.write_enum(2, ::protobuf::ProtobufEnum::value(&self.code))?;
  112. }
  113. os.write_unknown_fields(self.get_unknown_fields())?;
  114. ::std::result::Result::Ok(())
  115. }
  116. fn get_cached_size(&self) -> u32 {
  117. self.cached_size.get()
  118. }
  119. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  120. &self.unknown_fields
  121. }
  122. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  123. &mut self.unknown_fields
  124. }
  125. fn as_any(&self) -> &dyn (::std::any::Any) {
  126. self as &dyn (::std::any::Any)
  127. }
  128. fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
  129. self as &mut dyn (::std::any::Any)
  130. }
  131. fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
  132. self
  133. }
  134. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  135. Self::descriptor_static()
  136. }
  137. fn new() -> FFIResponse {
  138. FFIResponse::new()
  139. }
  140. fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
  141. static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
  142. descriptor.get(|| {
  143. let mut fields = ::std::vec::Vec::new();
  144. fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
  145. "payload",
  146. |m: &FFIResponse| { &m.payload },
  147. |m: &mut FFIResponse| { &mut m.payload },
  148. ));
  149. fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<FFIStatusCode>>(
  150. "code",
  151. |m: &FFIResponse| { &m.code },
  152. |m: &mut FFIResponse| { &mut m.code },
  153. ));
  154. ::protobuf::reflect::MessageDescriptor::new_pb_name::<FFIResponse>(
  155. "FFIResponse",
  156. fields,
  157. file_descriptor_proto()
  158. )
  159. })
  160. }
  161. fn default_instance() -> &'static FFIResponse {
  162. static instance: ::protobuf::rt::LazyV2<FFIResponse> = ::protobuf::rt::LazyV2::INIT;
  163. instance.get(FFIResponse::new)
  164. }
  165. }
  166. impl ::protobuf::Clear for FFIResponse {
  167. fn clear(&mut self) {
  168. self.payload.clear();
  169. self.code = FFIStatusCode::Ok;
  170. self.unknown_fields.clear();
  171. }
  172. }
  173. impl ::std::fmt::Debug for FFIResponse {
  174. fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
  175. ::protobuf::text_format::fmt(self, f)
  176. }
  177. }
  178. impl ::protobuf::reflect::ProtobufValue for FFIResponse {
  179. fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
  180. ::protobuf::reflect::ReflectValueRef::Message(self)
  181. }
  182. }
  183. #[derive(Clone,PartialEq,Eq,Debug,Hash)]
  184. pub enum FFIStatusCode {
  185. Ok = 0,
  186. Err = 1,
  187. Internal = 2,
  188. }
  189. impl ::protobuf::ProtobufEnum for FFIStatusCode {
  190. fn value(&self) -> i32 {
  191. *self as i32
  192. }
  193. fn from_i32(value: i32) -> ::std::option::Option<FFIStatusCode> {
  194. match value {
  195. 0 => ::std::option::Option::Some(FFIStatusCode::Ok),
  196. 1 => ::std::option::Option::Some(FFIStatusCode::Err),
  197. 2 => ::std::option::Option::Some(FFIStatusCode::Internal),
  198. _ => ::std::option::Option::None
  199. }
  200. }
  201. fn values() -> &'static [Self] {
  202. static values: &'static [FFIStatusCode] = &[
  203. FFIStatusCode::Ok,
  204. FFIStatusCode::Err,
  205. FFIStatusCode::Internal,
  206. ];
  207. values
  208. }
  209. fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
  210. static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT;
  211. descriptor.get(|| {
  212. ::protobuf::reflect::EnumDescriptor::new_pb_name::<FFIStatusCode>("FFIStatusCode", file_descriptor_proto())
  213. })
  214. }
  215. }
  216. impl ::std::marker::Copy for FFIStatusCode {
  217. }
  218. impl ::std::default::Default for FFIStatusCode {
  219. fn default() -> Self {
  220. FFIStatusCode::Ok
  221. }
  222. }
  223. impl ::protobuf::reflect::ProtobufValue for FFIStatusCode {
  224. fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
  225. ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
  226. }
  227. }
  228. static file_descriptor_proto_data: &'static [u8] = b"\
  229. \n\x12ffi_response.proto\"K\n\x0bFFIResponse\x12\x18\n\x07payload\x18\
  230. \x01\x20\x01(\x0cR\x07payload\x12\"\n\x04code\x18\x02\x20\x01(\x0e2\x0e.\
  231. FFIStatusCodeR\x04code*.\n\rFFIStatusCode\x12\x06\n\x02Ok\x10\0\x12\x07\
  232. \n\x03Err\x10\x01\x12\x0c\n\x08Internal\x10\x02b\x06proto3\
  233. ";
  234. static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
  235. fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
  236. ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
  237. }
  238. pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
  239. file_descriptor_proto_lazy.get(|| {
  240. parse_descriptor_proto()
  241. })
  242. }