diff --git a/core/Cargo.toml b/core/Cargo.toml index 31e24fc2..265e504a 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -13,7 +13,7 @@ multihash = { path = "../multihash" } multistream-select = { path = "../multistream-select" } futures = { version = "0.1", features = ["use_std"] } parking_lot = "0.5.3" -protobuf = "1.7" +protobuf = "2.0.2" quick-error = "1.2" smallvec = "0.5" tokio-io = "0.1" diff --git a/core/regen_structs_proto.sh b/core/regen_structs_proto.sh index fbba5649..e1f75a97 100755 --- a/core/regen_structs_proto.sh +++ b/core/regen_structs_proto.sh @@ -6,7 +6,8 @@ sudo docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \ apt-get update; \ apt-get install -y protobuf-compiler; \ - cargo install --version 1 protobuf; \ + cargo install --version 2.0.2 protobuf-codegen; \ protoc --rust_out . keys.proto" +sudo chown $USER:$USER keys.rs mv -f keys.rs ./src/keys_proto.rs diff --git a/core/src/keys_proto.rs b/core/src/keys_proto.rs index ff5ed486..f0ba4435 100644 --- a/core/src/keys_proto.rs +++ b/core/src/keys_proto.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.2. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -31,24 +31,11 @@ pub struct PublicKey { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PublicKey {} - impl PublicKey { pub fn new() -> PublicKey { ::std::default::Default::default() } - pub fn default_instance() -> &'static PublicKey { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PublicKey, - }; - unsafe { - instance.get(PublicKey::new) - } - } - // required .KeyType Type = 1; pub fn clear_Type(&mut self) { @@ -68,14 +55,6 @@ impl PublicKey { self.Type.unwrap_or(KeyType::RSA) } - fn get_Type_for_reflect(&self) -> &::std::option::Option { - &self.Type - } - - fn mut_Type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.Type - } - // required bytes Data = 2; pub fn clear_Data(&mut self) { @@ -111,14 +90,6 @@ impl PublicKey { None => &[], } } - - fn get_Data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.Data - } - - fn mut_Data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.Data - } } impl ::protobuf::Message for PublicKey { @@ -199,16 +170,14 @@ impl ::protobuf::Message for PublicKey { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for PublicKey { fn new() -> PublicKey { PublicKey::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -218,13 +187,13 @@ impl ::protobuf::MessageStatic for PublicKey { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "Type", - PublicKey::get_Type_for_reflect, - PublicKey::mut_Type_for_reflect, + |m: &PublicKey| { &m.Type }, + |m: &mut PublicKey| { &mut m.Type }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "Data", - PublicKey::get_Data_for_reflect, - PublicKey::mut_Data_for_reflect, + |m: &PublicKey| { &m.Data }, + |m: &mut PublicKey| { &mut m.Data }, )); ::protobuf::reflect::MessageDescriptor::new::( "PublicKey", @@ -234,6 +203,16 @@ impl ::protobuf::MessageStatic for PublicKey { }) } } + + fn default_instance() -> &'static PublicKey { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PublicKey, + }; + unsafe { + instance.get(PublicKey::new) + } + } } impl ::protobuf::Clear for PublicKey { @@ -266,24 +245,11 @@ pub struct PrivateKey { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PrivateKey {} - impl PrivateKey { pub fn new() -> PrivateKey { ::std::default::Default::default() } - pub fn default_instance() -> &'static PrivateKey { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PrivateKey, - }; - unsafe { - instance.get(PrivateKey::new) - } - } - // required .KeyType Type = 1; pub fn clear_Type(&mut self) { @@ -303,14 +269,6 @@ impl PrivateKey { self.Type.unwrap_or(KeyType::RSA) } - fn get_Type_for_reflect(&self) -> &::std::option::Option { - &self.Type - } - - fn mut_Type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.Type - } - // required bytes Data = 2; pub fn clear_Data(&mut self) { @@ -346,14 +304,6 @@ impl PrivateKey { None => &[], } } - - fn get_Data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.Data - } - - fn mut_Data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.Data - } } impl ::protobuf::Message for PrivateKey { @@ -434,16 +384,14 @@ impl ::protobuf::Message for PrivateKey { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for PrivateKey { fn new() -> PrivateKey { PrivateKey::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -453,13 +401,13 @@ impl ::protobuf::MessageStatic for PrivateKey { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "Type", - PrivateKey::get_Type_for_reflect, - PrivateKey::mut_Type_for_reflect, + |m: &PrivateKey| { &m.Type }, + |m: &mut PrivateKey| { &mut m.Type }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "Data", - PrivateKey::get_Data_for_reflect, - PrivateKey::mut_Data_for_reflect, + |m: &PrivateKey| { &m.Data }, + |m: &mut PrivateKey| { &mut m.Data }, )); ::protobuf::reflect::MessageDescriptor::new::( "PrivateKey", @@ -469,6 +417,16 @@ impl ::protobuf::MessageStatic for PrivateKey { }) } } + + fn default_instance() -> &'static PrivateKey { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PrivateKey, + }; + unsafe { + instance.get(PrivateKey::new) + } + } } impl ::protobuf::Clear for PrivateKey { @@ -521,7 +479,7 @@ impl ::protobuf::ProtobufEnum for KeyType { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, diff --git a/floodsub/Cargo.toml b/floodsub/Cargo.toml index b25bb785..15d87f67 100644 --- a/floodsub/Cargo.toml +++ b/floodsub/Cargo.toml @@ -13,7 +13,7 @@ libp2p-core = { path = "../core" } log = "0.4.1" multiaddr = { path = "../multiaddr" } parking_lot = "0.5.3" -protobuf = "1" +protobuf = "2.0.2" smallvec = "0.6.0" tokio-codec = "0.1" tokio-io = "0.1" diff --git a/floodsub/regen_structs_proto.sh b/floodsub/regen_structs_proto.sh index a813ebc4..054ae5cd 100755 --- a/floodsub/regen_structs_proto.sh +++ b/floodsub/regen_structs_proto.sh @@ -5,7 +5,9 @@ docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \ apt-get update; \ apt-get install -y protobuf-compiler; \ - cargo install --version 1 protobuf; \ + cargo install --version 2.0.2 protobuf-codegen; \ protoc --rust_out . rpc.proto" +sudo chown $USER:$USER *.rs + mv -f rpc.rs ./src/rpc_proto.rs diff --git a/floodsub/src/rpc_proto.rs b/floodsub/src/rpc_proto.rs index fd6d2045..9976669e 100644 --- a/floodsub/src/rpc_proto.rs +++ b/floodsub/src/rpc_proto.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.2. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -31,24 +31,11 @@ pub struct RPC { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RPC {} - impl RPC { pub fn new() -> RPC { ::std::default::Default::default() } - pub fn default_instance() -> &'static RPC { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RPC, - }; - unsafe { - instance.get(RPC::new) - } - } - // repeated .floodsub.pb.RPC.SubOpts subscriptions = 1; pub fn clear_subscriptions(&mut self) { @@ -74,14 +61,6 @@ impl RPC { &self.subscriptions } - fn get_subscriptions_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.subscriptions - } - - fn mut_subscriptions_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.subscriptions - } - // repeated .floodsub.pb.Message publish = 2; pub fn clear_publish(&mut self) { @@ -106,14 +85,6 @@ impl RPC { pub fn get_publish(&self) -> &[Message] { &self.publish } - - fn get_publish_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.publish - } - - fn mut_publish_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.publish - } } impl ::protobuf::Message for RPC { @@ -204,16 +175,14 @@ impl ::protobuf::Message for RPC { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for RPC { fn new() -> RPC { RPC::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -223,13 +192,13 @@ impl ::protobuf::MessageStatic for RPC { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "subscriptions", - RPC::get_subscriptions_for_reflect, - RPC::mut_subscriptions_for_reflect, + |m: &RPC| { &m.subscriptions }, + |m: &mut RPC| { &mut m.subscriptions }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "publish", - RPC::get_publish_for_reflect, - RPC::mut_publish_for_reflect, + |m: &RPC| { &m.publish }, + |m: &mut RPC| { &mut m.publish }, )); ::protobuf::reflect::MessageDescriptor::new::( "RPC", @@ -239,6 +208,16 @@ impl ::protobuf::MessageStatic for RPC { }) } } + + fn default_instance() -> &'static RPC { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RPC, + }; + unsafe { + instance.get(RPC::new) + } + } } impl ::protobuf::Clear for RPC { @@ -271,24 +250,11 @@ pub struct RPC_SubOpts { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RPC_SubOpts {} - impl RPC_SubOpts { pub fn new() -> RPC_SubOpts { ::std::default::Default::default() } - pub fn default_instance() -> &'static RPC_SubOpts { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RPC_SubOpts, - }; - unsafe { - instance.get(RPC_SubOpts::new) - } - } - // optional bool subscribe = 1; pub fn clear_subscribe(&mut self) { @@ -308,14 +274,6 @@ impl RPC_SubOpts { self.subscribe.unwrap_or(false) } - fn get_subscribe_for_reflect(&self) -> &::std::option::Option { - &self.subscribe - } - - fn mut_subscribe_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.subscribe - } - // optional string topicid = 2; pub fn clear_topicid(&mut self) { @@ -351,14 +309,6 @@ impl RPC_SubOpts { None => "", } } - - fn get_topicid_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.topicid - } - - fn mut_topicid_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.topicid - } } impl ::protobuf::Message for RPC_SubOpts { @@ -437,16 +387,14 @@ impl ::protobuf::Message for RPC_SubOpts { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for RPC_SubOpts { fn new() -> RPC_SubOpts { RPC_SubOpts::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -456,13 +404,13 @@ impl ::protobuf::MessageStatic for RPC_SubOpts { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( "subscribe", - RPC_SubOpts::get_subscribe_for_reflect, - RPC_SubOpts::mut_subscribe_for_reflect, + |m: &RPC_SubOpts| { &m.subscribe }, + |m: &mut RPC_SubOpts| { &mut m.subscribe }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "topicid", - RPC_SubOpts::get_topicid_for_reflect, - RPC_SubOpts::mut_topicid_for_reflect, + |m: &RPC_SubOpts| { &m.topicid }, + |m: &mut RPC_SubOpts| { &mut m.topicid }, )); ::protobuf::reflect::MessageDescriptor::new::( "RPC_SubOpts", @@ -472,6 +420,16 @@ impl ::protobuf::MessageStatic for RPC_SubOpts { }) } } + + fn default_instance() -> &'static RPC_SubOpts { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RPC_SubOpts, + }; + unsafe { + instance.get(RPC_SubOpts::new) + } + } } impl ::protobuf::Clear for RPC_SubOpts { @@ -506,24 +464,11 @@ pub struct Message { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Message {} - impl Message { pub fn new() -> Message { ::std::default::Default::default() } - pub fn default_instance() -> &'static Message { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Message, - }; - unsafe { - instance.get(Message::new) - } - } - // optional bytes from = 1; pub fn clear_from(&mut self) { @@ -560,14 +505,6 @@ impl Message { } } - fn get_from_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.from - } - - fn mut_from_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.from - } - // optional bytes data = 2; pub fn clear_data(&mut self) { @@ -604,14 +541,6 @@ impl Message { } } - fn get_data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.data - } - - fn mut_data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.data - } - // optional bytes seqno = 3; pub fn clear_seqno(&mut self) { @@ -648,14 +577,6 @@ impl Message { } } - fn get_seqno_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.seqno - } - - fn mut_seqno_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.seqno - } - // repeated string topicIDs = 4; pub fn clear_topicIDs(&mut self) { @@ -680,14 +601,6 @@ impl Message { pub fn get_topicIDs(&self) -> &[::std::string::String] { &self.topicIDs } - - fn get_topicIDs_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> { - &self.topicIDs - } - - fn mut_topicIDs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.topicIDs - } } impl ::protobuf::Message for Message { @@ -780,16 +693,14 @@ impl ::protobuf::Message for Message { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Message { fn new() -> Message { Message::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -799,23 +710,23 @@ impl ::protobuf::MessageStatic for Message { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "from", - Message::get_from_for_reflect, - Message::mut_from_for_reflect, + |m: &Message| { &m.from }, + |m: &mut Message| { &mut m.from }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "data", - Message::get_data_for_reflect, - Message::mut_data_for_reflect, + |m: &Message| { &m.data }, + |m: &mut Message| { &mut m.data }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "seqno", - Message::get_seqno_for_reflect, - Message::mut_seqno_for_reflect, + |m: &Message| { &m.seqno }, + |m: &mut Message| { &mut m.seqno }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "topicIDs", - Message::get_topicIDs_for_reflect, - Message::mut_topicIDs_for_reflect, + |m: &Message| { &m.topicIDs }, + |m: &mut Message| { &mut m.topicIDs }, )); ::protobuf::reflect::MessageDescriptor::new::( "Message", @@ -825,6 +736,16 @@ impl ::protobuf::MessageStatic for Message { }) } } + + fn default_instance() -> &'static Message { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Message, + }; + unsafe { + instance.get(Message::new) + } + } } impl ::protobuf::Clear for Message { @@ -860,24 +781,11 @@ pub struct TopicDescriptor { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TopicDescriptor {} - impl TopicDescriptor { pub fn new() -> TopicDescriptor { ::std::default::Default::default() } - pub fn default_instance() -> &'static TopicDescriptor { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TopicDescriptor, - }; - unsafe { - instance.get(TopicDescriptor::new) - } - } - // optional string name = 1; pub fn clear_name(&mut self) { @@ -914,14 +822,6 @@ impl TopicDescriptor { } } - fn get_name_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.name - } - - fn mut_name_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.name - } - // optional .floodsub.pb.TopicDescriptor.AuthOpts auth = 2; pub fn clear_auth(&mut self) { @@ -955,14 +855,6 @@ impl TopicDescriptor { self.auth.as_ref().unwrap_or_else(|| TopicDescriptor_AuthOpts::default_instance()) } - fn get_auth_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.auth - } - - fn mut_auth_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.auth - } - // optional .floodsub.pb.TopicDescriptor.EncOpts enc = 3; pub fn clear_enc(&mut self) { @@ -995,14 +887,6 @@ impl TopicDescriptor { pub fn get_enc(&self) -> &TopicDescriptor_EncOpts { self.enc.as_ref().unwrap_or_else(|| TopicDescriptor_EncOpts::default_instance()) } - - fn get_enc_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.enc - } - - fn mut_enc_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.enc - } } impl ::protobuf::Message for TopicDescriptor { @@ -1102,16 +986,14 @@ impl ::protobuf::Message for TopicDescriptor { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for TopicDescriptor { fn new() -> TopicDescriptor { TopicDescriptor::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -1121,18 +1003,18 @@ impl ::protobuf::MessageStatic for TopicDescriptor { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "name", - TopicDescriptor::get_name_for_reflect, - TopicDescriptor::mut_name_for_reflect, + |m: &TopicDescriptor| { &m.name }, + |m: &mut TopicDescriptor| { &mut m.name }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "auth", - TopicDescriptor::get_auth_for_reflect, - TopicDescriptor::mut_auth_for_reflect, + |m: &TopicDescriptor| { &m.auth }, + |m: &mut TopicDescriptor| { &mut m.auth }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "enc", - TopicDescriptor::get_enc_for_reflect, - TopicDescriptor::mut_enc_for_reflect, + |m: &TopicDescriptor| { &m.enc }, + |m: &mut TopicDescriptor| { &mut m.enc }, )); ::protobuf::reflect::MessageDescriptor::new::( "TopicDescriptor", @@ -1142,6 +1024,16 @@ impl ::protobuf::MessageStatic for TopicDescriptor { }) } } + + fn default_instance() -> &'static TopicDescriptor { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TopicDescriptor, + }; + unsafe { + instance.get(TopicDescriptor::new) + } + } } impl ::protobuf::Clear for TopicDescriptor { @@ -1175,24 +1067,11 @@ pub struct TopicDescriptor_AuthOpts { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TopicDescriptor_AuthOpts {} - impl TopicDescriptor_AuthOpts { pub fn new() -> TopicDescriptor_AuthOpts { ::std::default::Default::default() } - pub fn default_instance() -> &'static TopicDescriptor_AuthOpts { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TopicDescriptor_AuthOpts, - }; - unsafe { - instance.get(TopicDescriptor_AuthOpts::new) - } - } - // optional .floodsub.pb.TopicDescriptor.AuthOpts.AuthMode mode = 1; pub fn clear_mode(&mut self) { @@ -1212,14 +1091,6 @@ impl TopicDescriptor_AuthOpts { self.mode.unwrap_or(TopicDescriptor_AuthOpts_AuthMode::NONE) } - fn get_mode_for_reflect(&self) -> &::std::option::Option { - &self.mode - } - - fn mut_mode_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.mode - } - // repeated bytes keys = 2; pub fn clear_keys(&mut self) { @@ -1244,14 +1115,6 @@ impl TopicDescriptor_AuthOpts { pub fn get_keys(&self) -> &[::std::vec::Vec] { &self.keys } - - fn get_keys_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.keys - } - - fn mut_keys_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keys - } } impl ::protobuf::Message for TopicDescriptor_AuthOpts { @@ -1326,16 +1189,14 @@ impl ::protobuf::Message for TopicDescriptor_AuthOpts { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for TopicDescriptor_AuthOpts { fn new() -> TopicDescriptor_AuthOpts { TopicDescriptor_AuthOpts::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -1345,13 +1206,13 @@ impl ::protobuf::MessageStatic for TopicDescriptor_AuthOpts { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "mode", - TopicDescriptor_AuthOpts::get_mode_for_reflect, - TopicDescriptor_AuthOpts::mut_mode_for_reflect, + |m: &TopicDescriptor_AuthOpts| { &m.mode }, + |m: &mut TopicDescriptor_AuthOpts| { &mut m.mode }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "keys", - TopicDescriptor_AuthOpts::get_keys_for_reflect, - TopicDescriptor_AuthOpts::mut_keys_for_reflect, + |m: &TopicDescriptor_AuthOpts| { &m.keys }, + |m: &mut TopicDescriptor_AuthOpts| { &mut m.keys }, )); ::protobuf::reflect::MessageDescriptor::new::( "TopicDescriptor_AuthOpts", @@ -1361,6 +1222,16 @@ impl ::protobuf::MessageStatic for TopicDescriptor_AuthOpts { }) } } + + fn default_instance() -> &'static TopicDescriptor_AuthOpts { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TopicDescriptor_AuthOpts, + }; + unsafe { + instance.get(TopicDescriptor_AuthOpts::new) + } + } } impl ::protobuf::Clear for TopicDescriptor_AuthOpts { @@ -1413,7 +1284,7 @@ impl ::protobuf::ProtobufEnum for TopicDescriptor_AuthOpts_AuthMode { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, @@ -1445,24 +1316,11 @@ pub struct TopicDescriptor_EncOpts { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TopicDescriptor_EncOpts {} - impl TopicDescriptor_EncOpts { pub fn new() -> TopicDescriptor_EncOpts { ::std::default::Default::default() } - pub fn default_instance() -> &'static TopicDescriptor_EncOpts { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TopicDescriptor_EncOpts, - }; - unsafe { - instance.get(TopicDescriptor_EncOpts::new) - } - } - // optional .floodsub.pb.TopicDescriptor.EncOpts.EncMode mode = 1; pub fn clear_mode(&mut self) { @@ -1482,14 +1340,6 @@ impl TopicDescriptor_EncOpts { self.mode.unwrap_or(TopicDescriptor_EncOpts_EncMode::NONE) } - fn get_mode_for_reflect(&self) -> &::std::option::Option { - &self.mode - } - - fn mut_mode_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.mode - } - // repeated bytes keyHashes = 2; pub fn clear_keyHashes(&mut self) { @@ -1514,14 +1364,6 @@ impl TopicDescriptor_EncOpts { pub fn get_keyHashes(&self) -> &[::std::vec::Vec] { &self.keyHashes } - - fn get_keyHashes_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.keyHashes - } - - fn mut_keyHashes_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keyHashes - } } impl ::protobuf::Message for TopicDescriptor_EncOpts { @@ -1596,16 +1438,14 @@ impl ::protobuf::Message for TopicDescriptor_EncOpts { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for TopicDescriptor_EncOpts { fn new() -> TopicDescriptor_EncOpts { TopicDescriptor_EncOpts::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -1615,13 +1455,13 @@ impl ::protobuf::MessageStatic for TopicDescriptor_EncOpts { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "mode", - TopicDescriptor_EncOpts::get_mode_for_reflect, - TopicDescriptor_EncOpts::mut_mode_for_reflect, + |m: &TopicDescriptor_EncOpts| { &m.mode }, + |m: &mut TopicDescriptor_EncOpts| { &mut m.mode }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "keyHashes", - TopicDescriptor_EncOpts::get_keyHashes_for_reflect, - TopicDescriptor_EncOpts::mut_keyHashes_for_reflect, + |m: &TopicDescriptor_EncOpts| { &m.keyHashes }, + |m: &mut TopicDescriptor_EncOpts| { &mut m.keyHashes }, )); ::protobuf::reflect::MessageDescriptor::new::( "TopicDescriptor_EncOpts", @@ -1631,6 +1471,16 @@ impl ::protobuf::MessageStatic for TopicDescriptor_EncOpts { }) } } + + fn default_instance() -> &'static TopicDescriptor_EncOpts { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TopicDescriptor_EncOpts, + }; + unsafe { + instance.get(TopicDescriptor_EncOpts::new) + } + } } impl ::protobuf::Clear for TopicDescriptor_EncOpts { @@ -1683,7 +1533,7 @@ impl ::protobuf::ProtobufEnum for TopicDescriptor_EncOpts_EncMode { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, diff --git a/identify/Cargo.toml b/identify/Cargo.toml index dc0415a1..bbeffa6e 100644 --- a/identify/Cargo.toml +++ b/identify/Cargo.toml @@ -10,7 +10,7 @@ libp2p-peerstore = { path = "../peerstore" } libp2p-core = { path = "../core" } log = "0.4.1" multiaddr = { path = "../multiaddr" } -protobuf = "1" +protobuf = "2.0.2" tokio-codec = "0.1" tokio-io = "0.1.0" varint = { path = "../varint-rs" } diff --git a/identify/regen_structs_proto.sh b/identify/regen_structs_proto.sh index bdb4ef3b..3a4354ed 100755 --- a/identify/regen_structs_proto.sh +++ b/identify/regen_structs_proto.sh @@ -5,7 +5,9 @@ sudo docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \ apt-get update; \ apt-get install -y protobuf-compiler; \ - cargo install --version 1 protobuf; \ + cargo install --version 2.0.2 protobuf-codegen; \ protoc --rust_out . structs.proto" +sudo chown $USER:$USER *.rs + mv -f structs.rs ./src/structs_proto.rs diff --git a/identify/src/structs_proto.rs b/identify/src/structs_proto.rs index 616a5b94..6267f2f8 100644 --- a/identify/src/structs_proto.rs +++ b/identify/src/structs_proto.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.2. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -35,24 +35,11 @@ pub struct Identify { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Identify {} - impl Identify { pub fn new() -> Identify { ::std::default::Default::default() } - pub fn default_instance() -> &'static Identify { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Identify, - }; - unsafe { - instance.get(Identify::new) - } - } - // optional string protocolVersion = 5; pub fn clear_protocolVersion(&mut self) { @@ -89,14 +76,6 @@ impl Identify { } } - fn get_protocolVersion_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.protocolVersion - } - - fn mut_protocolVersion_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.protocolVersion - } - // optional string agentVersion = 6; pub fn clear_agentVersion(&mut self) { @@ -133,14 +112,6 @@ impl Identify { } } - fn get_agentVersion_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.agentVersion - } - - fn mut_agentVersion_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.agentVersion - } - // optional bytes publicKey = 1; pub fn clear_publicKey(&mut self) { @@ -177,14 +148,6 @@ impl Identify { } } - fn get_publicKey_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.publicKey - } - - fn mut_publicKey_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.publicKey - } - // repeated bytes listenAddrs = 2; pub fn clear_listenAddrs(&mut self) { @@ -210,14 +173,6 @@ impl Identify { &self.listenAddrs } - fn get_listenAddrs_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.listenAddrs - } - - fn mut_listenAddrs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.listenAddrs - } - // optional bytes observedAddr = 4; pub fn clear_observedAddr(&mut self) { @@ -254,14 +209,6 @@ impl Identify { } } - fn get_observedAddr_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.observedAddr - } - - fn mut_observedAddr_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.observedAddr - } - // repeated string protocols = 3; pub fn clear_protocols(&mut self) { @@ -286,14 +233,6 @@ impl Identify { pub fn get_protocols(&self) -> &[::std::string::String] { &self.protocols } - - fn get_protocols_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> { - &self.protocols - } - - fn mut_protocols_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.protocols - } } impl ::protobuf::Message for Identify { @@ -404,16 +343,14 @@ impl ::protobuf::Message for Identify { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Identify { fn new() -> Identify { Identify::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -423,33 +360,33 @@ impl ::protobuf::MessageStatic for Identify { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "protocolVersion", - Identify::get_protocolVersion_for_reflect, - Identify::mut_protocolVersion_for_reflect, + |m: &Identify| { &m.protocolVersion }, + |m: &mut Identify| { &mut m.protocolVersion }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "agentVersion", - Identify::get_agentVersion_for_reflect, - Identify::mut_agentVersion_for_reflect, + |m: &Identify| { &m.agentVersion }, + |m: &mut Identify| { &mut m.agentVersion }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "publicKey", - Identify::get_publicKey_for_reflect, - Identify::mut_publicKey_for_reflect, + |m: &Identify| { &m.publicKey }, + |m: &mut Identify| { &mut m.publicKey }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "listenAddrs", - Identify::get_listenAddrs_for_reflect, - Identify::mut_listenAddrs_for_reflect, + |m: &Identify| { &m.listenAddrs }, + |m: &mut Identify| { &mut m.listenAddrs }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "observedAddr", - Identify::get_observedAddr_for_reflect, - Identify::mut_observedAddr_for_reflect, + |m: &Identify| { &m.observedAddr }, + |m: &mut Identify| { &mut m.observedAddr }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "protocols", - Identify::get_protocols_for_reflect, - Identify::mut_protocols_for_reflect, + |m: &Identify| { &m.protocols }, + |m: &mut Identify| { &mut m.protocols }, )); ::protobuf::reflect::MessageDescriptor::new::( "Identify", @@ -459,6 +396,16 @@ impl ::protobuf::MessageStatic for Identify { }) } } + + fn default_instance() -> &'static Identify { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Identify, + }; + unsafe { + instance.get(Identify::new) + } + } } impl ::protobuf::Clear for Identify { diff --git a/kad/Cargo.toml b/kad/Cargo.toml index 02230bb9..3461bca3 100644 --- a/kad/Cargo.toml +++ b/kad/Cargo.toml @@ -17,7 +17,7 @@ libp2p-core = { path = "../core" } log = "0.4" multiaddr = { path = "../multiaddr" } parking_lot = "0.5.1" -protobuf = "1" +protobuf = "2.0.2" rand = "0.4.2" smallvec = "0.5" tokio-codec = "0.1" diff --git a/kad/regen_dht_proto.sh b/kad/regen_dht_proto.sh index 0b17016b..5a65b733 100755 --- a/kad/regen_dht_proto.sh +++ b/kad/regen_dht_proto.sh @@ -5,9 +5,11 @@ docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \ apt-get update; \ apt-get install -y protobuf-compiler; \ - cargo install --version 1 protobuf; \ + cargo install --version 2.0.2 protobuf-codegen; \ protoc --rust_out . dht.proto;\ protoc --rust_out . record.proto" +sudo chown $USER:$USER *.rs + mv -f dht.rs ./src/protobuf_structs/dht.rs mv -f record.rs ./src/protobuf_structs/record.rs diff --git a/kad/src/protobuf_structs/dht.rs b/kad/src/protobuf_structs/dht.rs index c7af18e5..608a0ad4 100644 --- a/kad/src/protobuf_structs/dht.rs +++ b/kad/src/protobuf_structs/dht.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.2. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -35,24 +35,11 @@ pub struct Message { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Message {} - impl Message { pub fn new() -> Message { ::std::default::Default::default() } - pub fn default_instance() -> &'static Message { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Message, - }; - unsafe { - instance.get(Message::new) - } - } - // optional .dht.pb.Message.MessageType type = 1; pub fn clear_field_type(&mut self) { @@ -72,14 +59,6 @@ impl Message { self.field_type.unwrap_or(Message_MessageType::PUT_VALUE) } - fn get_field_type_for_reflect(&self) -> &::std::option::Option { - &self.field_type - } - - fn mut_field_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.field_type - } - // optional int32 clusterLevelRaw = 10; pub fn clear_clusterLevelRaw(&mut self) { @@ -99,14 +78,6 @@ impl Message { self.clusterLevelRaw.unwrap_or(0) } - fn get_clusterLevelRaw_for_reflect(&self) -> &::std::option::Option { - &self.clusterLevelRaw - } - - fn mut_clusterLevelRaw_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.clusterLevelRaw - } - // optional bytes key = 2; pub fn clear_key(&mut self) { @@ -143,14 +114,6 @@ impl Message { } } - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.key - } - // optional .record.pb.Record record = 3; pub fn clear_record(&mut self) { @@ -184,14 +147,6 @@ impl Message { self.record.as_ref().unwrap_or_else(|| super::record::Record::default_instance()) } - fn get_record_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.record - } - - fn mut_record_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.record - } - // repeated .dht.pb.Message.Peer closerPeers = 8; pub fn clear_closerPeers(&mut self) { @@ -217,14 +172,6 @@ impl Message { &self.closerPeers } - fn get_closerPeers_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.closerPeers - } - - fn mut_closerPeers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.closerPeers - } - // repeated .dht.pb.Message.Peer providerPeers = 9; pub fn clear_providerPeers(&mut self) { @@ -249,14 +196,6 @@ impl Message { pub fn get_providerPeers(&self) -> &[Message_Peer] { &self.providerPeers } - - fn get_providerPeers_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.providerPeers - } - - fn mut_providerPeers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.providerPeers - } } impl ::protobuf::Message for Message { @@ -395,16 +334,14 @@ impl ::protobuf::Message for Message { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Message { fn new() -> Message { Message::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -414,33 +351,33 @@ impl ::protobuf::MessageStatic for Message { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "type", - Message::get_field_type_for_reflect, - Message::mut_field_type_for_reflect, + |m: &Message| { &m.field_type }, + |m: &mut Message| { &mut m.field_type }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( "clusterLevelRaw", - Message::get_clusterLevelRaw_for_reflect, - Message::mut_clusterLevelRaw_for_reflect, + |m: &Message| { &m.clusterLevelRaw }, + |m: &mut Message| { &mut m.clusterLevelRaw }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "key", - Message::get_key_for_reflect, - Message::mut_key_for_reflect, + |m: &Message| { &m.key }, + |m: &mut Message| { &mut m.key }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "record", - Message::get_record_for_reflect, - Message::mut_record_for_reflect, + |m: &Message| { &m.record }, + |m: &mut Message| { &mut m.record }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "closerPeers", - Message::get_closerPeers_for_reflect, - Message::mut_closerPeers_for_reflect, + |m: &Message| { &m.closerPeers }, + |m: &mut Message| { &mut m.closerPeers }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "providerPeers", - Message::get_providerPeers_for_reflect, - Message::mut_providerPeers_for_reflect, + |m: &Message| { &m.providerPeers }, + |m: &mut Message| { &mut m.providerPeers }, )); ::protobuf::reflect::MessageDescriptor::new::( "Message", @@ -450,6 +387,16 @@ impl ::protobuf::MessageStatic for Message { }) } } + + fn default_instance() -> &'static Message { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Message, + }; + unsafe { + instance.get(Message::new) + } + } } impl ::protobuf::Clear for Message { @@ -487,24 +434,11 @@ pub struct Message_Peer { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Message_Peer {} - impl Message_Peer { pub fn new() -> Message_Peer { ::std::default::Default::default() } - pub fn default_instance() -> &'static Message_Peer { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Message_Peer, - }; - unsafe { - instance.get(Message_Peer::new) - } - } - // optional bytes id = 1; pub fn clear_id(&mut self) { @@ -541,14 +475,6 @@ impl Message_Peer { } } - fn get_id_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.id - } - - fn mut_id_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.id - } - // repeated bytes addrs = 2; pub fn clear_addrs(&mut self) { @@ -574,14 +500,6 @@ impl Message_Peer { &self.addrs } - fn get_addrs_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.addrs - } - - fn mut_addrs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.addrs - } - // optional .dht.pb.Message.ConnectionType connection = 3; pub fn clear_connection(&mut self) { @@ -600,14 +518,6 @@ impl Message_Peer { pub fn get_connection(&self) -> Message_ConnectionType { self.connection.unwrap_or(Message_ConnectionType::NOT_CONNECTED) } - - fn get_connection_for_reflect(&self) -> &::std::option::Option { - &self.connection - } - - fn mut_connection_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.connection - } } impl ::protobuf::Message for Message_Peer { @@ -691,16 +601,14 @@ impl ::protobuf::Message for Message_Peer { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Message_Peer { fn new() -> Message_Peer { Message_Peer::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -710,18 +618,18 @@ impl ::protobuf::MessageStatic for Message_Peer { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "id", - Message_Peer::get_id_for_reflect, - Message_Peer::mut_id_for_reflect, + |m: &Message_Peer| { &m.id }, + |m: &mut Message_Peer| { &mut m.id }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "addrs", - Message_Peer::get_addrs_for_reflect, - Message_Peer::mut_addrs_for_reflect, + |m: &Message_Peer| { &m.addrs }, + |m: &mut Message_Peer| { &mut m.addrs }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "connection", - Message_Peer::get_connection_for_reflect, - Message_Peer::mut_connection_for_reflect, + |m: &Message_Peer| { &m.connection }, + |m: &mut Message_Peer| { &mut m.connection }, )); ::protobuf::reflect::MessageDescriptor::new::( "Message_Peer", @@ -731,6 +639,16 @@ impl ::protobuf::MessageStatic for Message_Peer { }) } } + + fn default_instance() -> &'static Message_Peer { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Message_Peer, + }; + unsafe { + instance.get(Message_Peer::new) + } + } } impl ::protobuf::Clear for Message_Peer { @@ -793,7 +711,7 @@ impl ::protobuf::ProtobufEnum for Message_MessageType { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, @@ -848,7 +766,7 @@ impl ::protobuf::ProtobufEnum for Message_ConnectionType { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, diff --git a/kad/src/protobuf_structs/record.rs b/kad/src/protobuf_structs/record.rs index f6ce5936..17e80d43 100644 --- a/kad/src/protobuf_structs/record.rs +++ b/kad/src/protobuf_structs/record.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.2. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -34,24 +34,11 @@ pub struct Record { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Record {} - impl Record { pub fn new() -> Record { ::std::default::Default::default() } - pub fn default_instance() -> &'static Record { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Record, - }; - unsafe { - instance.get(Record::new) - } - } - // optional string key = 1; pub fn clear_key(&mut self) { @@ -88,14 +75,6 @@ impl Record { } } - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.key - } - // optional bytes value = 2; pub fn clear_value(&mut self) { @@ -132,14 +111,6 @@ impl Record { } } - fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.value - } - // optional string author = 3; pub fn clear_author(&mut self) { @@ -176,14 +147,6 @@ impl Record { } } - fn get_author_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.author - } - - fn mut_author_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.author - } - // optional bytes signature = 4; pub fn clear_signature(&mut self) { @@ -220,14 +183,6 @@ impl Record { } } - fn get_signature_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.signature - } - - fn mut_signature_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.signature - } - // optional string timeReceived = 5; pub fn clear_timeReceived(&mut self) { @@ -263,14 +218,6 @@ impl Record { None => "", } } - - fn get_timeReceived_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.timeReceived - } - - fn mut_timeReceived_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.timeReceived - } } impl ::protobuf::Message for Record { @@ -372,16 +319,14 @@ impl ::protobuf::Message for Record { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Record { fn new() -> Record { Record::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -391,28 +336,28 @@ impl ::protobuf::MessageStatic for Record { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "key", - Record::get_key_for_reflect, - Record::mut_key_for_reflect, + |m: &Record| { &m.key }, + |m: &mut Record| { &mut m.key }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "value", - Record::get_value_for_reflect, - Record::mut_value_for_reflect, + |m: &Record| { &m.value }, + |m: &mut Record| { &mut m.value }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "author", - Record::get_author_for_reflect, - Record::mut_author_for_reflect, + |m: &Record| { &m.author }, + |m: &mut Record| { &mut m.author }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "signature", - Record::get_signature_for_reflect, - Record::mut_signature_for_reflect, + |m: &Record| { &m.signature }, + |m: &mut Record| { &mut m.signature }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "timeReceived", - Record::get_timeReceived_for_reflect, - Record::mut_timeReceived_for_reflect, + |m: &Record| { &m.timeReceived }, + |m: &mut Record| { &mut m.timeReceived }, )); ::protobuf::reflect::MessageDescriptor::new::( "Record", @@ -422,6 +367,16 @@ impl ::protobuf::MessageStatic for Record { }) } } + + fn default_instance() -> &'static Record { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Record, + }; + unsafe { + instance.get(Record::new) + } + } } impl ::protobuf::Clear for Record { diff --git a/relay/Cargo.toml b/relay/Cargo.toml index 7d70a535..e83e55fb 100644 --- a/relay/Cargo.toml +++ b/relay/Cargo.toml @@ -10,7 +10,7 @@ libp2p-peerstore = { path = "../peerstore" } libp2p-core = { path = "../core" } log = "0.4" multiaddr = { path = "../multiaddr" } -protobuf = "2" +protobuf = "2.0.2" rand = "0.4" tokio-codec = "0.1" tokio-io = "0.1" diff --git a/relay/src/message.rs b/relay/src/message.rs index 10d10fb1..73d0736c 100644 --- a/relay/src/message.rs +++ b/relay/src/message.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 2.0.0. Do not edit +// This file is generated by rust-protobuf 2.0.2. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 diff --git a/secio/Cargo.toml b/secio/Cargo.toml index 0941df31..fc85114f 100644 --- a/secio/Cargo.toml +++ b/secio/Cargo.toml @@ -9,7 +9,7 @@ bytes = "0.4" futures = "0.1" libp2p-core = { path = "../core" } log = "0.4.1" -protobuf = "1" +protobuf = "2.0.2" rand = "0.3.17" ring = { version = "0.12.1", features = ["rsa_signing"] } rust-crypto = "^0.2" diff --git a/secio/regen_structs_proto.sh b/secio/regen_structs_proto.sh index bdb4ef3b..3a4354ed 100755 --- a/secio/regen_structs_proto.sh +++ b/secio/regen_structs_proto.sh @@ -5,7 +5,9 @@ sudo docker run --rm -v `pwd`:/usr/code:z -w /usr/code rust /bin/bash -c " \ apt-get update; \ apt-get install -y protobuf-compiler; \ - cargo install --version 1 protobuf; \ + cargo install --version 2.0.2 protobuf-codegen; \ protoc --rust_out . structs.proto" +sudo chown $USER:$USER *.rs + mv -f structs.rs ./src/structs_proto.rs diff --git a/secio/src/structs_proto.rs b/secio/src/structs_proto.rs index 4eaf9338..a481f381 100644 --- a/secio/src/structs_proto.rs +++ b/secio/src/structs_proto.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.2. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -34,24 +34,11 @@ pub struct Propose { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Propose {} - impl Propose { pub fn new() -> Propose { ::std::default::Default::default() } - pub fn default_instance() -> &'static Propose { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Propose, - }; - unsafe { - instance.get(Propose::new) - } - } - // optional bytes rand = 1; pub fn clear_rand(&mut self) { @@ -88,14 +75,6 @@ impl Propose { } } - fn get_rand_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.rand - } - - fn mut_rand_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.rand - } - // optional bytes pubkey = 2; pub fn clear_pubkey(&mut self) { @@ -132,14 +111,6 @@ impl Propose { } } - fn get_pubkey_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.pubkey - } - - fn mut_pubkey_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.pubkey - } - // optional string exchanges = 3; pub fn clear_exchanges(&mut self) { @@ -176,14 +147,6 @@ impl Propose { } } - fn get_exchanges_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.exchanges - } - - fn mut_exchanges_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.exchanges - } - // optional string ciphers = 4; pub fn clear_ciphers(&mut self) { @@ -220,14 +183,6 @@ impl Propose { } } - fn get_ciphers_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.ciphers - } - - fn mut_ciphers_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.ciphers - } - // optional string hashes = 5; pub fn clear_hashes(&mut self) { @@ -263,14 +218,6 @@ impl Propose { None => "", } } - - fn get_hashes_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.hashes - } - - fn mut_hashes_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.hashes - } } impl ::protobuf::Message for Propose { @@ -372,16 +319,14 @@ impl ::protobuf::Message for Propose { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Propose { fn new() -> Propose { Propose::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -391,28 +336,28 @@ impl ::protobuf::MessageStatic for Propose { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "rand", - Propose::get_rand_for_reflect, - Propose::mut_rand_for_reflect, + |m: &Propose| { &m.rand }, + |m: &mut Propose| { &mut m.rand }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "pubkey", - Propose::get_pubkey_for_reflect, - Propose::mut_pubkey_for_reflect, + |m: &Propose| { &m.pubkey }, + |m: &mut Propose| { &mut m.pubkey }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "exchanges", - Propose::get_exchanges_for_reflect, - Propose::mut_exchanges_for_reflect, + |m: &Propose| { &m.exchanges }, + |m: &mut Propose| { &mut m.exchanges }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "ciphers", - Propose::get_ciphers_for_reflect, - Propose::mut_ciphers_for_reflect, + |m: &Propose| { &m.ciphers }, + |m: &mut Propose| { &mut m.ciphers }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "hashes", - Propose::get_hashes_for_reflect, - Propose::mut_hashes_for_reflect, + |m: &Propose| { &m.hashes }, + |m: &mut Propose| { &mut m.hashes }, )); ::protobuf::reflect::MessageDescriptor::new::( "Propose", @@ -422,6 +367,16 @@ impl ::protobuf::MessageStatic for Propose { }) } } + + fn default_instance() -> &'static Propose { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Propose, + }; + unsafe { + instance.get(Propose::new) + } + } } impl ::protobuf::Clear for Propose { @@ -457,24 +412,11 @@ pub struct Exchange { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Exchange {} - impl Exchange { pub fn new() -> Exchange { ::std::default::Default::default() } - pub fn default_instance() -> &'static Exchange { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Exchange, - }; - unsafe { - instance.get(Exchange::new) - } - } - // optional bytes epubkey = 1; pub fn clear_epubkey(&mut self) { @@ -511,14 +453,6 @@ impl Exchange { } } - fn get_epubkey_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.epubkey - } - - fn mut_epubkey_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.epubkey - } - // optional bytes signature = 2; pub fn clear_signature(&mut self) { @@ -554,14 +488,6 @@ impl Exchange { None => &[], } } - - fn get_signature_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.signature - } - - fn mut_signature_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.signature - } } impl ::protobuf::Message for Exchange { @@ -636,16 +562,14 @@ impl ::protobuf::Message for Exchange { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Exchange { fn new() -> Exchange { Exchange::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + 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, @@ -655,13 +579,13 @@ impl ::protobuf::MessageStatic for Exchange { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "epubkey", - Exchange::get_epubkey_for_reflect, - Exchange::mut_epubkey_for_reflect, + |m: &Exchange| { &m.epubkey }, + |m: &mut Exchange| { &mut m.epubkey }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "signature", - Exchange::get_signature_for_reflect, - Exchange::mut_signature_for_reflect, + |m: &Exchange| { &m.signature }, + |m: &mut Exchange| { &mut m.signature }, )); ::protobuf::reflect::MessageDescriptor::new::( "Exchange", @@ -671,6 +595,16 @@ impl ::protobuf::MessageStatic for Exchange { }) } } + + fn default_instance() -> &'static Exchange { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Exchange, + }; + unsafe { + instance.get(Exchange::new) + } + } } impl ::protobuf::Clear for Exchange {