diff --git a/floodsub/Cargo.toml b/floodsub/Cargo.toml index 0d187c7d..973671f5 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 = "2" +protobuf = "1" smallvec = "0.6.0" tokio-io = "0.1" varint = { path = "../varint-rs" } diff --git a/floodsub/regen_structs_proto.sh b/floodsub/regen_structs_proto.sh index f3d4b89d..a813ebc4 100755 --- a/floodsub/regen_structs_proto.sh +++ b/floodsub/regen_structs_proto.sh @@ -5,7 +5,7 @@ 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 protobuf; \ + cargo install --version 1 protobuf; \ protoc --rust_out . rpc.proto" mv -f rpc.rs ./src/rpc_proto.rs diff --git a/floodsub/src/rpc_proto.rs b/floodsub/src/rpc_proto.rs index a0557bb5..fd6d2045 100644 --- a/floodsub/src/rpc_proto.rs +++ b/floodsub/src/rpc_proto.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 2.0.0. Do not edit +// This file is generated. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -31,11 +31,24 @@ 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) { @@ -61,6 +74,14 @@ 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) { @@ -85,6 +106,14 @@ 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 { @@ -175,14 +204,16 @@ impl ::protobuf::Message for RPC { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for RPC { fn new() -> RPC { RPC::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -192,13 +223,13 @@ impl ::protobuf::Message for RPC { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "subscriptions", - |m: &RPC| { &m.subscriptions }, - |m: &mut RPC| { &mut m.subscriptions }, + RPC::get_subscriptions_for_reflect, + RPC::mut_subscriptions_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "publish", - |m: &RPC| { &m.publish }, - |m: &mut RPC| { &mut m.publish }, + RPC::get_publish_for_reflect, + RPC::mut_publish_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "RPC", @@ -208,16 +239,6 @@ impl ::protobuf::Message 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 { @@ -250,11 +271,24 @@ 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) { @@ -274,6 +308,14 @@ 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) { @@ -309,6 +351,14 @@ 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 { @@ -387,14 +437,16 @@ impl ::protobuf::Message for RPC_SubOpts { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for RPC_SubOpts { fn new() -> RPC_SubOpts { RPC_SubOpts::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -404,13 +456,13 @@ impl ::protobuf::Message for RPC_SubOpts { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( "subscribe", - |m: &RPC_SubOpts| { &m.subscribe }, - |m: &mut RPC_SubOpts| { &mut m.subscribe }, + RPC_SubOpts::get_subscribe_for_reflect, + RPC_SubOpts::mut_subscribe_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "topicid", - |m: &RPC_SubOpts| { &m.topicid }, - |m: &mut RPC_SubOpts| { &mut m.topicid }, + RPC_SubOpts::get_topicid_for_reflect, + RPC_SubOpts::mut_topicid_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "RPC_SubOpts", @@ -420,16 +472,6 @@ impl ::protobuf::Message 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 { @@ -464,11 +506,24 @@ 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) { @@ -505,6 +560,14 @@ 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) { @@ -541,6 +604,14 @@ 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) { @@ -577,6 +648,14 @@ 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) { @@ -601,6 +680,14 @@ 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 { @@ -693,14 +780,16 @@ impl ::protobuf::Message for Message { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Message { fn new() -> Message { Message::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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,23 +799,23 @@ impl ::protobuf::Message for Message { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "from", - |m: &Message| { &m.from }, - |m: &mut Message| { &mut m.from }, + Message::get_from_for_reflect, + Message::mut_from_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "data", - |m: &Message| { &m.data }, - |m: &mut Message| { &mut m.data }, + Message::get_data_for_reflect, + Message::mut_data_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "seqno", - |m: &Message| { &m.seqno }, - |m: &mut Message| { &mut m.seqno }, + Message::get_seqno_for_reflect, + Message::mut_seqno_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "topicIDs", - |m: &Message| { &m.topicIDs }, - |m: &mut Message| { &mut m.topicIDs }, + Message::get_topicIDs_for_reflect, + Message::mut_topicIDs_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Message", @@ -736,16 +825,6 @@ impl ::protobuf::Message 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 { @@ -781,11 +860,24 @@ 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) { @@ -822,6 +914,14 @@ 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) { @@ -855,6 +955,14 @@ 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) { @@ -887,6 +995,14 @@ 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 { @@ -986,14 +1102,16 @@ impl ::protobuf::Message for TopicDescriptor { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for TopicDescriptor { fn new() -> TopicDescriptor { TopicDescriptor::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -1003,18 +1121,18 @@ impl ::protobuf::Message for TopicDescriptor { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "name", - |m: &TopicDescriptor| { &m.name }, - |m: &mut TopicDescriptor| { &mut m.name }, + TopicDescriptor::get_name_for_reflect, + TopicDescriptor::mut_name_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "auth", - |m: &TopicDescriptor| { &m.auth }, - |m: &mut TopicDescriptor| { &mut m.auth }, + TopicDescriptor::get_auth_for_reflect, + TopicDescriptor::mut_auth_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "enc", - |m: &TopicDescriptor| { &m.enc }, - |m: &mut TopicDescriptor| { &mut m.enc }, + TopicDescriptor::get_enc_for_reflect, + TopicDescriptor::mut_enc_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "TopicDescriptor", @@ -1024,16 +1142,6 @@ impl ::protobuf::Message 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 { @@ -1067,11 +1175,24 @@ 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) { @@ -1091,6 +1212,14 @@ 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) { @@ -1115,6 +1244,14 @@ 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 { @@ -1189,14 +1326,16 @@ impl ::protobuf::Message for TopicDescriptor_AuthOpts { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for TopicDescriptor_AuthOpts { fn new() -> TopicDescriptor_AuthOpts { TopicDescriptor_AuthOpts::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -1206,13 +1345,13 @@ impl ::protobuf::Message for TopicDescriptor_AuthOpts { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "mode", - |m: &TopicDescriptor_AuthOpts| { &m.mode }, - |m: &mut TopicDescriptor_AuthOpts| { &mut m.mode }, + TopicDescriptor_AuthOpts::get_mode_for_reflect, + TopicDescriptor_AuthOpts::mut_mode_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "keys", - |m: &TopicDescriptor_AuthOpts| { &m.keys }, - |m: &mut TopicDescriptor_AuthOpts| { &mut m.keys }, + TopicDescriptor_AuthOpts::get_keys_for_reflect, + TopicDescriptor_AuthOpts::mut_keys_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "TopicDescriptor_AuthOpts", @@ -1222,16 +1361,6 @@ impl ::protobuf::Message 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 { @@ -1284,7 +1413,7 @@ impl ::protobuf::ProtobufEnum for TopicDescriptor_AuthOpts_AuthMode { values } - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static(_: ::std::option::Option) -> &'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, @@ -1316,11 +1445,24 @@ 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) { @@ -1340,6 +1482,14 @@ 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) { @@ -1364,6 +1514,14 @@ 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 { @@ -1438,14 +1596,16 @@ impl ::protobuf::Message for TopicDescriptor_EncOpts { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for TopicDescriptor_EncOpts { fn new() -> TopicDescriptor_EncOpts { TopicDescriptor_EncOpts::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -1455,13 +1615,13 @@ impl ::protobuf::Message for TopicDescriptor_EncOpts { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "mode", - |m: &TopicDescriptor_EncOpts| { &m.mode }, - |m: &mut TopicDescriptor_EncOpts| { &mut m.mode }, + TopicDescriptor_EncOpts::get_mode_for_reflect, + TopicDescriptor_EncOpts::mut_mode_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "keyHashes", - |m: &TopicDescriptor_EncOpts| { &m.keyHashes }, - |m: &mut TopicDescriptor_EncOpts| { &mut m.keyHashes }, + TopicDescriptor_EncOpts::get_keyHashes_for_reflect, + TopicDescriptor_EncOpts::mut_keyHashes_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "TopicDescriptor_EncOpts", @@ -1471,16 +1631,6 @@ impl ::protobuf::Message 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 { @@ -1533,7 +1683,7 @@ impl ::protobuf::ProtobufEnum for TopicDescriptor_EncOpts_EncMode { values } - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static(_: ::std::option::Option) -> &'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 7cdeec32..71c5baa9 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 = "2" +protobuf = "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 7c837cdf..7210eb97 100755 --- a/identify/regen_structs_proto.sh +++ b/identify/regen_structs_proto.sh @@ -6,7 +6,7 @@ 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 protobuf; \ + cargo install --version 1 protobuf; \ protoc --rust_out . structs.proto" mv -f structs.rs ./src/structs_proto.rs diff --git a/identify/src/structs_proto.rs b/identify/src/structs_proto.rs index 903b4bba..616a5b94 100644 --- a/identify/src/structs_proto.rs +++ b/identify/src/structs_proto.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 2.0.0. Do not edit +// This file is generated. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -35,11 +35,24 @@ 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) { @@ -76,6 +89,14 @@ 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) { @@ -112,6 +133,14 @@ 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) { @@ -148,6 +177,14 @@ 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) { @@ -173,6 +210,14 @@ 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) { @@ -209,6 +254,14 @@ 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) { @@ -233,6 +286,14 @@ 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 { @@ -343,14 +404,16 @@ impl ::protobuf::Message for Identify { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Identify { fn new() -> Identify { Identify::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -360,33 +423,33 @@ impl ::protobuf::Message for Identify { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "protocolVersion", - |m: &Identify| { &m.protocolVersion }, - |m: &mut Identify| { &mut m.protocolVersion }, + Identify::get_protocolVersion_for_reflect, + Identify::mut_protocolVersion_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "agentVersion", - |m: &Identify| { &m.agentVersion }, - |m: &mut Identify| { &mut m.agentVersion }, + Identify::get_agentVersion_for_reflect, + Identify::mut_agentVersion_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "publicKey", - |m: &Identify| { &m.publicKey }, - |m: &mut Identify| { &mut m.publicKey }, + Identify::get_publicKey_for_reflect, + Identify::mut_publicKey_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "listenAddrs", - |m: &Identify| { &m.listenAddrs }, - |m: &mut Identify| { &mut m.listenAddrs }, + Identify::get_listenAddrs_for_reflect, + Identify::mut_listenAddrs_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "observedAddr", - |m: &Identify| { &m.observedAddr }, - |m: &mut Identify| { &mut m.observedAddr }, + Identify::get_observedAddr_for_reflect, + Identify::mut_observedAddr_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "protocols", - |m: &Identify| { &m.protocols }, - |m: &mut Identify| { &mut m.protocols }, + Identify::get_protocols_for_reflect, + Identify::mut_protocols_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Identify", @@ -396,16 +459,6 @@ impl ::protobuf::Message 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 d8ac4475..8ca08822 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 = "2" +protobuf = "1" rand = "0.4.2" smallvec = "0.5" tokio-io = "0.1" diff --git a/kad/regen_dht_proto.sh b/kad/regen_dht_proto.sh index f8629bb7..0b17016b 100755 --- a/kad/regen_dht_proto.sh +++ b/kad/regen_dht_proto.sh @@ -5,7 +5,7 @@ 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 protobuf; \ + cargo install --version 1 protobuf; \ protoc --rust_out . dht.proto;\ protoc --rust_out . record.proto" diff --git a/kad/src/protobuf_structs/dht.rs b/kad/src/protobuf_structs/dht.rs index 907fe877..c7af18e5 100644 --- a/kad/src/protobuf_structs/dht.rs +++ b/kad/src/protobuf_structs/dht.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 2.0.0. Do not edit +// This file is generated. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -35,11 +35,24 @@ 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) { @@ -59,6 +72,14 @@ 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) { @@ -78,6 +99,14 @@ 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) { @@ -114,6 +143,14 @@ 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) { @@ -147,6 +184,14 @@ 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) { @@ -172,6 +217,14 @@ 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) { @@ -196,6 +249,14 @@ 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 { @@ -334,14 +395,16 @@ impl ::protobuf::Message for Message { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Message { fn new() -> Message { Message::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -351,33 +414,33 @@ impl ::protobuf::Message for Message { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "type", - |m: &Message| { &m.field_type }, - |m: &mut Message| { &mut m.field_type }, + Message::get_field_type_for_reflect, + Message::mut_field_type_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( "clusterLevelRaw", - |m: &Message| { &m.clusterLevelRaw }, - |m: &mut Message| { &mut m.clusterLevelRaw }, + Message::get_clusterLevelRaw_for_reflect, + Message::mut_clusterLevelRaw_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "key", - |m: &Message| { &m.key }, - |m: &mut Message| { &mut m.key }, + Message::get_key_for_reflect, + Message::mut_key_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "record", - |m: &Message| { &m.record }, - |m: &mut Message| { &mut m.record }, + Message::get_record_for_reflect, + Message::mut_record_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "closerPeers", - |m: &Message| { &m.closerPeers }, - |m: &mut Message| { &mut m.closerPeers }, + Message::get_closerPeers_for_reflect, + Message::mut_closerPeers_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "providerPeers", - |m: &Message| { &m.providerPeers }, - |m: &mut Message| { &mut m.providerPeers }, + Message::get_providerPeers_for_reflect, + Message::mut_providerPeers_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Message", @@ -387,16 +450,6 @@ impl ::protobuf::Message 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 { @@ -434,11 +487,24 @@ 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) { @@ -475,6 +541,14 @@ 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) { @@ -500,6 +574,14 @@ 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) { @@ -518,6 +600,14 @@ 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 { @@ -601,14 +691,16 @@ impl ::protobuf::Message for Message_Peer { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Message_Peer { fn new() -> Message_Peer { Message_Peer::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -618,18 +710,18 @@ impl ::protobuf::Message for Message_Peer { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "id", - |m: &Message_Peer| { &m.id }, - |m: &mut Message_Peer| { &mut m.id }, + Message_Peer::get_id_for_reflect, + Message_Peer::mut_id_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "addrs", - |m: &Message_Peer| { &m.addrs }, - |m: &mut Message_Peer| { &mut m.addrs }, + Message_Peer::get_addrs_for_reflect, + Message_Peer::mut_addrs_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "connection", - |m: &Message_Peer| { &m.connection }, - |m: &mut Message_Peer| { &mut m.connection }, + Message_Peer::get_connection_for_reflect, + Message_Peer::mut_connection_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Message_Peer", @@ -639,16 +731,6 @@ impl ::protobuf::Message 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 { @@ -711,7 +793,7 @@ impl ::protobuf::ProtobufEnum for Message_MessageType { values } - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static(_: ::std::option::Option) -> &'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, @@ -766,7 +848,7 @@ impl ::protobuf::ProtobufEnum for Message_ConnectionType { values } - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static(_: ::std::option::Option) -> &'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 2dcf4beb..f6ce5936 100644 --- a/kad/src/protobuf_structs/record.rs +++ b/kad/src/protobuf_structs/record.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 2.0.0. Do not edit +// This file is generated. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -34,11 +34,24 @@ 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) { @@ -75,6 +88,14 @@ 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) { @@ -111,6 +132,14 @@ 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) { @@ -147,6 +176,14 @@ 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) { @@ -183,6 +220,14 @@ 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) { @@ -218,6 +263,14 @@ 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 { @@ -319,14 +372,16 @@ impl ::protobuf::Message for Record { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Record { fn new() -> Record { Record::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -336,28 +391,28 @@ impl ::protobuf::Message for Record { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "key", - |m: &Record| { &m.key }, - |m: &mut Record| { &mut m.key }, + Record::get_key_for_reflect, + Record::mut_key_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "value", - |m: &Record| { &m.value }, - |m: &mut Record| { &mut m.value }, + Record::get_value_for_reflect, + Record::mut_value_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "author", - |m: &Record| { &m.author }, - |m: &mut Record| { &mut m.author }, + Record::get_author_for_reflect, + Record::mut_author_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "signature", - |m: &Record| { &m.signature }, - |m: &mut Record| { &mut m.signature }, + Record::get_signature_for_reflect, + Record::mut_signature_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "timeReceived", - |m: &Record| { &m.timeReceived }, - |m: &mut Record| { &mut m.timeReceived }, + Record::get_timeReceived_for_reflect, + Record::mut_timeReceived_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Record", @@ -367,16 +422,6 @@ impl ::protobuf::Message 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/secio/Cargo.toml b/secio/Cargo.toml index 81fc7b46..2ee39943 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 = "2" +protobuf = "1" 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 3ee8bb71..948def96 100755 --- a/secio/regen_structs_proto.sh +++ b/secio/regen_structs_proto.sh @@ -6,7 +6,7 @@ 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 protobuf; \ + cargo install --version 1 protobuf; \ protoc --rust_out . structs.proto; \ protoc --rust_out . keys.proto" diff --git a/secio/src/keys_proto.rs b/secio/src/keys_proto.rs index b7c3d284..ff5ed486 100644 --- a/secio/src/keys_proto.rs +++ b/secio/src/keys_proto.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 2.0.0. Do not edit +// This file is generated. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -31,11 +31,24 @@ 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) { @@ -55,6 +68,14 @@ 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) { @@ -90,6 +111,14 @@ 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 { @@ -170,14 +199,16 @@ impl ::protobuf::Message for PublicKey { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for PublicKey { fn new() -> PublicKey { PublicKey::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -187,13 +218,13 @@ impl ::protobuf::Message for PublicKey { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "Type", - |m: &PublicKey| { &m.Type }, - |m: &mut PublicKey| { &mut m.Type }, + PublicKey::get_Type_for_reflect, + PublicKey::mut_Type_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "Data", - |m: &PublicKey| { &m.Data }, - |m: &mut PublicKey| { &mut m.Data }, + PublicKey::get_Data_for_reflect, + PublicKey::mut_Data_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "PublicKey", @@ -203,16 +234,6 @@ impl ::protobuf::Message 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 { @@ -245,11 +266,24 @@ 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) { @@ -269,6 +303,14 @@ 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) { @@ -304,6 +346,14 @@ 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 { @@ -384,14 +434,16 @@ impl ::protobuf::Message for PrivateKey { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for PrivateKey { fn new() -> PrivateKey { PrivateKey::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -401,13 +453,13 @@ impl ::protobuf::Message for PrivateKey { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "Type", - |m: &PrivateKey| { &m.Type }, - |m: &mut PrivateKey| { &mut m.Type }, + PrivateKey::get_Type_for_reflect, + PrivateKey::mut_Type_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "Data", - |m: &PrivateKey| { &m.Data }, - |m: &mut PrivateKey| { &mut m.Data }, + PrivateKey::get_Data_for_reflect, + PrivateKey::mut_Data_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "PrivateKey", @@ -417,16 +469,6 @@ impl ::protobuf::Message 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 { @@ -479,7 +521,7 @@ impl ::protobuf::ProtobufEnum for KeyType { values } - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static(_: ::std::option::Option) -> &'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, @@ -503,9 +545,9 @@ impl ::protobuf::reflect::ProtobufValue for KeyType { static file_descriptor_proto_data: &'static [u8] = b"\ \n\nkeys.proto\"=\n\tPublicKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\x0e2\ - \x08.KeyTypeR\x04Type\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04Data\">\ - \n\nPrivateKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\x0e2\x08.KeyTypeR\x04T\ - ype\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04Data*.\n\x07KeyType\x12\ + \x08.KeyTypeR\x04type\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04data\">\ + \n\nPrivateKey\x12\x1c\n\x04Type\x18\x01\x20\x02(\x0e2\x08.KeyTypeR\x04t\ + ype\x12\x12\n\x04Data\x18\x02\x20\x02(\x0cR\x04data*.\n\x07KeyType\x12\ \x07\n\x03RSA\x10\0\x12\x0b\n\x07Ed25519\x10\x01\x12\r\n\tSecp256k1\x10\ \x02J\xdf\x03\n\x06\x12\x04\0\0\x0e\x01\n\n\n\x02\x05\0\x12\x04\0\0\x04\ \x01\n\n\n\x03\x05\0\x01\x12\x03\0\x05\x0c\n\x0b\n\x04\x05\0\x02\0\x12\ diff --git a/secio/src/structs_proto.rs b/secio/src/structs_proto.rs index 4301de8b..4eaf9338 100644 --- a/secio/src/structs_proto.rs +++ b/secio/src/structs_proto.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 2.0.0. Do not edit +// This file is generated. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -34,11 +34,24 @@ 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) { @@ -75,6 +88,14 @@ 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) { @@ -111,6 +132,14 @@ 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) { @@ -147,6 +176,14 @@ 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) { @@ -183,6 +220,14 @@ 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) { @@ -218,6 +263,14 @@ 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 { @@ -319,14 +372,16 @@ impl ::protobuf::Message for Propose { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Propose { fn new() -> Propose { Propose::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -336,28 +391,28 @@ impl ::protobuf::Message for Propose { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "rand", - |m: &Propose| { &m.rand }, - |m: &mut Propose| { &mut m.rand }, + Propose::get_rand_for_reflect, + Propose::mut_rand_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "pubkey", - |m: &Propose| { &m.pubkey }, - |m: &mut Propose| { &mut m.pubkey }, + Propose::get_pubkey_for_reflect, + Propose::mut_pubkey_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "exchanges", - |m: &Propose| { &m.exchanges }, - |m: &mut Propose| { &mut m.exchanges }, + Propose::get_exchanges_for_reflect, + Propose::mut_exchanges_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "ciphers", - |m: &Propose| { &m.ciphers }, - |m: &mut Propose| { &mut m.ciphers }, + Propose::get_ciphers_for_reflect, + Propose::mut_ciphers_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "hashes", - |m: &Propose| { &m.hashes }, - |m: &mut Propose| { &mut m.hashes }, + Propose::get_hashes_for_reflect, + Propose::mut_hashes_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Propose", @@ -367,16 +422,6 @@ impl ::protobuf::Message 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 { @@ -412,11 +457,24 @@ 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) { @@ -453,6 +511,14 @@ 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) { @@ -488,6 +554,14 @@ 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 { @@ -562,14 +636,16 @@ impl ::protobuf::Message for Exchange { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Exchange { fn new() -> Exchange { Exchange::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'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, @@ -579,13 +655,13 @@ impl ::protobuf::Message for Exchange { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "epubkey", - |m: &Exchange| { &m.epubkey }, - |m: &mut Exchange| { &mut m.epubkey }, + Exchange::get_epubkey_for_reflect, + Exchange::mut_epubkey_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "signature", - |m: &Exchange| { &m.signature }, - |m: &mut Exchange| { &mut m.signature }, + Exchange::get_signature_for_reflect, + Exchange::mut_signature_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Exchange", @@ -595,16 +671,6 @@ impl ::protobuf::Message 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 {