errors.rs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. // This file is generated by rust-protobuf 2.22.1. 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 `errors.proto`
  18. /// Generated files are compatible only with the same version
  19. /// of protobuf runtime.
  20. // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_1;
  21. #[derive(PartialEq,Clone,Default)]
  22. pub struct DocError {
  23. // message fields
  24. pub code: ErrorCode,
  25. pub msg: ::std::string::String,
  26. // special fields
  27. pub unknown_fields: ::protobuf::UnknownFields,
  28. pub cached_size: ::protobuf::CachedSize,
  29. }
  30. impl<'a> ::std::default::Default for &'a DocError {
  31. fn default() -> &'a DocError {
  32. <DocError as ::protobuf::Message>::default_instance()
  33. }
  34. }
  35. impl DocError {
  36. pub fn new() -> DocError {
  37. ::std::default::Default::default()
  38. }
  39. // .ErrorCode code = 1;
  40. pub fn get_code(&self) -> ErrorCode {
  41. self.code
  42. }
  43. pub fn clear_code(&mut self) {
  44. self.code = ErrorCode::DocIdInvalid;
  45. }
  46. // Param is passed by value, moved
  47. pub fn set_code(&mut self, v: ErrorCode) {
  48. self.code = v;
  49. }
  50. // string msg = 2;
  51. pub fn get_msg(&self) -> &str {
  52. &self.msg
  53. }
  54. pub fn clear_msg(&mut self) {
  55. self.msg.clear();
  56. }
  57. // Param is passed by value, moved
  58. pub fn set_msg(&mut self, v: ::std::string::String) {
  59. self.msg = v;
  60. }
  61. // Mutable pointer to the field.
  62. // If field is not initialized, it is initialized with default value first.
  63. pub fn mut_msg(&mut self) -> &mut ::std::string::String {
  64. &mut self.msg
  65. }
  66. // Take field
  67. pub fn take_msg(&mut self) -> ::std::string::String {
  68. ::std::mem::replace(&mut self.msg, ::std::string::String::new())
  69. }
  70. }
  71. impl ::protobuf::Message for DocError {
  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_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.code, 1, &mut self.unknown_fields)?
  81. },
  82. 2 => {
  83. ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.msg)?;
  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.code != ErrorCode::DocIdInvalid {
  97. my_size += ::protobuf::rt::enum_size(1, self.code);
  98. }
  99. if !self.msg.is_empty() {
  100. my_size += ::protobuf::rt::string_size(2, &self.msg);
  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.code != ErrorCode::DocIdInvalid {
  108. os.write_enum(1, ::protobuf::ProtobufEnum::value(&self.code))?;
  109. }
  110. if !self.msg.is_empty() {
  111. os.write_string(2, &self.msg)?;
  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() -> DocError {
  138. DocError::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::ProtobufTypeEnum<ErrorCode>>(
  145. "code",
  146. |m: &DocError| { &m.code },
  147. |m: &mut DocError| { &mut m.code },
  148. ));
  149. fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
  150. "msg",
  151. |m: &DocError| { &m.msg },
  152. |m: &mut DocError| { &mut m.msg },
  153. ));
  154. ::protobuf::reflect::MessageDescriptor::new_pb_name::<DocError>(
  155. "DocError",
  156. fields,
  157. file_descriptor_proto()
  158. )
  159. })
  160. }
  161. fn default_instance() -> &'static DocError {
  162. static instance: ::protobuf::rt::LazyV2<DocError> = ::protobuf::rt::LazyV2::INIT;
  163. instance.get(DocError::new)
  164. }
  165. }
  166. impl ::protobuf::Clear for DocError {
  167. fn clear(&mut self) {
  168. self.code = ErrorCode::DocIdInvalid;
  169. self.msg.clear();
  170. self.unknown_fields.clear();
  171. }
  172. }
  173. impl ::std::fmt::Debug for DocError {
  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 DocError {
  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 ErrorCode {
  185. DocIdInvalid = 0,
  186. DocNotfound = 1,
  187. WsConnectError = 10,
  188. UndoFail = 200,
  189. RedoFail = 201,
  190. OutOfBound = 202,
  191. UserUnauthorized = 999,
  192. InternalError = 1000,
  193. }
  194. impl ::protobuf::ProtobufEnum for ErrorCode {
  195. fn value(&self) -> i32 {
  196. *self as i32
  197. }
  198. fn from_i32(value: i32) -> ::std::option::Option<ErrorCode> {
  199. match value {
  200. 0 => ::std::option::Option::Some(ErrorCode::DocIdInvalid),
  201. 1 => ::std::option::Option::Some(ErrorCode::DocNotfound),
  202. 10 => ::std::option::Option::Some(ErrorCode::WsConnectError),
  203. 200 => ::std::option::Option::Some(ErrorCode::UndoFail),
  204. 201 => ::std::option::Option::Some(ErrorCode::RedoFail),
  205. 202 => ::std::option::Option::Some(ErrorCode::OutOfBound),
  206. 999 => ::std::option::Option::Some(ErrorCode::UserUnauthorized),
  207. 1000 => ::std::option::Option::Some(ErrorCode::InternalError),
  208. _ => ::std::option::Option::None
  209. }
  210. }
  211. fn values() -> &'static [Self] {
  212. static values: &'static [ErrorCode] = &[
  213. ErrorCode::DocIdInvalid,
  214. ErrorCode::DocNotfound,
  215. ErrorCode::WsConnectError,
  216. ErrorCode::UndoFail,
  217. ErrorCode::RedoFail,
  218. ErrorCode::OutOfBound,
  219. ErrorCode::UserUnauthorized,
  220. ErrorCode::InternalError,
  221. ];
  222. values
  223. }
  224. fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
  225. static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT;
  226. descriptor.get(|| {
  227. ::protobuf::reflect::EnumDescriptor::new_pb_name::<ErrorCode>("ErrorCode", file_descriptor_proto())
  228. })
  229. }
  230. }
  231. impl ::std::marker::Copy for ErrorCode {
  232. }
  233. impl ::std::default::Default for ErrorCode {
  234. fn default() -> Self {
  235. ErrorCode::DocIdInvalid
  236. }
  237. }
  238. impl ::protobuf::reflect::ProtobufValue for ErrorCode {
  239. fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
  240. ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
  241. }
  242. }
  243. static file_descriptor_proto_data: &'static [u8] = b"\
  244. \n\x0cerrors.proto\"<\n\x08DocError\x12\x1e\n\x04code\x18\x01\x20\x01(\
  245. \x0e2\n.ErrorCodeR\x04code\x12\x10\n\x03msg\x18\x02\x20\x01(\tR\x03msg*\
  246. \x9c\x01\n\tErrorCode\x12\x10\n\x0cDocIdInvalid\x10\0\x12\x0f\n\x0bDocNo\
  247. tfound\x10\x01\x12\x12\n\x0eWsConnectError\x10\n\x12\r\n\x08UndoFail\x10\
  248. \xc8\x01\x12\r\n\x08RedoFail\x10\xc9\x01\x12\x0f\n\nOutOfBound\x10\xca\
  249. \x01\x12\x15\n\x10UserUnauthorized\x10\xe7\x07\x12\x12\n\rInternalError\
  250. \x10\xe8\x07J\xf8\x03\n\x06\x12\x04\0\0\x0f\x01\n\x08\n\x01\x0c\x12\x03\
  251. \0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\n\x03\x04\0\x01\x12\
  252. \x03\x02\x08\x10\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x17\n\x0c\n\x05\
  253. \x04\0\x02\0\x06\x12\x03\x03\x04\r\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\
  254. \x03\x0e\x12\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x15\x16\n\x0b\n\x04\
  255. \x04\0\x02\x01\x12\x03\x04\x04\x13\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\
  256. \x04\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0b\x0e\n\x0c\n\x05\
  257. \x04\0\x02\x01\x03\x12\x03\x04\x11\x12\n\n\n\x02\x05\0\x12\x04\x06\0\x0f\
  258. \x01\n\n\n\x03\x05\0\x01\x12\x03\x06\x05\x0e\n\x0b\n\x04\x05\0\x02\0\x12\
  259. \x03\x07\x04\x15\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x07\x04\x10\n\x0c\n\
  260. \x05\x05\0\x02\0\x02\x12\x03\x07\x13\x14\n\x0b\n\x04\x05\0\x02\x01\x12\
  261. \x03\x08\x04\x14\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x08\x04\x0f\n\x0c\
  262. \n\x05\x05\0\x02\x01\x02\x12\x03\x08\x12\x13\n\x0b\n\x04\x05\0\x02\x02\
  263. \x12\x03\t\x04\x18\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\t\x04\x12\n\x0c\
  264. \n\x05\x05\0\x02\x02\x02\x12\x03\t\x15\x17\n\x0b\n\x04\x05\0\x02\x03\x12\
  265. \x03\n\x04\x13\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03\n\x04\x0c\n\x0c\n\
  266. \x05\x05\0\x02\x03\x02\x12\x03\n\x0f\x12\n\x0b\n\x04\x05\0\x02\x04\x12\
  267. \x03\x0b\x04\x13\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03\x0b\x04\x0c\n\x0c\
  268. \n\x05\x05\0\x02\x04\x02\x12\x03\x0b\x0f\x12\n\x0b\n\x04\x05\0\x02\x05\
  269. \x12\x03\x0c\x04\x15\n\x0c\n\x05\x05\0\x02\x05\x01\x12\x03\x0c\x04\x0e\n\
  270. \x0c\n\x05\x05\0\x02\x05\x02\x12\x03\x0c\x11\x14\n\x0b\n\x04\x05\0\x02\
  271. \x06\x12\x03\r\x04\x1b\n\x0c\n\x05\x05\0\x02\x06\x01\x12\x03\r\x04\x14\n\
  272. \x0c\n\x05\x05\0\x02\x06\x02\x12\x03\r\x17\x1a\n\x0b\n\x04\x05\0\x02\x07\
  273. \x12\x03\x0e\x04\x19\n\x0c\n\x05\x05\0\x02\x07\x01\x12\x03\x0e\x04\x11\n\
  274. \x0c\n\x05\x05\0\x02\x07\x02\x12\x03\x0e\x14\x18b\x06proto3\
  275. ";
  276. static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
  277. fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
  278. ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
  279. }
  280. pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
  281. file_descriptor_proto_lazy.get(|| {
  282. parse_descriptor_proto()
  283. })
  284. }