From 15e14225969d54d10988c8d941fbd1c55efe64b6 Mon Sep 17 00:00:00 2001 From: HEnquist Date: Sat, 10 Aug 2019 20:49:44 +0200 Subject: [PATCH] Some more cleaning --- examples/playlist_tracks.rs | 2 - protocol/proto/playlist4changes.proto | 1 - protocol/src/playlist4changes.rs | 126 +++++++++++++------------- 3 files changed, 63 insertions(+), 66 deletions(-) diff --git a/examples/playlist_tracks.rs b/examples/playlist_tracks.rs index 224d43ab..5d6aec59 100644 --- a/examples/playlist_tracks.rs +++ b/examples/playlist_tracks.rs @@ -3,10 +3,8 @@ extern crate env_logger; extern crate librespot; extern crate tokio_core; -//extern crate tokio_fs; extern crate tokio_io; extern crate futures; -//extern crate futures_cpupool; use std::env; use tokio_core::reactor::Core; diff --git a/protocol/proto/playlist4changes.proto b/protocol/proto/playlist4changes.proto index e7caa132..6b424b71 100644 --- a/protocol/proto/playlist4changes.proto +++ b/protocol/proto/playlist4changes.proto @@ -71,7 +71,6 @@ message ListChanges { message SelectedListContent { optional bytes revision = 0x1; optional int32 length = 0x2; - optional string owner_username =0x10; optional ListAttributes attributes = 0x3; optional ListChecksum checksum = 0x4; optional ListItems contents = 0x5; diff --git a/protocol/src/playlist4changes.rs b/protocol/src/playlist4changes.rs index 5c628723..d2d55bbd 100644 --- a/protocol/src/playlist4changes.rs +++ b/protocol/src/playlist4changes.rs @@ -2748,7 +2748,6 @@ pub struct SelectedListContent { // message fields revision: ::protobuf::SingularField<::std::vec::Vec>, length: ::std::option::Option, - owner_username: ::protobuf::SingularField<::std::string::String>, attributes: ::protobuf::SingularPtrField, checksum: ::protobuf::SingularPtrField, contents: ::protobuf::SingularPtrField, @@ -2760,6 +2759,7 @@ pub struct SelectedListContent { resolveAction: ::protobuf::RepeatedField, issues: ::protobuf::RepeatedField, nonces: ::std::vec::Vec, + owner_username: ::protobuf::SingularField<::std::string::String>, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, @@ -2831,42 +2831,6 @@ impl SelectedListContent { self.length = ::std::option::Option::Some(v); } - // optional string owner_username = 16; - - - pub fn get_owner_username(&self) -> &str { - match self.owner_username.as_ref() { - Some(v) => &v, - None => "", - } - } - pub fn clear_owner_username(&mut self) { - self.owner_username.clear(); - } - - pub fn has_owner_username(&self) -> bool { - self.owner_username.is_some() - } - - // Param is passed by value, moved - pub fn set_owner_username(&mut self, v: ::std::string::String) { - self.owner_username = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_owner_username(&mut self) -> &mut ::std::string::String { - if self.owner_username.is_none() { - self.owner_username.set_default(); - } - self.owner_username.as_mut().unwrap() - } - - // Take field - pub fn take_owner_username(&mut self) -> ::std::string::String { - self.owner_username.take().unwrap_or_else(|| ::std::string::String::new()) - } - // optional .ListAttributes attributes = 3; @@ -3169,6 +3133,42 @@ impl SelectedListContent { pub fn take_nonces(&mut self) -> ::std::vec::Vec { ::std::mem::replace(&mut self.nonces, ::std::vec::Vec::new()) } + + // optional string owner_username = 16; + + + pub fn get_owner_username(&self) -> &str { + match self.owner_username.as_ref() { + Some(v) => &v, + None => "", + } + } + pub fn clear_owner_username(&mut self) { + self.owner_username.clear(); + } + + pub fn has_owner_username(&self) -> bool { + self.owner_username.is_some() + } + + // Param is passed by value, moved + pub fn set_owner_username(&mut self, v: ::std::string::String) { + self.owner_username = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_owner_username(&mut self) -> &mut ::std::string::String { + if self.owner_username.is_none() { + self.owner_username.set_default(); + } + self.owner_username.as_mut().unwrap() + } + + // Take field + pub fn take_owner_username(&mut self) -> ::std::string::String { + self.owner_username.take().unwrap_or_else(|| ::std::string::String::new()) + } } impl ::protobuf::Message for SelectedListContent { @@ -3225,9 +3225,6 @@ impl ::protobuf::Message for SelectedListContent { let tmp = is.read_int32()?; self.length = ::std::option::Option::Some(tmp); }, - 16 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.owner_username)?; - }, 3 => { ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.attributes)?; }, @@ -3269,6 +3266,9 @@ impl ::protobuf::Message for SelectedListContent { 14 => { ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.nonces)?; }, + 16 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.owner_username)?; + }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; }, @@ -3287,9 +3287,6 @@ impl ::protobuf::Message for SelectedListContent { if let Some(v) = self.length { my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); } - if let Some(ref v) = self.owner_username.as_ref() { - my_size += ::protobuf::rt::string_size(16, &v); - } if let Some(ref v) = self.attributes.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; @@ -3330,6 +3327,9 @@ impl ::protobuf::Message for SelectedListContent { for value in &self.nonces { my_size += ::protobuf::rt::value_size(14, *value, ::protobuf::wire_format::WireTypeVarint); }; + if let Some(ref v) = self.owner_username.as_ref() { + my_size += ::protobuf::rt::string_size(16, &v); + } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); my_size @@ -3342,9 +3342,6 @@ impl ::protobuf::Message for SelectedListContent { if let Some(v) = self.length { os.write_int32(2, v)?; } - if let Some(ref v) = self.owner_username.as_ref() { - os.write_string(16, &v)?; - } if let Some(ref v) = self.attributes.as_ref() { os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; os.write_raw_varint32(v.get_cached_size())?; @@ -3392,6 +3389,9 @@ impl ::protobuf::Message for SelectedListContent { for v in &self.nonces { os.write_int32(14, *v)?; }; + if let Some(ref v) = self.owner_username.as_ref() { + os.write_string(16, &v)?; + } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) } @@ -3444,11 +3444,6 @@ impl ::protobuf::Message for SelectedListContent { |m: &SelectedListContent| { &m.length }, |m: &mut SelectedListContent| { &mut m.length }, )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "owner_username", - |m: &SelectedListContent| { &m.owner_username }, - |m: &mut SelectedListContent| { &mut m.owner_username }, - )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "attributes", |m: &SelectedListContent| { &m.attributes }, @@ -3504,6 +3499,11 @@ impl ::protobuf::Message for SelectedListContent { |m: &SelectedListContent| { &m.nonces }, |m: &mut SelectedListContent| { &mut m.nonces }, )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "owner_username", + |m: &SelectedListContent| { &m.owner_username }, + |m: &mut SelectedListContent| { &mut m.owner_username }, + )); ::protobuf::reflect::MessageDescriptor::new::( "SelectedListContent", fields, @@ -3528,7 +3528,6 @@ impl ::protobuf::Clear for SelectedListContent { fn clear(&mut self) { self.revision.clear(); self.length = ::std::option::Option::None; - self.owner_username.clear(); self.attributes.clear(); self.checksum.clear(); self.contents.clear(); @@ -3540,6 +3539,7 @@ impl ::protobuf::Clear for SelectedListContent { self.resolveAction.clear(); self.issues.clear(); self.nonces.clear(); + self.owner_username.clear(); self.unknown_fields.clear(); } } @@ -3587,17 +3587,17 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x18\n\x0ewantSyncResult\x18\x04\x20\x01(\x08B\0\x12\x19\n\x04dump\x18\ \x05\x20\x01(\x0b2\t.ListDumpB\0\x12\x10\n\x06nonces\x18\x06\x20\x03(\ \x05B\0:\0\"\xa1\x03\n\x13SelectedListContent\x12\x12\n\x08revision\x18\ - \x01\x20\x01(\x0cB\0\x12\x10\n\x06length\x18\x02\x20\x01(\x05B\0\x12\x18\ - \n\x0eowner_username\x18\x10\x20\x01(\tB\0\x12%\n\nattributes\x18\x03\ - \x20\x01(\x0b2\x0f.ListAttributesB\0\x12!\n\x08checksum\x18\x04\x20\x01(\ - \x0b2\r.ListChecksumB\0\x12\x1e\n\x08contents\x18\x05\x20\x01(\x0b2\n.Li\ - stItemsB\0\x12\x15\n\x04diff\x18\x06\x20\x01(\x0b2\x05.DiffB\0\x12\x1b\n\ - \nsyncResult\x18\x07\x20\x01(\x0b2\x05.DiffB\0\x12\x1c\n\x12resultingRev\ - isions\x18\x08\x20\x03(\x0cB\0\x12\x17\n\rmultipleHeads\x18\t\x20\x01(\ - \x08B\0\x12\x12\n\x08upToDate\x18\n\x20\x01(\x08B\0\x12-\n\rresolveActio\ - n\x18\x0c\x20\x03(\x0b2\x14.ClientResolveActionB\0\x12\x1e\n\x06issues\ - \x18\r\x20\x03(\x0b2\x0c.ClientIssueB\0\x12\x10\n\x06nonces\x18\x0e\x20\ - \x03(\x05B\0:\0B\0b\x06proto2\ + \x01\x20\x01(\x0cB\0\x12\x10\n\x06length\x18\x02\x20\x01(\x05B\0\x12%\n\ + \nattributes\x18\x03\x20\x01(\x0b2\x0f.ListAttributesB\0\x12!\n\x08check\ + sum\x18\x04\x20\x01(\x0b2\r.ListChecksumB\0\x12\x1e\n\x08contents\x18\ + \x05\x20\x01(\x0b2\n.ListItemsB\0\x12\x15\n\x04diff\x18\x06\x20\x01(\x0b\ + 2\x05.DiffB\0\x12\x1b\n\nsyncResult\x18\x07\x20\x01(\x0b2\x05.DiffB\0\ + \x12\x1c\n\x12resultingRevisions\x18\x08\x20\x03(\x0cB\0\x12\x17\n\rmult\ + ipleHeads\x18\t\x20\x01(\x08B\0\x12\x12\n\x08upToDate\x18\n\x20\x01(\x08\ + B\0\x12-\n\rresolveAction\x18\x0c\x20\x03(\x0b2\x14.ClientResolveActionB\ + \0\x12\x1e\n\x06issues\x18\r\x20\x03(\x0b2\x0c.ClientIssueB\0\x12\x10\n\ + \x06nonces\x18\x0e\x20\x03(\x05B\0\x12\x18\n\x0eowner_username\x18\x10\ + \x20\x01(\tB\0:\0B\0b\x06proto2\ "; static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {