Update to protobuf >= 2 (#199)

This commit is contained in:
Toralf Wittner
2018-05-21 17:32:59 +02:00
committed by GitHub
parent 250af629ee
commit 5f6e215ec1
14 changed files with 420 additions and 866 deletions

View File

@ -1,4 +1,4 @@
// This file is generated. Do not edit
// This file is generated by rust-protobuf 2.0.0. 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<Message> = ::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<Message_MessageType> {
&self.field_type
}
fn mut_field_type_for_reflect(&mut self) -> &mut ::std::option::Option<Message_MessageType> {
&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<i32> {
&self.clusterLevelRaw
}
fn mut_clusterLevelRaw_for_reflect(&mut self) -> &mut ::std::option::Option<i32> {
&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<u8>> {
&self.key
}
fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
&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<super::record::Record> {
&self.record
}
fn mut_record_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField<super::record::Record> {
&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<Message_Peer> {
&self.closerPeers
}
fn mut_closerPeers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<Message_Peer> {
&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<Message_Peer> {
&self.providerPeers
}
fn mut_providerPeers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<Message_Peer> {
&mut self.providerPeers
}
}
impl ::protobuf::Message for Message {
@ -284,11 +223,7 @@ impl ::protobuf::Message for Message {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
let tmp = is.read_enum()?;
self.field_type = ::std::option::Option::Some(tmp);
::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 1, &mut self.unknown_fields)?
},
10 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
@ -399,16 +334,14 @@ impl ::protobuf::Message for Message {
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
::protobuf::MessageStatic::descriptor_static(None::<Self>)
Self::descriptor_static()
}
}
impl ::protobuf::MessageStatic for Message {
fn new() -> Message {
Message::new()
}
fn descriptor_static(_: ::std::option::Option<Message>) -> &'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,
@ -418,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<Message_MessageType>>(
"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<super::record::Record>>(
"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<Message_Peer>>(
"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<Message_Peer>>(
"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>(
"Message",
@ -454,6 +387,16 @@ impl ::protobuf::MessageStatic for Message {
})
}
}
fn default_instance() -> &'static Message {
static mut instance: ::protobuf::lazy::Lazy<Message> = ::protobuf::lazy::Lazy {
lock: ::protobuf::lazy::ONCE_INIT,
ptr: 0 as *const Message,
};
unsafe {
instance.get(Message::new)
}
}
}
impl ::protobuf::Clear for Message {
@ -491,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<Message_Peer> = ::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) {
@ -545,14 +475,6 @@ impl Message_Peer {
}
}
fn get_id_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
&self.id
}
fn mut_id_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
&mut self.id
}
// repeated bytes addrs = 2;
pub fn clear_addrs(&mut self) {
@ -578,14 +500,6 @@ impl Message_Peer {
&self.addrs
}
fn get_addrs_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec<u8>> {
&self.addrs
}
fn mut_addrs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec<u8>> {
&mut self.addrs
}
// optional .dht.pb.Message.ConnectionType connection = 3;
pub fn clear_connection(&mut self) {
@ -604,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<Message_ConnectionType> {
&self.connection
}
fn mut_connection_for_reflect(&mut self) -> &mut ::std::option::Option<Message_ConnectionType> {
&mut self.connection
}
}
impl ::protobuf::Message for Message_Peer {
@ -630,11 +536,7 @@ impl ::protobuf::Message for Message_Peer {
::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.addrs)?;
},
3 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
let tmp = is.read_enum()?;
self.connection = ::std::option::Option::Some(tmp);
::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.connection, 3, &mut self.unknown_fields)?
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
@ -699,16 +601,14 @@ impl ::protobuf::Message for Message_Peer {
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
::protobuf::MessageStatic::descriptor_static(None::<Self>)
Self::descriptor_static()
}
}
impl ::protobuf::MessageStatic for Message_Peer {
fn new() -> Message_Peer {
Message_Peer::new()
}
fn descriptor_static(_: ::std::option::Option<Message_Peer>) -> &'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,
@ -718,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<Message_ConnectionType>>(
"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>(
"Message_Peer",
@ -739,6 +639,16 @@ impl ::protobuf::MessageStatic for Message_Peer {
})
}
}
fn default_instance() -> &'static Message_Peer {
static mut instance: ::protobuf::lazy::Lazy<Message_Peer> = ::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 {
@ -801,7 +711,7 @@ impl ::protobuf::ProtobufEnum for Message_MessageType {
values
}
fn enum_descriptor_static(_: ::std::option::Option<Message_MessageType>) -> &'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,
@ -856,7 +766,7 @@ impl ::protobuf::ProtobufEnum for Message_ConnectionType {
values
}
fn enum_descriptor_static(_: ::std::option::Option<Message_ConnectionType>) -> &'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,