From 4186bb6c61bd95185f6427e498787dd5c7f392e8 Mon Sep 17 00:00:00 2001 From: Bruno Tavares Date: Wed, 22 Jan 2020 19:59:02 -0300 Subject: [PATCH] Update schema proto file This commit updates the schema protocol to use the latest version present on [mafintosh/simple-hypercore-protocol](https://github.com/mafintosh/simple-hypercore-protocol/blob/d577298a47479630d0e340190273db4a22d3c793/schema.proto). This includes the NOISE protocol handshake as part of the file, and it is not backward compatible with DAT <= 7. Due to that, a major bump has been proposed. It uses a simplified single file/single namespace proposal, to help to keep it up to date instead of checking multiple files to see if the fields are updated, which could be split if needed. --- README.md | 2 + build.rs | 28 +- protos/cancel.proto | 5 - protos/data.proto | 12 - protos/feed.proto | 4 - protos/handshake.proto | 8 - protos/have.proto | 5 - protos/info.proto | 4 - protos/lib.proto | 87 ++ protos/request.proto | 6 - protos/unhave.proto | 4 - protos/unwant.proto | 4 - protos/want.proto | 4 - src/cancel.rs | 297 ---- src/data.rs | 641 -------- src/feed.rs | 283 ---- src/handshake.rs | 362 ----- src/have.rs | 310 ---- src/info.rs | 255 ---- src/lib.rs | 3140 +++++++++++++++++++++++++++++++++++++++- src/request.rs | 337 ----- src/unhave.rs | 258 ---- src/unwant.rs | 258 ---- src/want.rs | 257 ---- 24 files changed, 3219 insertions(+), 3352 deletions(-) delete mode 100644 protos/cancel.proto delete mode 100644 protos/data.proto delete mode 100644 protos/feed.proto delete mode 100644 protos/handshake.proto delete mode 100644 protos/have.proto delete mode 100644 protos/info.proto create mode 100644 protos/lib.proto delete mode 100644 protos/request.proto delete mode 100644 protos/unhave.proto delete mode 100644 protos/unwant.proto delete mode 100644 protos/want.proto delete mode 100644 src/cancel.rs delete mode 100644 src/data.rs delete mode 100644 src/feed.rs delete mode 100644 src/handshake.rs delete mode 100644 src/have.rs delete mode 100644 src/info.rs delete mode 100644 src/request.rs delete mode 100644 src/unhave.rs delete mode 100644 src/unwant.rs delete mode 100644 src/want.rs diff --git a/README.md b/README.md index f7f243a..86808d5 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Dat Network Protocol protobuf definitions. +Includes a Noise handshake, and is not backwards compatible with Hypercore <= 7 + ## Installation ```sh $ cargo add dat-network-protocol diff --git a/build.rs b/build.rs index 3263ccb..6dd84e5 100644 --- a/build.rs +++ b/build.rs @@ -1,24 +1,12 @@ // Uncomment method below for like local builds. fn main() -> Result<(), Box> { - // protobuf_codegen_pure::run(protobuf_codegen_pure::Args { - // out_dir: "src", - // input: &[ - // "protos/cancel.proto", - // "protos/data.proto", - // "protos/data.proto", - // "protos/feed.proto", - // "protos/handshake.proto", - // "protos/have.proto", - // "protos/info.proto", - // "protos/request.proto", - // "protos/unhave.proto", - // "protos/unwant.proto", - // "protos/want.proto", - // ], - // customize: protobuf_codegen_pure::Customize { - // ..Default::default() - // }, - // includes: &["protos"], - // })?; + // protobuf_codegen_pure::run(protobuf_codegen_pure::Args { + // out_dir: "src", + // input: &["protos/lib.proto"], + // customize: protobuf_codegen_pure::Customize { + // ..Default::default() + // }, + // includes: &["protos"], + // })?; Ok(()) } diff --git a/protos/cancel.proto b/protos/cancel.proto deleted file mode 100644 index 7c6809f..0000000 --- a/protos/cancel.proto +++ /dev/null @@ -1,5 +0,0 @@ -message Cancel { - required uint64 index = 1; - optional uint64 bytes = 2; - optional bool hash = 3; -} \ No newline at end of file diff --git a/protos/data.proto b/protos/data.proto deleted file mode 100644 index 9e0c033..0000000 --- a/protos/data.proto +++ /dev/null @@ -1,12 +0,0 @@ -message Data { - required uint64 index = 1; - optional bytes value = 2; - repeated Node nodes = 3; - optional bytes signature = 4; - - message Node { - required uint64 index = 1; - required bytes hash = 2; - required uint64 size = 3; - } -} \ No newline at end of file diff --git a/protos/feed.proto b/protos/feed.proto deleted file mode 100644 index d4da012..0000000 --- a/protos/feed.proto +++ /dev/null @@ -1,4 +0,0 @@ -message Feed { - required bytes discoveryKey = 1; - optional bytes nonce = 2; -} diff --git a/protos/handshake.proto b/protos/handshake.proto deleted file mode 100644 index 7fcdb68..0000000 --- a/protos/handshake.proto +++ /dev/null @@ -1,8 +0,0 @@ -syntax = "proto2"; - -message Handshake { - optional bytes id = 1; - optional bool live = 2; - optional bytes userData = 3; - repeated string extensions = 4; -} diff --git a/protos/have.proto b/protos/have.proto deleted file mode 100644 index fe44785..0000000 --- a/protos/have.proto +++ /dev/null @@ -1,5 +0,0 @@ -message Have { - required uint64 start = 1; - optional uint64 length = 2 [default = 1]; - optional bytes bitfield = 3; -} \ No newline at end of file diff --git a/protos/info.proto b/protos/info.proto deleted file mode 100644 index e304274..0000000 --- a/protos/info.proto +++ /dev/null @@ -1,4 +0,0 @@ -message Info { - optional bool uploading = 1; - optional bool downloading = 2; -} \ No newline at end of file diff --git a/protos/lib.proto b/protos/lib.proto new file mode 100644 index 0000000..4da18e0 --- /dev/null +++ b/protos/lib.proto @@ -0,0 +1,87 @@ +syntax = "proto2"; + +// Sent as part of the noise protocol. +message NoisePayload { + required bytes nonce = 1; +} + +// type=0 +message Open { + required bytes discoveryKey = 1; + optional bytes capability = 2; +} + +// type=1, overall feed options. can be sent multiple times +message Options { + repeated string extensions = 1; // Should be sorted lexicographically + optional bool ack = 2; // Should all blocks be explicitly acknowledged? +} + +// type=2, message indicating state changes etc. +// initial state for uploading/downloading is true +message Status { + optional bool uploading = 1; + optional bool downloading = 2; +} + +// type=3, what do we have? +message Have { + required uint64 start = 1; + optional uint64 length = 2 [default = 1]; // defaults to 1 + optional bytes bitfield = 3; + optional bool ack = 4; // when true, this Have message is an acknowledgement +} + +// type=4, what did we lose? +message Unhave { + required uint64 start = 1; + optional uint64 length = 2 [default = 1]; // defaults to 1 +} + +// type=5, what do we want? remote should start sending have messages in this range +message Want { + required uint64 start = 1; + optional uint64 length = 2; // defaults to Infinity or feed.length (if not live) +} + +// type=6, what don't we want anymore? +message Unwant { + required uint64 start = 1; + optional uint64 length = 2; // defaults to Infinity or feed.length (if not live) +} + +// type=7, ask for data +message Request { + required uint64 index = 1; + optional uint64 bytes = 2; + optional bool hash = 3; + optional uint64 nodes = 4; +} + +// type=8, cancel a request +message Cancel { + required uint64 index = 1; + optional uint64 bytes = 2; + optional bool hash = 3; +} + +// type=9, get some data +message Data { + message Node { + required uint64 index = 1; + required bytes hash = 2; + required uint64 size = 3; + } + + required uint64 index = 1; + optional bytes value = 2; + repeated Node nodes = 3; + optional bytes signature = 4; +} + +// type=10, explicitly close a channel. +message Close { + optional bytes discoveryKey = 1; // only send this if you did not do an open +} + +// type=15, extension message \ No newline at end of file diff --git a/protos/request.proto b/protos/request.proto deleted file mode 100644 index 813b4a0..0000000 --- a/protos/request.proto +++ /dev/null @@ -1,6 +0,0 @@ -message Request { - required uint64 index = 1; - optional uint64 bytes = 2; - optional bool hash = 3; - optional uint64 nodes = 4; -} \ No newline at end of file diff --git a/protos/unhave.proto b/protos/unhave.proto deleted file mode 100644 index 949e096..0000000 --- a/protos/unhave.proto +++ /dev/null @@ -1,4 +0,0 @@ -message Unhave { - required uint64 start = 1; - optional uint64 length = 2 [default = 1]; -} \ No newline at end of file diff --git a/protos/unwant.proto b/protos/unwant.proto deleted file mode 100644 index 0b9fee9..0000000 --- a/protos/unwant.proto +++ /dev/null @@ -1,4 +0,0 @@ -message Unwant { - required uint64 start = 1; - optional uint64 length = 2; -} \ No newline at end of file diff --git a/protos/want.proto b/protos/want.proto deleted file mode 100644 index 3ea3a69..0000000 --- a/protos/want.proto +++ /dev/null @@ -1,4 +0,0 @@ -message Want { - required uint64 start = 1; - optional uint64 length = 2; -} diff --git a/src/cancel.rs b/src/cancel.rs deleted file mode 100644 index 4e6bd9a..0000000 --- a/src/cancel.rs +++ /dev/null @@ -1,297 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `cancel.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Cancel { - // message fields - index: ::std::option::Option, - bytes: ::std::option::Option, - hash: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Cancel { - fn default() -> &'a Cancel { - ::default_instance() - } -} - -impl Cancel { - pub fn new() -> Cancel { - ::std::default::Default::default() - } - - // required uint64 index = 1; - - - pub fn get_index(&self) -> u64 { - self.index.unwrap_or(0) - } - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u64) { - self.index = ::std::option::Option::Some(v); - } - - // optional uint64 bytes = 2; - - - pub fn get_bytes(&self) -> u64 { - self.bytes.unwrap_or(0) - } - pub fn clear_bytes(&mut self) { - self.bytes = ::std::option::Option::None; - } - - pub fn has_bytes(&self) -> bool { - self.bytes.is_some() - } - - // Param is passed by value, moved - pub fn set_bytes(&mut self, v: u64) { - self.bytes = ::std::option::Option::Some(v); - } - - // optional bool hash = 3; - - - pub fn get_hash(&self) -> bool { - self.hash.unwrap_or(false) - } - pub fn clear_hash(&mut self) { - self.hash = ::std::option::Option::None; - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: bool) { - self.hash = ::std::option::Option::Some(v); - } -} - -impl ::protobuf::Message for Cancel { - fn is_initialized(&self) -> bool { - if self.index.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.index = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.bytes = ::std::option::Option::Some(tmp); - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.hash = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.index { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.bytes { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.hash { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.index { - os.write_uint64(1, v)?; - } - if let Some(v) = self.bytes { - os.write_uint64(2, v)?; - } - if let Some(v) = self.hash { - os.write_bool(3, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Cancel { - Cancel::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - |m: &Cancel| { &m.index }, - |m: &mut Cancel| { &mut m.index }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "bytes", - |m: &Cancel| { &m.bytes }, - |m: &mut Cancel| { &mut m.bytes }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "hash", - |m: &Cancel| { &m.hash }, - |m: &mut Cancel| { &mut m.hash }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Cancel", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Cancel { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Cancel, - }; - unsafe { - instance.get(Cancel::new) - } - } -} - -impl ::protobuf::Clear for Cancel { - fn clear(&mut self) { - self.index = ::std::option::Option::None; - self.bytes = ::std::option::Option::None; - self.hash = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Cancel { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Cancel { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0ccancel.proto\x12\0\"<\n\x06Cancel\x12\x0f\n\x05index\x18\x01\x20\ - \x02(\x04B\0\x12\x0f\n\x05bytes\x18\x02\x20\x01(\x04B\0\x12\x0e\n\x04has\ - h\x18\x03\x20\x01(\x08B\0:\0B\0b\x06proto2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/src/data.rs b/src/data.rs deleted file mode 100644 index e67a2a6..0000000 --- a/src/data.rs +++ /dev/null @@ -1,641 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `data.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Data { - // message fields - index: ::std::option::Option, - value: ::protobuf::SingularField<::std::vec::Vec>, - nodes: ::protobuf::RepeatedField, - signature: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Data { - fn default() -> &'a Data { - ::default_instance() - } -} - -impl Data { - pub fn new() -> Data { - ::std::default::Default::default() - } - - // required uint64 index = 1; - - - pub fn get_index(&self) -> u64 { - self.index.unwrap_or(0) - } - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u64) { - self.index = ::std::option::Option::Some(v); - } - - // optional bytes value = 2; - - - pub fn get_value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => &v, - None => &[], - } - } - pub fn clear_value(&mut self) { - self.value.clear(); - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value.set_default(); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // repeated .Data.Node nodes = 3; - - - pub fn get_nodes(&self) -> &[Data_Node] { - &self.nodes - } - pub fn clear_nodes(&mut self) { - self.nodes.clear(); - } - - // Param is passed by value, moved - pub fn set_nodes(&mut self, v: ::protobuf::RepeatedField) { - self.nodes = v; - } - - // Mutable pointer to the field. - pub fn mut_nodes(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.nodes - } - - // Take field - pub fn take_nodes(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.nodes, ::protobuf::RepeatedField::new()) - } - - // optional bytes signature = 4; - - - pub fn get_signature(&self) -> &[u8] { - match self.signature.as_ref() { - Some(v) => &v, - None => &[], - } - } - pub fn clear_signature(&mut self) { - self.signature.clear(); - } - - pub fn has_signature(&self) -> bool { - self.signature.is_some() - } - - // Param is passed by value, moved - pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { - if self.signature.is_none() { - self.signature.set_default(); - } - self.signature.as_mut().unwrap() - } - - // Take field - pub fn take_signature(&mut self) -> ::std::vec::Vec { - self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } -} - -impl ::protobuf::Message for Data { - fn is_initialized(&self) -> bool { - if self.index.is_none() { - return false; - } - for v in &self.nodes { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.index = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; - }, - 3 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.nodes)?; - }, - 4 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.signature)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.index { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - for value in &self.nodes { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if let Some(ref v) = self.signature.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.index { - os.write_uint64(1, v)?; - } - if let Some(ref v) = self.value.as_ref() { - os.write_bytes(2, &v)?; - } - for v in &self.nodes { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if let Some(ref v) = self.signature.as_ref() { - os.write_bytes(4, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Data { - Data::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - |m: &Data| { &m.index }, - |m: &mut Data| { &mut m.index }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - |m: &Data| { &m.value }, - |m: &mut Data| { &mut m.value }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "nodes", - |m: &Data| { &m.nodes }, - |m: &mut Data| { &mut m.nodes }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "signature", - |m: &Data| { &m.signature }, - |m: &mut Data| { &mut m.signature }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Data", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Data { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Data, - }; - unsafe { - instance.get(Data::new) - } - } -} - -impl ::protobuf::Clear for Data { - fn clear(&mut self) { - self.index = ::std::option::Option::None; - self.value.clear(); - self.nodes.clear(); - self.signature.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Data { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Data { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Data_Node { - // message fields - index: ::std::option::Option, - hash: ::protobuf::SingularField<::std::vec::Vec>, - size: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Data_Node { - fn default() -> &'a Data_Node { - ::default_instance() - } -} - -impl Data_Node { - pub fn new() -> Data_Node { - ::std::default::Default::default() - } - - // required uint64 index = 1; - - - pub fn get_index(&self) -> u64 { - self.index.unwrap_or(0) - } - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u64) { - self.index = ::std::option::Option::Some(v); - } - - // required bytes hash = 2; - - - pub fn get_hash(&self) -> &[u8] { - match self.hash.as_ref() { - Some(v) => &v, - None => &[], - } - } - pub fn clear_hash(&mut self) { - self.hash.clear(); - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: ::std::vec::Vec) { - self.hash = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { - if self.hash.is_none() { - self.hash.set_default(); - } - self.hash.as_mut().unwrap() - } - - // Take field - pub fn take_hash(&mut self) -> ::std::vec::Vec { - self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // required uint64 size = 3; - - - pub fn get_size(&self) -> u64 { - self.size.unwrap_or(0) - } - pub fn clear_size(&mut self) { - self.size = ::std::option::Option::None; - } - - pub fn has_size(&self) -> bool { - self.size.is_some() - } - - // Param is passed by value, moved - pub fn set_size(&mut self, v: u64) { - self.size = ::std::option::Option::Some(v); - } -} - -impl ::protobuf::Message for Data_Node { - fn is_initialized(&self) -> bool { - if self.index.is_none() { - return false; - } - if self.hash.is_none() { - return false; - } - if self.size.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.index = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.hash)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.size = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.index { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.size { - my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.index { - os.write_uint64(1, v)?; - } - if let Some(ref v) = self.hash.as_ref() { - os.write_bytes(2, &v)?; - } - if let Some(v) = self.size { - os.write_uint64(3, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Data_Node { - Data_Node::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - |m: &Data_Node| { &m.index }, - |m: &mut Data_Node| { &mut m.index }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "hash", - |m: &Data_Node| { &m.hash }, - |m: &mut Data_Node| { &mut m.hash }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "size", - |m: &Data_Node| { &m.size }, - |m: &mut Data_Node| { &mut m.size }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Data_Node", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Data_Node { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Data_Node, - }; - unsafe { - instance.get(Data_Node::new) - } - } -} - -impl ::protobuf::Clear for Data_Node { - fn clear(&mut self) { - self.index = ::std::option::Option::None; - self.hash.clear(); - self.size = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Data_Node { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Data_Node { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\ndata.proto\x12\0\"\x97\x01\n\x04Data\x12\x0f\n\x05index\x18\x01\x20\ - \x02(\x04B\0\x12\x0f\n\x05value\x18\x02\x20\x01(\x0cB\0\x12\x1b\n\x05nod\ - es\x18\x03\x20\x03(\x0b2\n.Data.NodeB\0\x12\x13\n\tsignature\x18\x04\x20\ - \x01(\x0cB\0\x1a9\n\x04Node\x12\x0f\n\x05index\x18\x01\x20\x02(\x04B\0\ - \x12\x0e\n\x04hash\x18\x02\x20\x02(\x0cB\0\x12\x0e\n\x04size\x18\x03\x20\ - \x02(\x04B\0:\0:\0B\0b\x06proto2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/src/feed.rs b/src/feed.rs deleted file mode 100644 index 497830b..0000000 --- a/src/feed.rs +++ /dev/null @@ -1,283 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `feed.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Feed { - // message fields - discoveryKey: ::protobuf::SingularField<::std::vec::Vec>, - nonce: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Feed { - fn default() -> &'a Feed { - ::default_instance() - } -} - -impl Feed { - pub fn new() -> Feed { - ::std::default::Default::default() - } - - // required bytes discoveryKey = 1; - - - pub fn get_discoveryKey(&self) -> &[u8] { - match self.discoveryKey.as_ref() { - Some(v) => &v, - None => &[], - } - } - pub fn clear_discoveryKey(&mut self) { - self.discoveryKey.clear(); - } - - pub fn has_discoveryKey(&self) -> bool { - self.discoveryKey.is_some() - } - - // Param is passed by value, moved - pub fn set_discoveryKey(&mut self, v: ::std::vec::Vec) { - self.discoveryKey = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_discoveryKey(&mut self) -> &mut ::std::vec::Vec { - if self.discoveryKey.is_none() { - self.discoveryKey.set_default(); - } - self.discoveryKey.as_mut().unwrap() - } - - // Take field - pub fn take_discoveryKey(&mut self) -> ::std::vec::Vec { - self.discoveryKey.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bytes nonce = 2; - - - pub fn get_nonce(&self) -> &[u8] { - match self.nonce.as_ref() { - Some(v) => &v, - None => &[], - } - } - pub fn clear_nonce(&mut self) { - self.nonce.clear(); - } - - pub fn has_nonce(&self) -> bool { - self.nonce.is_some() - } - - // Param is passed by value, moved - pub fn set_nonce(&mut self, v: ::std::vec::Vec) { - self.nonce = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { - if self.nonce.is_none() { - self.nonce.set_default(); - } - self.nonce.as_mut().unwrap() - } - - // Take field - pub fn take_nonce(&mut self) -> ::std::vec::Vec { - self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } -} - -impl ::protobuf::Message for Feed { - fn is_initialized(&self) -> bool { - if self.discoveryKey.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.discoveryKey)?; - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.nonce)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.discoveryKey.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(ref v) = self.nonce.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.discoveryKey.as_ref() { - os.write_bytes(1, &v)?; - } - if let Some(ref v) = self.nonce.as_ref() { - os.write_bytes(2, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Feed { - Feed::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "discoveryKey", - |m: &Feed| { &m.discoveryKey }, - |m: &mut Feed| { &mut m.discoveryKey }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "nonce", - |m: &Feed| { &m.nonce }, - |m: &mut Feed| { &mut m.nonce }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Feed", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Feed { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Feed, - }; - unsafe { - instance.get(Feed::new) - } - } -} - -impl ::protobuf::Clear for Feed { - fn clear(&mut self) { - self.discoveryKey.clear(); - self.nonce.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Feed { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Feed { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\nfeed.proto\x12\0\"1\n\x04Feed\x12\x16\n\x0cdiscoveryKey\x18\x01\x20\ - \x02(\x0cB\0\x12\x0f\n\x05nonce\x18\x02\x20\x01(\x0cB\0:\0B\0b\x06proto2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/src/handshake.rs b/src/handshake.rs deleted file mode 100644 index 79f19a5..0000000 --- a/src/handshake.rs +++ /dev/null @@ -1,362 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `handshake.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Handshake { - // message fields - id: ::protobuf::SingularField<::std::vec::Vec>, - live: ::std::option::Option, - userData: ::protobuf::SingularField<::std::vec::Vec>, - extensions: ::protobuf::RepeatedField<::std::string::String>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Handshake { - fn default() -> &'a Handshake { - ::default_instance() - } -} - -impl Handshake { - pub fn new() -> Handshake { - ::std::default::Default::default() - } - - // optional bytes id = 1; - - - pub fn get_id(&self) -> &[u8] { - match self.id.as_ref() { - Some(v) => &v, - None => &[], - } - } - pub fn clear_id(&mut self) { - self.id.clear(); - } - - pub fn has_id(&self) -> bool { - self.id.is_some() - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: ::std::vec::Vec) { - self.id = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_id(&mut self) -> &mut ::std::vec::Vec { - if self.id.is_none() { - self.id.set_default(); - } - self.id.as_mut().unwrap() - } - - // Take field - pub fn take_id(&mut self) -> ::std::vec::Vec { - self.id.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // optional bool live = 2; - - - pub fn get_live(&self) -> bool { - self.live.unwrap_or(false) - } - pub fn clear_live(&mut self) { - self.live = ::std::option::Option::None; - } - - pub fn has_live(&self) -> bool { - self.live.is_some() - } - - // Param is passed by value, moved - pub fn set_live(&mut self, v: bool) { - self.live = ::std::option::Option::Some(v); - } - - // optional bytes userData = 3; - - - pub fn get_userData(&self) -> &[u8] { - match self.userData.as_ref() { - Some(v) => &v, - None => &[], - } - } - pub fn clear_userData(&mut self) { - self.userData.clear(); - } - - pub fn has_userData(&self) -> bool { - self.userData.is_some() - } - - // Param is passed by value, moved - pub fn set_userData(&mut self, v: ::std::vec::Vec) { - self.userData = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_userData(&mut self) -> &mut ::std::vec::Vec { - if self.userData.is_none() { - self.userData.set_default(); - } - self.userData.as_mut().unwrap() - } - - // Take field - pub fn take_userData(&mut self) -> ::std::vec::Vec { - self.userData.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - // repeated string extensions = 4; - - - pub fn get_extensions(&self) -> &[::std::string::String] { - &self.extensions - } - pub fn clear_extensions(&mut self) { - self.extensions.clear(); - } - - // Param is passed by value, moved - pub fn set_extensions(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { - self.extensions = v; - } - - // Mutable pointer to the field. - pub fn mut_extensions(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.extensions - } - - // Take field - pub fn take_extensions(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { - ::std::mem::replace(&mut self.extensions, ::protobuf::RepeatedField::new()) - } -} - -impl ::protobuf::Message for Handshake { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.id)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.live = ::std::option::Option::Some(tmp); - }, - 3 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.userData)?; - }, - 4 => { - ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.extensions)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.id.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.live { - my_size += 2; - } - if let Some(ref v) = self.userData.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - for value in &self.extensions { - my_size += ::protobuf::rt::string_size(4, &value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.id.as_ref() { - os.write_bytes(1, &v)?; - } - if let Some(v) = self.live { - os.write_bool(2, v)?; - } - if let Some(ref v) = self.userData.as_ref() { - os.write_bytes(3, &v)?; - } - for v in &self.extensions { - os.write_string(4, &v)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Handshake { - Handshake::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "id", - |m: &Handshake| { &m.id }, - |m: &mut Handshake| { &mut m.id }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "live", - |m: &Handshake| { &m.live }, - |m: &mut Handshake| { &mut m.live }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "userData", - |m: &Handshake| { &m.userData }, - |m: &mut Handshake| { &mut m.userData }, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "extensions", - |m: &Handshake| { &m.extensions }, - |m: &mut Handshake| { &mut m.extensions }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Handshake", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Handshake { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Handshake, - }; - unsafe { - instance.get(Handshake::new) - } - } -} - -impl ::protobuf::Clear for Handshake { - fn clear(&mut self) { - self.id.clear(); - self.live = ::std::option::Option::None; - self.userData.clear(); - self.extensions.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Handshake { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Handshake { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0fhandshake.proto\x12\0\"U\n\tHandshake\x12\x0c\n\x02id\x18\x01\x20\ - \x01(\x0cB\0\x12\x0e\n\x04live\x18\x02\x20\x01(\x08B\0\x12\x12\n\x08user\ - Data\x18\x03\x20\x01(\x0cB\0\x12\x14\n\nextensions\x18\x04\x20\x03(\tB\0\ - :\0B\0b\x06proto2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/src/have.rs b/src/have.rs deleted file mode 100644 index 318260a..0000000 --- a/src/have.rs +++ /dev/null @@ -1,310 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `have.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Have { - // message fields - start: ::std::option::Option, - length: ::std::option::Option, - bitfield: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Have { - fn default() -> &'a Have { - ::default_instance() - } -} - -impl Have { - pub fn new() -> Have { - ::std::default::Default::default() - } - - // required uint64 start = 1; - - - pub fn get_start(&self) -> u64 { - self.start.unwrap_or(0) - } - pub fn clear_start(&mut self) { - self.start = ::std::option::Option::None; - } - - pub fn has_start(&self) -> bool { - self.start.is_some() - } - - // Param is passed by value, moved - pub fn set_start(&mut self, v: u64) { - self.start = ::std::option::Option::Some(v); - } - - // optional uint64 length = 2; - - - pub fn get_length(&self) -> u64 { - self.length.unwrap_or(1u64) - } - pub fn clear_length(&mut self) { - self.length = ::std::option::Option::None; - } - - pub fn has_length(&self) -> bool { - self.length.is_some() - } - - // Param is passed by value, moved - pub fn set_length(&mut self, v: u64) { - self.length = ::std::option::Option::Some(v); - } - - // optional bytes bitfield = 3; - - - pub fn get_bitfield(&self) -> &[u8] { - match self.bitfield.as_ref() { - Some(v) => &v, - None => &[], - } - } - pub fn clear_bitfield(&mut self) { - self.bitfield.clear(); - } - - pub fn has_bitfield(&self) -> bool { - self.bitfield.is_some() - } - - // Param is passed by value, moved - pub fn set_bitfield(&mut self, v: ::std::vec::Vec) { - self.bitfield = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_bitfield(&mut self) -> &mut ::std::vec::Vec { - if self.bitfield.is_none() { - self.bitfield.set_default(); - } - self.bitfield.as_mut().unwrap() - } - - // Take field - pub fn take_bitfield(&mut self) -> ::std::vec::Vec { - self.bitfield.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } -} - -impl ::protobuf::Message for Have { - fn is_initialized(&self) -> bool { - if self.start.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.length = ::std::option::Option::Some(tmp); - }, - 3 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.bitfield)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.start { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.length { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.bitfield.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.start { - os.write_uint64(1, v)?; - } - if let Some(v) = self.length { - os.write_uint64(2, v)?; - } - if let Some(ref v) = self.bitfield.as_ref() { - os.write_bytes(3, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Have { - Have::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start", - |m: &Have| { &m.start }, - |m: &mut Have| { &mut m.start }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "length", - |m: &Have| { &m.length }, - |m: &mut Have| { &mut m.length }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "bitfield", - |m: &Have| { &m.bitfield }, - |m: &mut Have| { &mut m.bitfield }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Have", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Have { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Have, - }; - unsafe { - instance.get(Have::new) - } - } -} - -impl ::protobuf::Clear for Have { - fn clear(&mut self) { - self.start = ::std::option::Option::None; - self.length = ::std::option::Option::None; - self.bitfield.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Have { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Have { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\nhave.proto\x12\0\"B\n\x04Have\x12\x0f\n\x05start\x18\x01\x20\x02(\ - \x04B\0\x12\x13\n\x06length\x18\x02\x20\x01(\x04:\x011B\0\x12\x12\n\x08b\ - itfield\x18\x03\x20\x01(\x0cB\0:\0B\0b\x06proto2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/src/info.rs b/src/info.rs deleted file mode 100644 index 39b34b6..0000000 --- a/src/info.rs +++ /dev/null @@ -1,255 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `info.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Info { - // message fields - uploading: ::std::option::Option, - downloading: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Info { - fn default() -> &'a Info { - ::default_instance() - } -} - -impl Info { - pub fn new() -> Info { - ::std::default::Default::default() - } - - // optional bool uploading = 1; - - - pub fn get_uploading(&self) -> bool { - self.uploading.unwrap_or(false) - } - pub fn clear_uploading(&mut self) { - self.uploading = ::std::option::Option::None; - } - - pub fn has_uploading(&self) -> bool { - self.uploading.is_some() - } - - // Param is passed by value, moved - pub fn set_uploading(&mut self, v: bool) { - self.uploading = ::std::option::Option::Some(v); - } - - // optional bool downloading = 2; - - - pub fn get_downloading(&self) -> bool { - self.downloading.unwrap_or(false) - } - pub fn clear_downloading(&mut self) { - self.downloading = ::std::option::Option::None; - } - - pub fn has_downloading(&self) -> bool { - self.downloading.is_some() - } - - // Param is passed by value, moved - pub fn set_downloading(&mut self, v: bool) { - self.downloading = ::std::option::Option::Some(v); - } -} - -impl ::protobuf::Message for Info { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.uploading = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.downloading = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.uploading { - my_size += 2; - } - if let Some(v) = self.downloading { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.uploading { - os.write_bool(1, v)?; - } - if let Some(v) = self.downloading { - os.write_bool(2, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Info { - Info::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "uploading", - |m: &Info| { &m.uploading }, - |m: &mut Info| { &mut m.uploading }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "downloading", - |m: &Info| { &m.downloading }, - |m: &mut Info| { &mut m.downloading }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Info", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Info { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Info, - }; - unsafe { - instance.get(Info::new) - } - } -} - -impl ::protobuf::Clear for Info { - fn clear(&mut self) { - self.uploading = ::std::option::Option::None; - self.downloading = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Info { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Info { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\ninfo.proto\x12\0\"4\n\x04Info\x12\x13\n\tuploading\x18\x01\x20\x01(\ - \x08B\0\x12\x15\n\x0bdownloading\x18\x02\x20\x01(\x08B\0:\0B\0b\x06proto\ - 2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/src/lib.rs b/src/lib.rs index 8d8934c..d3e4676 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,18 +1,3122 @@ -//! SLEEP Network Protocol protobuf definitions. -//! Generated using [`rust-protobuf`] according to the definitions in the [Dat paper]. -//! -//! [`rust-protobuf`]: https://github.com/stepancheg/rust-protobuf -//! [Dat paper]: https://github.com/datproject/docs/blob/master/papers/dat-paper.md - - - -pub mod cancel; -pub mod data; -pub mod feed; -pub mod handshake; -pub mod have; -pub mod info; -pub mod request; -pub mod unhave; -pub mod unwant; -pub mod want; +// This file is generated by rust-protobuf 2.10.1. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `lib.proto` + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; + +#[derive(PartialEq,Clone,Default)] +pub struct NoisePayload { + // message fields + nonce: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a NoisePayload { + fn default() -> &'a NoisePayload { + ::default_instance() + } +} + +impl NoisePayload { + pub fn new() -> NoisePayload { + ::std::default::Default::default() + } + + // required bytes nonce = 1; + + + pub fn get_nonce(&self) -> &[u8] { + match self.nonce.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_nonce(&mut self) { + self.nonce.clear(); + } + + pub fn has_nonce(&self) -> bool { + self.nonce.is_some() + } + + // Param is passed by value, moved + pub fn set_nonce(&mut self, v: ::std::vec::Vec) { + self.nonce = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { + if self.nonce.is_none() { + self.nonce.set_default(); + } + self.nonce.as_mut().unwrap() + } + + // Take field + pub fn take_nonce(&mut self) -> ::std::vec::Vec { + self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for NoisePayload { + fn is_initialized(&self) -> bool { + if self.nonce.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.nonce)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.nonce.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.nonce.as_ref() { + os.write_bytes(1, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> NoisePayload { + NoisePayload::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "nonce", + |m: &NoisePayload| { &m.nonce }, + |m: &mut NoisePayload| { &mut m.nonce }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "NoisePayload", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static NoisePayload { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const NoisePayload, + }; + unsafe { + instance.get(NoisePayload::new) + } + } +} + +impl ::protobuf::Clear for NoisePayload { + fn clear(&mut self) { + self.nonce.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for NoisePayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NoisePayload { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Open { + // message fields + discoveryKey: ::protobuf::SingularField<::std::vec::Vec>, + capability: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Open { + fn default() -> &'a Open { + ::default_instance() + } +} + +impl Open { + pub fn new() -> Open { + ::std::default::Default::default() + } + + // required bytes discoveryKey = 1; + + + pub fn get_discoveryKey(&self) -> &[u8] { + match self.discoveryKey.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_discoveryKey(&mut self) { + self.discoveryKey.clear(); + } + + pub fn has_discoveryKey(&self) -> bool { + self.discoveryKey.is_some() + } + + // Param is passed by value, moved + pub fn set_discoveryKey(&mut self, v: ::std::vec::Vec) { + self.discoveryKey = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_discoveryKey(&mut self) -> &mut ::std::vec::Vec { + if self.discoveryKey.is_none() { + self.discoveryKey.set_default(); + } + self.discoveryKey.as_mut().unwrap() + } + + // Take field + pub fn take_discoveryKey(&mut self) -> ::std::vec::Vec { + self.discoveryKey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bytes capability = 2; + + + pub fn get_capability(&self) -> &[u8] { + match self.capability.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_capability(&mut self) { + self.capability.clear(); + } + + pub fn has_capability(&self) -> bool { + self.capability.is_some() + } + + // Param is passed by value, moved + pub fn set_capability(&mut self, v: ::std::vec::Vec) { + self.capability = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_capability(&mut self) -> &mut ::std::vec::Vec { + if self.capability.is_none() { + self.capability.set_default(); + } + self.capability.as_mut().unwrap() + } + + // Take field + pub fn take_capability(&mut self) -> ::std::vec::Vec { + self.capability.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for Open { + fn is_initialized(&self) -> bool { + if self.discoveryKey.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.discoveryKey)?; + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.capability)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.discoveryKey.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(ref v) = self.capability.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.discoveryKey.as_ref() { + os.write_bytes(1, &v)?; + } + if let Some(ref v) = self.capability.as_ref() { + os.write_bytes(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Open { + Open::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "discoveryKey", + |m: &Open| { &m.discoveryKey }, + |m: &mut Open| { &mut m.discoveryKey }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "capability", + |m: &Open| { &m.capability }, + |m: &mut Open| { &mut m.capability }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Open", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Open { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Open, + }; + unsafe { + instance.get(Open::new) + } + } +} + +impl ::protobuf::Clear for Open { + fn clear(&mut self) { + self.discoveryKey.clear(); + self.capability.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Open { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Open { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Options { + // message fields + extensions: ::protobuf::RepeatedField<::std::string::String>, + ack: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Options { + fn default() -> &'a Options { + ::default_instance() + } +} + +impl Options { + pub fn new() -> Options { + ::std::default::Default::default() + } + + // repeated string extensions = 1; + + + pub fn get_extensions(&self) -> &[::std::string::String] { + &self.extensions + } + pub fn clear_extensions(&mut self) { + self.extensions.clear(); + } + + // Param is passed by value, moved + pub fn set_extensions(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.extensions = v; + } + + // Mutable pointer to the field. + pub fn mut_extensions(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.extensions + } + + // Take field + pub fn take_extensions(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.extensions, ::protobuf::RepeatedField::new()) + } + + // optional bool ack = 2; + + + pub fn get_ack(&self) -> bool { + self.ack.unwrap_or(false) + } + pub fn clear_ack(&mut self) { + self.ack = ::std::option::Option::None; + } + + pub fn has_ack(&self) -> bool { + self.ack.is_some() + } + + // Param is passed by value, moved + pub fn set_ack(&mut self, v: bool) { + self.ack = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Options { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.extensions)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.ack = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.extensions { + my_size += ::protobuf::rt::string_size(1, &value); + }; + if let Some(v) = self.ack { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + for v in &self.extensions { + os.write_string(1, &v)?; + }; + if let Some(v) = self.ack { + os.write_bool(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Options { + Options::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "extensions", + |m: &Options| { &m.extensions }, + |m: &mut Options| { &mut m.extensions }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "ack", + |m: &Options| { &m.ack }, + |m: &mut Options| { &mut m.ack }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Options", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Options { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Options, + }; + unsafe { + instance.get(Options::new) + } + } +} + +impl ::protobuf::Clear for Options { + fn clear(&mut self) { + self.extensions.clear(); + self.ack = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Options { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Options { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Status { + // message fields + uploading: ::std::option::Option, + downloading: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Status { + fn default() -> &'a Status { + ::default_instance() + } +} + +impl Status { + pub fn new() -> Status { + ::std::default::Default::default() + } + + // optional bool uploading = 1; + + + pub fn get_uploading(&self) -> bool { + self.uploading.unwrap_or(false) + } + pub fn clear_uploading(&mut self) { + self.uploading = ::std::option::Option::None; + } + + pub fn has_uploading(&self) -> bool { + self.uploading.is_some() + } + + // Param is passed by value, moved + pub fn set_uploading(&mut self, v: bool) { + self.uploading = ::std::option::Option::Some(v); + } + + // optional bool downloading = 2; + + + pub fn get_downloading(&self) -> bool { + self.downloading.unwrap_or(false) + } + pub fn clear_downloading(&mut self) { + self.downloading = ::std::option::Option::None; + } + + pub fn has_downloading(&self) -> bool { + self.downloading.is_some() + } + + // Param is passed by value, moved + pub fn set_downloading(&mut self, v: bool) { + self.downloading = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Status { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.uploading = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.downloading = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.uploading { + my_size += 2; + } + if let Some(v) = self.downloading { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.uploading { + os.write_bool(1, v)?; + } + if let Some(v) = self.downloading { + os.write_bool(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Status { + Status::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "uploading", + |m: &Status| { &m.uploading }, + |m: &mut Status| { &mut m.uploading }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "downloading", + |m: &Status| { &m.downloading }, + |m: &mut Status| { &mut m.downloading }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Status", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Status { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Status, + }; + unsafe { + instance.get(Status::new) + } + } +} + +impl ::protobuf::Clear for Status { + fn clear(&mut self) { + self.uploading = ::std::option::Option::None; + self.downloading = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Status { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Status { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Have { + // message fields + start: ::std::option::Option, + length: ::std::option::Option, + bitfield: ::protobuf::SingularField<::std::vec::Vec>, + ack: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Have { + fn default() -> &'a Have { + ::default_instance() + } +} + +impl Have { + pub fn new() -> Have { + ::std::default::Default::default() + } + + // required uint64 start = 1; + + + pub fn get_start(&self) -> u64 { + self.start.unwrap_or(0) + } + pub fn clear_start(&mut self) { + self.start = ::std::option::Option::None; + } + + pub fn has_start(&self) -> bool { + self.start.is_some() + } + + // Param is passed by value, moved + pub fn set_start(&mut self, v: u64) { + self.start = ::std::option::Option::Some(v); + } + + // optional uint64 length = 2; + + + pub fn get_length(&self) -> u64 { + self.length.unwrap_or(1u64) + } + pub fn clear_length(&mut self) { + self.length = ::std::option::Option::None; + } + + pub fn has_length(&self) -> bool { + self.length.is_some() + } + + // Param is passed by value, moved + pub fn set_length(&mut self, v: u64) { + self.length = ::std::option::Option::Some(v); + } + + // optional bytes bitfield = 3; + + + pub fn get_bitfield(&self) -> &[u8] { + match self.bitfield.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_bitfield(&mut self) { + self.bitfield.clear(); + } + + pub fn has_bitfield(&self) -> bool { + self.bitfield.is_some() + } + + // Param is passed by value, moved + pub fn set_bitfield(&mut self, v: ::std::vec::Vec) { + self.bitfield = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_bitfield(&mut self) -> &mut ::std::vec::Vec { + if self.bitfield.is_none() { + self.bitfield.set_default(); + } + self.bitfield.as_mut().unwrap() + } + + // Take field + pub fn take_bitfield(&mut self) -> ::std::vec::Vec { + self.bitfield.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // optional bool ack = 4; + + + pub fn get_ack(&self) -> bool { + self.ack.unwrap_or(false) + } + pub fn clear_ack(&mut self) { + self.ack = ::std::option::Option::None; + } + + pub fn has_ack(&self) -> bool { + self.ack.is_some() + } + + // Param is passed by value, moved + pub fn set_ack(&mut self, v: bool) { + self.ack = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Have { + fn is_initialized(&self) -> bool { + if self.start.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.length = ::std::option::Option::Some(tmp); + }, + 3 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.bitfield)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.ack = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.start { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.length { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.bitfield.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(v) = self.ack { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.start { + os.write_uint64(1, v)?; + } + if let Some(v) = self.length { + os.write_uint64(2, v)?; + } + if let Some(ref v) = self.bitfield.as_ref() { + os.write_bytes(3, &v)?; + } + if let Some(v) = self.ack { + os.write_bool(4, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Have { + Have::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start", + |m: &Have| { &m.start }, + |m: &mut Have| { &mut m.start }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "length", + |m: &Have| { &m.length }, + |m: &mut Have| { &mut m.length }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "bitfield", + |m: &Have| { &m.bitfield }, + |m: &mut Have| { &mut m.bitfield }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "ack", + |m: &Have| { &m.ack }, + |m: &mut Have| { &mut m.ack }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Have", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Have { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Have, + }; + unsafe { + instance.get(Have::new) + } + } +} + +impl ::protobuf::Clear for Have { + fn clear(&mut self) { + self.start = ::std::option::Option::None; + self.length = ::std::option::Option::None; + self.bitfield.clear(); + self.ack = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Have { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Have { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Unhave { + // message fields + start: ::std::option::Option, + length: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Unhave { + fn default() -> &'a Unhave { + ::default_instance() + } +} + +impl Unhave { + pub fn new() -> Unhave { + ::std::default::Default::default() + } + + // required uint64 start = 1; + + + pub fn get_start(&self) -> u64 { + self.start.unwrap_or(0) + } + pub fn clear_start(&mut self) { + self.start = ::std::option::Option::None; + } + + pub fn has_start(&self) -> bool { + self.start.is_some() + } + + // Param is passed by value, moved + pub fn set_start(&mut self, v: u64) { + self.start = ::std::option::Option::Some(v); + } + + // optional uint64 length = 2; + + + pub fn get_length(&self) -> u64 { + self.length.unwrap_or(1u64) + } + pub fn clear_length(&mut self) { + self.length = ::std::option::Option::None; + } + + pub fn has_length(&self) -> bool { + self.length.is_some() + } + + // Param is passed by value, moved + pub fn set_length(&mut self, v: u64) { + self.length = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Unhave { + fn is_initialized(&self) -> bool { + if self.start.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.length = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.start { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.length { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.start { + os.write_uint64(1, v)?; + } + if let Some(v) = self.length { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Unhave { + Unhave::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start", + |m: &Unhave| { &m.start }, + |m: &mut Unhave| { &mut m.start }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "length", + |m: &Unhave| { &m.length }, + |m: &mut Unhave| { &mut m.length }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Unhave", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Unhave { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Unhave, + }; + unsafe { + instance.get(Unhave::new) + } + } +} + +impl ::protobuf::Clear for Unhave { + fn clear(&mut self) { + self.start = ::std::option::Option::None; + self.length = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Unhave { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Unhave { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Want { + // message fields + start: ::std::option::Option, + length: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Want { + fn default() -> &'a Want { + ::default_instance() + } +} + +impl Want { + pub fn new() -> Want { + ::std::default::Default::default() + } + + // required uint64 start = 1; + + + pub fn get_start(&self) -> u64 { + self.start.unwrap_or(0) + } + pub fn clear_start(&mut self) { + self.start = ::std::option::Option::None; + } + + pub fn has_start(&self) -> bool { + self.start.is_some() + } + + // Param is passed by value, moved + pub fn set_start(&mut self, v: u64) { + self.start = ::std::option::Option::Some(v); + } + + // optional uint64 length = 2; + + + pub fn get_length(&self) -> u64 { + self.length.unwrap_or(0) + } + pub fn clear_length(&mut self) { + self.length = ::std::option::Option::None; + } + + pub fn has_length(&self) -> bool { + self.length.is_some() + } + + // Param is passed by value, moved + pub fn set_length(&mut self, v: u64) { + self.length = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Want { + fn is_initialized(&self) -> bool { + if self.start.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.length = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.start { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.length { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.start { + os.write_uint64(1, v)?; + } + if let Some(v) = self.length { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Want { + Want::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start", + |m: &Want| { &m.start }, + |m: &mut Want| { &mut m.start }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "length", + |m: &Want| { &m.length }, + |m: &mut Want| { &mut m.length }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Want", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Want { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Want, + }; + unsafe { + instance.get(Want::new) + } + } +} + +impl ::protobuf::Clear for Want { + fn clear(&mut self) { + self.start = ::std::option::Option::None; + self.length = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Want { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Want { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Unwant { + // message fields + start: ::std::option::Option, + length: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Unwant { + fn default() -> &'a Unwant { + ::default_instance() + } +} + +impl Unwant { + pub fn new() -> Unwant { + ::std::default::Default::default() + } + + // required uint64 start = 1; + + + pub fn get_start(&self) -> u64 { + self.start.unwrap_or(0) + } + pub fn clear_start(&mut self) { + self.start = ::std::option::Option::None; + } + + pub fn has_start(&self) -> bool { + self.start.is_some() + } + + // Param is passed by value, moved + pub fn set_start(&mut self, v: u64) { + self.start = ::std::option::Option::Some(v); + } + + // optional uint64 length = 2; + + + pub fn get_length(&self) -> u64 { + self.length.unwrap_or(0) + } + pub fn clear_length(&mut self) { + self.length = ::std::option::Option::None; + } + + pub fn has_length(&self) -> bool { + self.length.is_some() + } + + // Param is passed by value, moved + pub fn set_length(&mut self, v: u64) { + self.length = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Unwant { + fn is_initialized(&self) -> bool { + if self.start.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.length = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.start { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.length { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.start { + os.write_uint64(1, v)?; + } + if let Some(v) = self.length { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Unwant { + Unwant::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start", + |m: &Unwant| { &m.start }, + |m: &mut Unwant| { &mut m.start }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "length", + |m: &Unwant| { &m.length }, + |m: &mut Unwant| { &mut m.length }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Unwant", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Unwant { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Unwant, + }; + unsafe { + instance.get(Unwant::new) + } + } +} + +impl ::protobuf::Clear for Unwant { + fn clear(&mut self) { + self.start = ::std::option::Option::None; + self.length = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Unwant { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Unwant { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Request { + // message fields + index: ::std::option::Option, + bytes: ::std::option::Option, + hash: ::std::option::Option, + nodes: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Request { + fn default() -> &'a Request { + ::default_instance() + } +} + +impl Request { + pub fn new() -> Request { + ::std::default::Default::default() + } + + // required uint64 index = 1; + + + pub fn get_index(&self) -> u64 { + self.index.unwrap_or(0) + } + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u64) { + self.index = ::std::option::Option::Some(v); + } + + // optional uint64 bytes = 2; + + + pub fn get_bytes(&self) -> u64 { + self.bytes.unwrap_or(0) + } + pub fn clear_bytes(&mut self) { + self.bytes = ::std::option::Option::None; + } + + pub fn has_bytes(&self) -> bool { + self.bytes.is_some() + } + + // Param is passed by value, moved + pub fn set_bytes(&mut self, v: u64) { + self.bytes = ::std::option::Option::Some(v); + } + + // optional bool hash = 3; + + + pub fn get_hash(&self) -> bool { + self.hash.unwrap_or(false) + } + pub fn clear_hash(&mut self) { + self.hash = ::std::option::Option::None; + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: bool) { + self.hash = ::std::option::Option::Some(v); + } + + // optional uint64 nodes = 4; + + + pub fn get_nodes(&self) -> u64 { + self.nodes.unwrap_or(0) + } + pub fn clear_nodes(&mut self) { + self.nodes = ::std::option::Option::None; + } + + pub fn has_nodes(&self) -> bool { + self.nodes.is_some() + } + + // Param is passed by value, moved + pub fn set_nodes(&mut self, v: u64) { + self.nodes = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Request { + fn is_initialized(&self) -> bool { + if self.index.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.index = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.bytes = ::std::option::Option::Some(tmp); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.hash = ::std::option::Option::Some(tmp); + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.nodes = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.index { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.bytes { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.hash { + my_size += 2; + } + if let Some(v) = self.nodes { + my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.index { + os.write_uint64(1, v)?; + } + if let Some(v) = self.bytes { + os.write_uint64(2, v)?; + } + if let Some(v) = self.hash { + os.write_bool(3, v)?; + } + if let Some(v) = self.nodes { + os.write_uint64(4, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Request { + Request::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + |m: &Request| { &m.index }, + |m: &mut Request| { &mut m.index }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "bytes", + |m: &Request| { &m.bytes }, + |m: &mut Request| { &mut m.bytes }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "hash", + |m: &Request| { &m.hash }, + |m: &mut Request| { &mut m.hash }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "nodes", + |m: &Request| { &m.nodes }, + |m: &mut Request| { &mut m.nodes }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Request", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Request { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Request, + }; + unsafe { + instance.get(Request::new) + } + } +} + +impl ::protobuf::Clear for Request { + fn clear(&mut self) { + self.index = ::std::option::Option::None; + self.bytes = ::std::option::Option::None; + self.hash = ::std::option::Option::None; + self.nodes = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Request { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Request { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Cancel { + // message fields + index: ::std::option::Option, + bytes: ::std::option::Option, + hash: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Cancel { + fn default() -> &'a Cancel { + ::default_instance() + } +} + +impl Cancel { + pub fn new() -> Cancel { + ::std::default::Default::default() + } + + // required uint64 index = 1; + + + pub fn get_index(&self) -> u64 { + self.index.unwrap_or(0) + } + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u64) { + self.index = ::std::option::Option::Some(v); + } + + // optional uint64 bytes = 2; + + + pub fn get_bytes(&self) -> u64 { + self.bytes.unwrap_or(0) + } + pub fn clear_bytes(&mut self) { + self.bytes = ::std::option::Option::None; + } + + pub fn has_bytes(&self) -> bool { + self.bytes.is_some() + } + + // Param is passed by value, moved + pub fn set_bytes(&mut self, v: u64) { + self.bytes = ::std::option::Option::Some(v); + } + + // optional bool hash = 3; + + + pub fn get_hash(&self) -> bool { + self.hash.unwrap_or(false) + } + pub fn clear_hash(&mut self) { + self.hash = ::std::option::Option::None; + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: bool) { + self.hash = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Cancel { + fn is_initialized(&self) -> bool { + if self.index.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.index = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.bytes = ::std::option::Option::Some(tmp); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.hash = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.index { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.bytes { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.hash { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.index { + os.write_uint64(1, v)?; + } + if let Some(v) = self.bytes { + os.write_uint64(2, v)?; + } + if let Some(v) = self.hash { + os.write_bool(3, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Cancel { + Cancel::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + |m: &Cancel| { &m.index }, + |m: &mut Cancel| { &mut m.index }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "bytes", + |m: &Cancel| { &m.bytes }, + |m: &mut Cancel| { &mut m.bytes }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "hash", + |m: &Cancel| { &m.hash }, + |m: &mut Cancel| { &mut m.hash }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Cancel", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Cancel { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Cancel, + }; + unsafe { + instance.get(Cancel::new) + } + } +} + +impl ::protobuf::Clear for Cancel { + fn clear(&mut self) { + self.index = ::std::option::Option::None; + self.bytes = ::std::option::Option::None; + self.hash = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Cancel { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Cancel { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Data { + // message fields + index: ::std::option::Option, + value: ::protobuf::SingularField<::std::vec::Vec>, + nodes: ::protobuf::RepeatedField, + signature: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Data { + fn default() -> &'a Data { + ::default_instance() + } +} + +impl Data { + pub fn new() -> Data { + ::std::default::Default::default() + } + + // required uint64 index = 1; + + + pub fn get_index(&self) -> u64 { + self.index.unwrap_or(0) + } + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u64) { + self.index = ::std::option::Option::Some(v); + } + + // optional bytes value = 2; + + + pub fn get_value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_value(&mut self) { + self.value.clear(); + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value.set_default(); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // repeated .Data.Node nodes = 3; + + + pub fn get_nodes(&self) -> &[Data_Node] { + &self.nodes + } + pub fn clear_nodes(&mut self) { + self.nodes.clear(); + } + + // Param is passed by value, moved + pub fn set_nodes(&mut self, v: ::protobuf::RepeatedField) { + self.nodes = v; + } + + // Mutable pointer to the field. + pub fn mut_nodes(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.nodes + } + + // Take field + pub fn take_nodes(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.nodes, ::protobuf::RepeatedField::new()) + } + + // optional bytes signature = 4; + + + pub fn get_signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_signature(&mut self) { + self.signature.clear(); + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature.set_default(); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for Data { + fn is_initialized(&self) -> bool { + if self.index.is_none() { + return false; + } + for v in &self.nodes { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.index = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.nodes)?; + }, + 4 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.signature)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.index { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + for value in &self.nodes { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.index { + os.write_uint64(1, v)?; + } + if let Some(ref v) = self.value.as_ref() { + os.write_bytes(2, &v)?; + } + for v in &self.nodes { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.signature.as_ref() { + os.write_bytes(4, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Data { + Data::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + |m: &Data| { &m.index }, + |m: &mut Data| { &mut m.index }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + |m: &Data| { &m.value }, + |m: &mut Data| { &mut m.value }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "nodes", + |m: &Data| { &m.nodes }, + |m: &mut Data| { &mut m.nodes }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "signature", + |m: &Data| { &m.signature }, + |m: &mut Data| { &mut m.signature }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Data", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Data { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Data, + }; + unsafe { + instance.get(Data::new) + } + } +} + +impl ::protobuf::Clear for Data { + fn clear(&mut self) { + self.index = ::std::option::Option::None; + self.value.clear(); + self.nodes.clear(); + self.signature.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Data { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Data { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Data_Node { + // message fields + index: ::std::option::Option, + hash: ::protobuf::SingularField<::std::vec::Vec>, + size: ::std::option::Option, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Data_Node { + fn default() -> &'a Data_Node { + ::default_instance() + } +} + +impl Data_Node { + pub fn new() -> Data_Node { + ::std::default::Default::default() + } + + // required uint64 index = 1; + + + pub fn get_index(&self) -> u64 { + self.index.unwrap_or(0) + } + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u64) { + self.index = ::std::option::Option::Some(v); + } + + // required bytes hash = 2; + + + pub fn get_hash(&self) -> &[u8] { + match self.hash.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_hash(&mut self) { + self.hash.clear(); + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: ::std::vec::Vec) { + self.hash = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { + if self.hash.is_none() { + self.hash.set_default(); + } + self.hash.as_mut().unwrap() + } + + // Take field + pub fn take_hash(&mut self) -> ::std::vec::Vec { + self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required uint64 size = 3; + + + pub fn get_size(&self) -> u64 { + self.size.unwrap_or(0) + } + pub fn clear_size(&mut self) { + self.size = ::std::option::Option::None; + } + + pub fn has_size(&self) -> bool { + self.size.is_some() + } + + // Param is passed by value, moved + pub fn set_size(&mut self, v: u64) { + self.size = ::std::option::Option::Some(v); + } +} + +impl ::protobuf::Message for Data_Node { + fn is_initialized(&self) -> bool { + if self.index.is_none() { + return false; + } + if self.hash.is_none() { + return false; + } + if self.size.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.index = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.hash)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.size = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.index { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.size { + my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.index { + os.write_uint64(1, v)?; + } + if let Some(ref v) = self.hash.as_ref() { + os.write_bytes(2, &v)?; + } + if let Some(v) = self.size { + os.write_uint64(3, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Data_Node { + Data_Node::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + |m: &Data_Node| { &m.index }, + |m: &mut Data_Node| { &mut m.index }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "hash", + |m: &Data_Node| { &m.hash }, + |m: &mut Data_Node| { &mut m.hash }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "size", + |m: &Data_Node| { &m.size }, + |m: &mut Data_Node| { &mut m.size }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Data_Node", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Data_Node { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Data_Node, + }; + unsafe { + instance.get(Data_Node::new) + } + } +} + +impl ::protobuf::Clear for Data_Node { + fn clear(&mut self) { + self.index = ::std::option::Option::None; + self.hash.clear(); + self.size = ::std::option::Option::None; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Data_Node { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Data_Node { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Close { + // message fields + discoveryKey: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Close { + fn default() -> &'a Close { + ::default_instance() + } +} + +impl Close { + pub fn new() -> Close { + ::std::default::Default::default() + } + + // optional bytes discoveryKey = 1; + + + pub fn get_discoveryKey(&self) -> &[u8] { + match self.discoveryKey.as_ref() { + Some(v) => &v, + None => &[], + } + } + pub fn clear_discoveryKey(&mut self) { + self.discoveryKey.clear(); + } + + pub fn has_discoveryKey(&self) -> bool { + self.discoveryKey.is_some() + } + + // Param is passed by value, moved + pub fn set_discoveryKey(&mut self, v: ::std::vec::Vec) { + self.discoveryKey = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_discoveryKey(&mut self) -> &mut ::std::vec::Vec { + if self.discoveryKey.is_none() { + self.discoveryKey.set_default(); + } + self.discoveryKey.as_mut().unwrap() + } + + // Take field + pub fn take_discoveryKey(&mut self) -> ::std::vec::Vec { + self.discoveryKey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for Close { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.discoveryKey)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.discoveryKey.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.discoveryKey.as_ref() { + os.write_bytes(1, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Close { + Close::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "discoveryKey", + |m: &Close| { &m.discoveryKey }, + |m: &mut Close| { &mut m.discoveryKey }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Close", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Close { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Close, + }; + unsafe { + instance.get(Close::new) + } + } +} + +impl ::protobuf::Clear for Close { + fn clear(&mut self) { + self.discoveryKey.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Close { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Close { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\tlib.proto\x12\0\"!\n\x0cNoisePayload\x12\x0f\n\x05nonce\x18\x01\x20\ + \x02(\x0cB\0:\0\"6\n\x04Open\x12\x16\n\x0cdiscoveryKey\x18\x01\x20\x02(\ + \x0cB\0\x12\x14\n\ncapability\x18\x02\x20\x01(\x0cB\0:\0\"0\n\x07Options\ + \x12\x14\n\nextensions\x18\x01\x20\x03(\tB\0\x12\r\n\x03ack\x18\x02\x20\ + \x01(\x08B\0:\0\"6\n\x06Status\x12\x13\n\tuploading\x18\x01\x20\x01(\x08\ + B\0\x12\x15\n\x0bdownloading\x18\x02\x20\x01(\x08B\0:\0\"Q\n\x04Have\x12\ + \x0f\n\x05start\x18\x01\x20\x02(\x04B\0\x12\x13\n\x06length\x18\x02\x20\ + \x01(\x04:\x011B\0\x12\x12\n\x08bitfield\x18\x03\x20\x01(\x0cB\0\x12\r\n\ + \x03ack\x18\x04\x20\x01(\x08B\0:\0\"0\n\x06Unhave\x12\x0f\n\x05start\x18\ + \x01\x20\x02(\x04B\0\x12\x13\n\x06length\x18\x02\x20\x01(\x04:\x011B\0:\ + \0\"+\n\x04Want\x12\x0f\n\x05start\x18\x01\x20\x02(\x04B\0\x12\x10\n\x06\ + length\x18\x02\x20\x01(\x04B\0:\0\"-\n\x06Unwant\x12\x0f\n\x05start\x18\ + \x01\x20\x02(\x04B\0\x12\x10\n\x06length\x18\x02\x20\x01(\x04B\0:\0\"N\n\ + \x07Request\x12\x0f\n\x05index\x18\x01\x20\x02(\x04B\0\x12\x0f\n\x05byte\ + s\x18\x02\x20\x01(\x04B\0\x12\x0e\n\x04hash\x18\x03\x20\x01(\x08B\0\x12\ + \x0f\n\x05nodes\x18\x04\x20\x01(\x04B\0:\0\"<\n\x06Cancel\x12\x0f\n\x05i\ + ndex\x18\x01\x20\x02(\x04B\0\x12\x0f\n\x05bytes\x18\x02\x20\x01(\x04B\0\ + \x12\x0e\n\x04hash\x18\x03\x20\x01(\x08B\0:\0\"\x97\x01\n\x04Data\x12\ + \x0f\n\x05index\x18\x01\x20\x02(\x04B\0\x12\x0f\n\x05value\x18\x02\x20\ + \x01(\x0cB\0\x12\x1b\n\x05nodes\x18\x03\x20\x03(\x0b2\n.Data.NodeB\0\x12\ + \x13\n\tsignature\x18\x04\x20\x01(\x0cB\0\x1a9\n\x04Node\x12\x0f\n\x05in\ + dex\x18\x01\x20\x02(\x04B\0\x12\x0e\n\x04hash\x18\x02\x20\x02(\x0cB\0\ + \x12\x0e\n\x04size\x18\x03\x20\x02(\x04B\0:\0:\0\"!\n\x05Close\x12\x16\n\ + \x0cdiscoveryKey\x18\x01\x20\x01(\x0cB\0:\0B\0b\x06proto2\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/request.rs b/src/request.rs deleted file mode 100644 index c25ac87..0000000 --- a/src/request.rs +++ /dev/null @@ -1,337 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `request.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Request { - // message fields - index: ::std::option::Option, - bytes: ::std::option::Option, - hash: ::std::option::Option, - nodes: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Request { - fn default() -> &'a Request { - ::default_instance() - } -} - -impl Request { - pub fn new() -> Request { - ::std::default::Default::default() - } - - // required uint64 index = 1; - - - pub fn get_index(&self) -> u64 { - self.index.unwrap_or(0) - } - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u64) { - self.index = ::std::option::Option::Some(v); - } - - // optional uint64 bytes = 2; - - - pub fn get_bytes(&self) -> u64 { - self.bytes.unwrap_or(0) - } - pub fn clear_bytes(&mut self) { - self.bytes = ::std::option::Option::None; - } - - pub fn has_bytes(&self) -> bool { - self.bytes.is_some() - } - - // Param is passed by value, moved - pub fn set_bytes(&mut self, v: u64) { - self.bytes = ::std::option::Option::Some(v); - } - - // optional bool hash = 3; - - - pub fn get_hash(&self) -> bool { - self.hash.unwrap_or(false) - } - pub fn clear_hash(&mut self) { - self.hash = ::std::option::Option::None; - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: bool) { - self.hash = ::std::option::Option::Some(v); - } - - // optional uint64 nodes = 4; - - - pub fn get_nodes(&self) -> u64 { - self.nodes.unwrap_or(0) - } - pub fn clear_nodes(&mut self) { - self.nodes = ::std::option::Option::None; - } - - pub fn has_nodes(&self) -> bool { - self.nodes.is_some() - } - - // Param is passed by value, moved - pub fn set_nodes(&mut self, v: u64) { - self.nodes = ::std::option::Option::Some(v); - } -} - -impl ::protobuf::Message for Request { - fn is_initialized(&self) -> bool { - if self.index.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.index = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.bytes = ::std::option::Option::Some(tmp); - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.hash = ::std::option::Option::Some(tmp); - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.nodes = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.index { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.bytes { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.hash { - my_size += 2; - } - if let Some(v) = self.nodes { - my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.index { - os.write_uint64(1, v)?; - } - if let Some(v) = self.bytes { - os.write_uint64(2, v)?; - } - if let Some(v) = self.hash { - os.write_bool(3, v)?; - } - if let Some(v) = self.nodes { - os.write_uint64(4, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Request { - Request::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - |m: &Request| { &m.index }, - |m: &mut Request| { &mut m.index }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "bytes", - |m: &Request| { &m.bytes }, - |m: &mut Request| { &mut m.bytes }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "hash", - |m: &Request| { &m.hash }, - |m: &mut Request| { &mut m.hash }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "nodes", - |m: &Request| { &m.nodes }, - |m: &mut Request| { &mut m.nodes }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Request", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Request { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Request, - }; - unsafe { - instance.get(Request::new) - } - } -} - -impl ::protobuf::Clear for Request { - fn clear(&mut self) { - self.index = ::std::option::Option::None; - self.bytes = ::std::option::Option::None; - self.hash = ::std::option::Option::None; - self.nodes = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Request { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Request { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\rrequest.proto\x12\0\"N\n\x07Request\x12\x0f\n\x05index\x18\x01\x20\ - \x02(\x04B\0\x12\x0f\n\x05bytes\x18\x02\x20\x01(\x04B\0\x12\x0e\n\x04has\ - h\x18\x03\x20\x01(\x08B\0\x12\x0f\n\x05nodes\x18\x04\x20\x01(\x04B\0:\0B\ - \0b\x06proto2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/src/unhave.rs b/src/unhave.rs deleted file mode 100644 index 177922b..0000000 --- a/src/unhave.rs +++ /dev/null @@ -1,258 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `unhave.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Unhave { - // message fields - start: ::std::option::Option, - length: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Unhave { - fn default() -> &'a Unhave { - ::default_instance() - } -} - -impl Unhave { - pub fn new() -> Unhave { - ::std::default::Default::default() - } - - // required uint64 start = 1; - - - pub fn get_start(&self) -> u64 { - self.start.unwrap_or(0) - } - pub fn clear_start(&mut self) { - self.start = ::std::option::Option::None; - } - - pub fn has_start(&self) -> bool { - self.start.is_some() - } - - // Param is passed by value, moved - pub fn set_start(&mut self, v: u64) { - self.start = ::std::option::Option::Some(v); - } - - // optional uint64 length = 2; - - - pub fn get_length(&self) -> u64 { - self.length.unwrap_or(1u64) - } - pub fn clear_length(&mut self) { - self.length = ::std::option::Option::None; - } - - pub fn has_length(&self) -> bool { - self.length.is_some() - } - - // Param is passed by value, moved - pub fn set_length(&mut self, v: u64) { - self.length = ::std::option::Option::Some(v); - } -} - -impl ::protobuf::Message for Unhave { - fn is_initialized(&self) -> bool { - if self.start.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.length = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.start { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.length { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.start { - os.write_uint64(1, v)?; - } - if let Some(v) = self.length { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Unhave { - Unhave::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start", - |m: &Unhave| { &m.start }, - |m: &mut Unhave| { &mut m.start }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "length", - |m: &Unhave| { &m.length }, - |m: &mut Unhave| { &mut m.length }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Unhave", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Unhave { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Unhave, - }; - unsafe { - instance.get(Unhave::new) - } - } -} - -impl ::protobuf::Clear for Unhave { - fn clear(&mut self) { - self.start = ::std::option::Option::None; - self.length = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Unhave { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Unhave { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0cunhave.proto\x12\0\"0\n\x06Unhave\x12\x0f\n\x05start\x18\x01\x20\ - \x02(\x04B\0\x12\x13\n\x06length\x18\x02\x20\x01(\x04:\x011B\0:\0B\0b\ - \x06proto2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/src/unwant.rs b/src/unwant.rs deleted file mode 100644 index 9fcbf78..0000000 --- a/src/unwant.rs +++ /dev/null @@ -1,258 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `unwant.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Unwant { - // message fields - start: ::std::option::Option, - length: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Unwant { - fn default() -> &'a Unwant { - ::default_instance() - } -} - -impl Unwant { - pub fn new() -> Unwant { - ::std::default::Default::default() - } - - // required uint64 start = 1; - - - pub fn get_start(&self) -> u64 { - self.start.unwrap_or(0) - } - pub fn clear_start(&mut self) { - self.start = ::std::option::Option::None; - } - - pub fn has_start(&self) -> bool { - self.start.is_some() - } - - // Param is passed by value, moved - pub fn set_start(&mut self, v: u64) { - self.start = ::std::option::Option::Some(v); - } - - // optional uint64 length = 2; - - - pub fn get_length(&self) -> u64 { - self.length.unwrap_or(0) - } - pub fn clear_length(&mut self) { - self.length = ::std::option::Option::None; - } - - pub fn has_length(&self) -> bool { - self.length.is_some() - } - - // Param is passed by value, moved - pub fn set_length(&mut self, v: u64) { - self.length = ::std::option::Option::Some(v); - } -} - -impl ::protobuf::Message for Unwant { - fn is_initialized(&self) -> bool { - if self.start.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.length = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.start { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.length { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.start { - os.write_uint64(1, v)?; - } - if let Some(v) = self.length { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Unwant { - Unwant::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start", - |m: &Unwant| { &m.start }, - |m: &mut Unwant| { &mut m.start }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "length", - |m: &Unwant| { &m.length }, - |m: &mut Unwant| { &mut m.length }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Unwant", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Unwant { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Unwant, - }; - unsafe { - instance.get(Unwant::new) - } - } -} - -impl ::protobuf::Clear for Unwant { - fn clear(&mut self) { - self.start = ::std::option::Option::None; - self.length = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Unwant { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Unwant { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0cunwant.proto\x12\0\"-\n\x06Unwant\x12\x0f\n\x05start\x18\x01\x20\ - \x02(\x04B\0\x12\x10\n\x06length\x18\x02\x20\x01(\x04B\0:\0B\0b\x06proto\ - 2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/src/want.rs b/src/want.rs deleted file mode 100644 index ff1c0bd..0000000 --- a/src/want.rs +++ /dev/null @@ -1,257 +0,0 @@ -// This file is generated by rust-protobuf 2.10.1. Do not edit -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] -//! Generated file from `want.proto` - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; - -#[derive(PartialEq,Clone,Default)] -pub struct Want { - // message fields - start: ::std::option::Option, - length: ::std::option::Option, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a Want { - fn default() -> &'a Want { - ::default_instance() - } -} - -impl Want { - pub fn new() -> Want { - ::std::default::Default::default() - } - - // required uint64 start = 1; - - - pub fn get_start(&self) -> u64 { - self.start.unwrap_or(0) - } - pub fn clear_start(&mut self) { - self.start = ::std::option::Option::None; - } - - pub fn has_start(&self) -> bool { - self.start.is_some() - } - - // Param is passed by value, moved - pub fn set_start(&mut self, v: u64) { - self.start = ::std::option::Option::Some(v); - } - - // optional uint64 length = 2; - - - pub fn get_length(&self) -> u64 { - self.length.unwrap_or(0) - } - pub fn clear_length(&mut self) { - self.length = ::std::option::Option::None; - } - - pub fn has_length(&self) -> bool { - self.length.is_some() - } - - // Param is passed by value, moved - pub fn set_length(&mut self, v: u64) { - self.length = ::std::option::Option::Some(v); - } -} - -impl ::protobuf::Message for Want { - fn is_initialized(&self) -> bool { - if self.start.is_none() { - return false; - } - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.length = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.start { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.length { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.start { - os.write_uint64(1, v)?; - } - if let Some(v) = self.length { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Want { - Want::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start", - |m: &Want| { &m.start }, - |m: &mut Want| { &mut m.start }, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "length", - |m: &Want| { &m.length }, - |m: &mut Want| { &mut m.length }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Want", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static Want { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Want, - }; - unsafe { - instance.get(Want::new) - } - } -} - -impl ::protobuf::Clear for Want { - fn clear(&mut self) { - self.start = ::std::option::Option::None; - self.length = ::std::option::Option::None; - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Want { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Want { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\nwant.proto\x12\0\"+\n\x04Want\x12\x0f\n\x05start\x18\x01\x20\x02(\ - \x04B\0\x12\x10\n\x06length\x18\x02\x20\x01(\x04B\0:\0B\0b\x06proto2\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -}