network_state.rs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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 `network_state.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 NetworkState {
  23. // message fields
  24. pub ty: NetworkType,
  25. // special fields
  26. pub unknown_fields: ::protobuf::UnknownFields,
  27. pub cached_size: ::protobuf::CachedSize,
  28. }
  29. impl<'a> ::std::default::Default for &'a NetworkState {
  30. fn default() -> &'a NetworkState {
  31. <NetworkState as ::protobuf::Message>::default_instance()
  32. }
  33. }
  34. impl NetworkState {
  35. pub fn new() -> NetworkState {
  36. ::std::default::Default::default()
  37. }
  38. // .NetworkType ty = 1;
  39. pub fn get_ty(&self) -> NetworkType {
  40. self.ty
  41. }
  42. pub fn clear_ty(&mut self) {
  43. self.ty = NetworkType::UnknownNetworkType;
  44. }
  45. // Param is passed by value, moved
  46. pub fn set_ty(&mut self, v: NetworkType) {
  47. self.ty = v;
  48. }
  49. }
  50. impl ::protobuf::Message for NetworkState {
  51. fn is_initialized(&self) -> bool {
  52. true
  53. }
  54. fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  55. while !is.eof()? {
  56. let (field_number, wire_type) = is.read_tag_unpack()?;
  57. match field_number {
  58. 1 => {
  59. ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.ty, 1, &mut self.unknown_fields)?
  60. },
  61. _ => {
  62. ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
  63. },
  64. };
  65. }
  66. ::std::result::Result::Ok(())
  67. }
  68. // Compute sizes of nested messages
  69. #[allow(unused_variables)]
  70. fn compute_size(&self) -> u32 {
  71. let mut my_size = 0;
  72. if self.ty != NetworkType::UnknownNetworkType {
  73. my_size += ::protobuf::rt::enum_size(1, self.ty);
  74. }
  75. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  76. self.cached_size.set(my_size);
  77. my_size
  78. }
  79. fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  80. if self.ty != NetworkType::UnknownNetworkType {
  81. os.write_enum(1, ::protobuf::ProtobufEnum::value(&self.ty))?;
  82. }
  83. os.write_unknown_fields(self.get_unknown_fields())?;
  84. ::std::result::Result::Ok(())
  85. }
  86. fn get_cached_size(&self) -> u32 {
  87. self.cached_size.get()
  88. }
  89. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  90. &self.unknown_fields
  91. }
  92. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  93. &mut self.unknown_fields
  94. }
  95. fn as_any(&self) -> &dyn (::std::any::Any) {
  96. self as &dyn (::std::any::Any)
  97. }
  98. fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
  99. self as &mut dyn (::std::any::Any)
  100. }
  101. fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
  102. self
  103. }
  104. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  105. Self::descriptor_static()
  106. }
  107. fn new() -> NetworkState {
  108. NetworkState::new()
  109. }
  110. fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
  111. static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
  112. descriptor.get(|| {
  113. let mut fields = ::std::vec::Vec::new();
  114. fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<NetworkType>>(
  115. "ty",
  116. |m: &NetworkState| { &m.ty },
  117. |m: &mut NetworkState| { &mut m.ty },
  118. ));
  119. ::protobuf::reflect::MessageDescriptor::new_pb_name::<NetworkState>(
  120. "NetworkState",
  121. fields,
  122. file_descriptor_proto()
  123. )
  124. })
  125. }
  126. fn default_instance() -> &'static NetworkState {
  127. static instance: ::protobuf::rt::LazyV2<NetworkState> = ::protobuf::rt::LazyV2::INIT;
  128. instance.get(NetworkState::new)
  129. }
  130. }
  131. impl ::protobuf::Clear for NetworkState {
  132. fn clear(&mut self) {
  133. self.ty = NetworkType::UnknownNetworkType;
  134. self.unknown_fields.clear();
  135. }
  136. }
  137. impl ::std::fmt::Debug for NetworkState {
  138. fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
  139. ::protobuf::text_format::fmt(self, f)
  140. }
  141. }
  142. impl ::protobuf::reflect::ProtobufValue for NetworkState {
  143. fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
  144. ::protobuf::reflect::ReflectValueRef::Message(self)
  145. }
  146. }
  147. #[derive(Clone,PartialEq,Eq,Debug,Hash)]
  148. pub enum NetworkType {
  149. UnknownNetworkType = 0,
  150. Wifi = 1,
  151. Cell = 2,
  152. Ethernet = 3,
  153. }
  154. impl ::protobuf::ProtobufEnum for NetworkType {
  155. fn value(&self) -> i32 {
  156. *self as i32
  157. }
  158. fn from_i32(value: i32) -> ::std::option::Option<NetworkType> {
  159. match value {
  160. 0 => ::std::option::Option::Some(NetworkType::UnknownNetworkType),
  161. 1 => ::std::option::Option::Some(NetworkType::Wifi),
  162. 2 => ::std::option::Option::Some(NetworkType::Cell),
  163. 3 => ::std::option::Option::Some(NetworkType::Ethernet),
  164. _ => ::std::option::Option::None
  165. }
  166. }
  167. fn values() -> &'static [Self] {
  168. static values: &'static [NetworkType] = &[
  169. NetworkType::UnknownNetworkType,
  170. NetworkType::Wifi,
  171. NetworkType::Cell,
  172. NetworkType::Ethernet,
  173. ];
  174. values
  175. }
  176. fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
  177. static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT;
  178. descriptor.get(|| {
  179. ::protobuf::reflect::EnumDescriptor::new_pb_name::<NetworkType>("NetworkType", file_descriptor_proto())
  180. })
  181. }
  182. }
  183. impl ::std::marker::Copy for NetworkType {
  184. }
  185. impl ::std::default::Default for NetworkType {
  186. fn default() -> Self {
  187. NetworkType::UnknownNetworkType
  188. }
  189. }
  190. impl ::protobuf::reflect::ProtobufValue for NetworkType {
  191. fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
  192. ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
  193. }
  194. }
  195. static file_descriptor_proto_data: &'static [u8] = b"\
  196. \n\x13network_state.proto\",\n\x0cNetworkState\x12\x1c\n\x02ty\x18\x01\
  197. \x20\x01(\x0e2\x0c.NetworkTypeR\x02ty*G\n\x0bNetworkType\x12\x16\n\x12Un\
  198. knownNetworkType\x10\0\x12\x08\n\x04Wifi\x10\x01\x12\x08\n\x04Cell\x10\
  199. \x02\x12\x0c\n\x08Ethernet\x10\x03b\x06proto3\
  200. ";
  201. static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
  202. fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
  203. ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
  204. }
  205. pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
  206. file_descriptor_proto_lazy.get(|| {
  207. parse_descriptor_proto()
  208. })
  209. }