From 8430592bee6ed3aa7dd353aa37e5067356085751 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 8 Dec 2025 12:30:19 +0900 Subject: [PATCH] commands: strip lifetimes --- src/commands.rs | 40 +++++++++---------- .../audio_output_devices/disableoutput.rs | 2 +- .../audio_output_devices/enableoutput.rs | 2 +- src/commands/audio_output_devices/outputs.rs | 4 +- .../audio_output_devices/outputset.rs | 4 +- .../audio_output_devices/toggleoutput.rs | 2 +- src/commands/client_to_client/channels.rs | 4 +- src/commands/client_to_client/readmessages.rs | 4 +- src/commands/client_to_client/sendmessage.rs | 4 +- src/commands/client_to_client/subscribe.rs | 2 +- src/commands/client_to_client/unsubscribe.rs | 2 +- .../connection_settings/binary_limit.rs | 2 +- src/commands/connection_settings/close.rs | 2 +- src/commands/connection_settings/kill.rs | 2 +- src/commands/connection_settings/password.rs | 2 +- src/commands/connection_settings/ping.rs | 2 +- src/commands/connection_settings/protocol.rs | 2 +- .../connection_settings/protocol_all.rs | 2 +- .../connection_settings/protocol_available.rs | 2 +- .../connection_settings/protocol_clear.rs | 2 +- .../connection_settings/protocol_disable.rs | 4 +- .../connection_settings/protocol_enable.rs | 4 +- src/commands/connection_settings/tag_types.rs | 2 +- .../connection_settings/tag_types_all.rs | 2 +- .../tag_types_available.rs | 2 +- .../connection_settings/tag_types_clear.rs | 2 +- .../connection_settings/tag_types_disable.rs | 4 +- .../connection_settings/tag_types_enable.rs | 4 +- .../connection_settings/tag_types_reset.rs | 4 +- src/commands/controlling_playback/next.rs | 2 +- src/commands/controlling_playback/pause.rs | 4 +- src/commands/controlling_playback/play.rs | 2 +- src/commands/controlling_playback/playid.rs | 2 +- src/commands/controlling_playback/previous.rs | 2 +- src/commands/controlling_playback/seek.rs | 4 +- src/commands/controlling_playback/seekcur.rs | 4 +- src/commands/controlling_playback/seekid.rs | 4 +- src/commands/controlling_playback/stop.rs | 2 +- .../mounts_and_neighbors/listmounts.rs | 2 +- .../mounts_and_neighbors/listneighbors.rs | 4 +- src/commands/mounts_and_neighbors/mount.rs | 4 +- src/commands/mounts_and_neighbors/unmount.rs | 4 +- src/commands/music_database/albumart.rs | 6 +-- src/commands/music_database/count.rs | 8 ++-- src/commands/music_database/find.rs | 8 ++-- src/commands/music_database/findadd.rs | 6 +-- src/commands/music_database/getfingerprint.rs | 4 +- src/commands/music_database/list.rs | 8 ++-- src/commands/music_database/listall.rs | 6 +-- src/commands/music_database/listallinfo.rs | 6 +-- src/commands/music_database/listfiles.rs | 6 +-- src/commands/music_database/lsinfo.rs | 6 +-- src/commands/music_database/readcomments.rs | 4 +- src/commands/music_database/readpicture.rs | 6 +-- src/commands/music_database/rescan.rs | 6 +-- src/commands/music_database/search.rs | 8 ++-- src/commands/music_database/searchadd.rs | 6 +-- src/commands/music_database/searchaddpl.rs | 6 +-- src/commands/music_database/searchcount.rs | 8 ++-- src/commands/music_database/update.rs | 6 +-- .../partition_commands/delpartition.rs | 2 +- .../partition_commands/listpartitions.rs | 2 +- src/commands/partition_commands/moveoutput.rs | 2 +- .../partition_commands/newpartition.rs | 2 +- src/commands/partition_commands/partition.rs | 2 +- src/commands/playback_options/consume.rs | 2 +- src/commands/playback_options/crossfade.rs | 2 +- src/commands/playback_options/getvol.rs | 2 +- src/commands/playback_options/mixrampdb.rs | 2 +- src/commands/playback_options/mixrampdelay.rs | 2 +- src/commands/playback_options/random.rs | 4 +- src/commands/playback_options/repeat.rs | 4 +- .../playback_options/replay_gain_mode.rs | 2 +- .../playback_options/replay_gain_status.rs | 4 +- src/commands/playback_options/setvol.rs | 2 +- src/commands/playback_options/single.rs | 2 +- src/commands/playback_options/volume.rs | 2 +- .../querying_mpd_status/clearerror.rs | 2 +- .../querying_mpd_status/currentsong.rs | 4 +- src/commands/querying_mpd_status/idle.rs | 4 +- src/commands/querying_mpd_status/stats.rs | 4 +- src/commands/querying_mpd_status/status.rs | 4 +- src/commands/queue/add.rs | 4 +- src/commands/queue/addid.rs | 6 +-- src/commands/queue/addtagid.rs | 4 +- src/commands/queue/clear.rs | 2 +- src/commands/queue/cleartagid.rs | 4 +- src/commands/queue/delete.rs | 2 +- src/commands/queue/deleteid.rs | 2 +- src/commands/queue/move_.rs | 4 +- src/commands/queue/moveid.rs | 4 +- src/commands/queue/playlist.rs | 4 +- src/commands/queue/playlistfind.rs | 8 ++-- src/commands/queue/playlistid.rs | 4 +- src/commands/queue/playlistinfo.rs | 6 +-- src/commands/queue/playlistsearch.rs | 8 ++-- src/commands/queue/plchanges.rs | 6 +-- src/commands/queue/plchangesposid.rs | 6 +-- src/commands/queue/prio.rs | 4 +- src/commands/queue/prioid.rs | 4 +- src/commands/queue/rangeid.rs | 4 +- src/commands/queue/shuffle.rs | 4 +- src/commands/queue/swap.rs | 4 +- src/commands/queue/swapid.rs | 4 +- src/commands/reflection/commands.rs | 2 +- src/commands/reflection/config.rs | 4 +- src/commands/reflection/decoders.rs | 4 +- src/commands/reflection/not_commands.rs | 2 +- src/commands/reflection/url_handlers.rs | 2 +- src/commands/stickers/sticker_dec.rs | 4 +- src/commands/stickers/sticker_delete.rs | 4 +- src/commands/stickers/sticker_find.rs | 8 ++-- src/commands/stickers/sticker_get.rs | 4 +- src/commands/stickers/sticker_inc.rs | 4 +- src/commands/stickers/sticker_list.rs | 6 +-- src/commands/stickers/sticker_set.rs | 4 +- src/commands/stickers/stickernames.rs | 2 +- src/commands/stickers/stickernamestypes.rs | 6 +-- src/commands/stickers/stickertypes.rs | 2 +- src/commands/stored_playlists/listplaylist.rs | 4 +- .../stored_playlists/listplaylistinfo.rs | 6 +-- .../stored_playlists/listplaylists.rs | 4 +- src/commands/stored_playlists/load.rs | 4 +- src/commands/stored_playlists/playlistadd.rs | 4 +- .../stored_playlists/playlistclear.rs | 2 +- .../stored_playlists/playlistdelete.rs | 4 +- .../stored_playlists/playlistlength.rs | 4 +- src/commands/stored_playlists/playlistmove.rs | 4 +- src/commands/stored_playlists/rename.rs | 4 +- src/commands/stored_playlists/rm.rs | 2 +- src/commands/stored_playlists/save.rs | 4 +- .../stored_playlists/searchplaylist.rs | 6 +-- src/request.rs | 4 +- 133 files changed, 269 insertions(+), 271 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 0dd6f239..efb3fe00 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -38,7 +38,7 @@ pub use stickers::*; pub use stored_playlists::*; /// A trait modelling a single MPD command request. -pub trait CommandRequest<'a> +pub trait CommandRequest where Self: Sized, { @@ -58,13 +58,13 @@ where /// Parses the request from its tokenized parts. /// See also [`parse_raw`]. - fn parse(parts: RequestTokenizer<'a>) -> Result; + fn parse(parts: RequestTokenizer<'_>) -> Result; /// Parses the request from its raw string representation. /// /// This assumes the raw string starts with the command name, e.g. /// `command_name arg1 "arg2 arg3"` - fn parse_raw(raw: &'a str) -> Result { + fn parse_raw(raw: &str) -> Result { let (line, rest) = raw .split_once('\n') .ok_or(RequestParserError::UnexpectedEOF)?; @@ -92,7 +92,7 @@ where } /// A trait modelling a single MPD command response. -pub trait CommandResponse<'a> +pub trait CommandResponse where Self: Sized, { @@ -109,20 +109,20 @@ where /// Parses the response from its tokenized parts. /// See also [`parse_raw`]. - fn parse(parts: ResponseAttributes<'a>) -> Result; + fn parse(parts: ResponseAttributes<'_>) -> Result; /// Parses the response from its raw byte representation. - fn parse_raw(raw: &'a [u8]) -> Result { + fn parse_raw(raw: &[u8]) -> Result { Self::parse(ResponseAttributes::new_from_bytes(raw)) } } /// A trait modelling the request/response pair of a single MPD command. -pub trait Command<'req, 'res> { +pub trait Command { /// The request sent from the client to the server - type Request: CommandRequest<'req>; + type Request: CommandRequest; /// The response sent from the server to the client - type Response: CommandResponse<'res>; + type Response: CommandResponse; /// The command name used within the protocol const COMMAND: &'static str = Self::Request::COMMAND; @@ -138,13 +138,13 @@ pub trait Command<'req, 'res> { } /// Parse the request from its tokenized parts. See also [`parse_raw_request`]. - fn parse_request(parts: RequestTokenizer<'req>) -> Result { + fn parse_request(parts: RequestTokenizer) -> Result { Self::Request::parse(parts) } /// Parse the raw request string into a request. /// This assumes the raw string starts with the command name, e.g. `command_name arg1 "arg2 arg3"` - fn parse_raw_request(raw: &'req str) -> Result { + fn parse_raw_request(raw: &str) -> Result { Self::Request::parse_raw(raw) } @@ -152,13 +152,11 @@ pub trait Command<'req, 'res> { // fn serialize_response(&self, response: Self::Response) -> String { /// Parse the response from its tokenized parts. See also [`parse_raw_response`]. - fn parse_response( - parts: ResponseAttributes<'res>, - ) -> Result { + fn parse_response(parts: ResponseAttributes) -> Result { Self::Response::parse(parts) } /// Parse the raw response string into a response. - fn parse_raw_response(raw: &'res [u8]) -> Result { + fn parse_raw_response(raw: &[u8]) -> Result { Self::Response::parse_raw(raw) } } @@ -172,7 +170,7 @@ macro_rules! empty_command_request { pub struct [<$name Request>]; } - impl crate::commands::CommandRequest<'_> for paste::paste! { [<$name Request>] } { + impl crate::commands::CommandRequest for paste::paste! { [<$name Request>] } { const COMMAND: &'static str = $command_name; fn into_request_enum(self) -> crate::Request { @@ -213,7 +211,7 @@ macro_rules! empty_command_response { pub struct [<$name Response>]; } - impl crate::commands::CommandResponse<'_> for paste::paste! { [<$name Response>] } { + impl crate::commands::CommandResponse for paste::paste! { [<$name Response>] } { fn into_response_enum(self) -> crate::Response { todo!() } @@ -239,7 +237,7 @@ macro_rules! single_item_command_request { pub struct [<$name Request>] ($item_type); } - impl crate::commands::CommandRequest<'_> for paste::paste! { [<$name Request>] } { + impl crate::commands::CommandRequest for paste::paste! { [<$name Request>] } { const COMMAND: &'static str = $command_name; fn into_request_enum(self) -> crate::Request { @@ -287,7 +285,7 @@ macro_rules! single_optional_item_command_request { pub struct [<$name Request>] (Option<$item_type>); } - impl crate::commands::CommandRequest<'_> for paste::paste! { [<$name Request>] } { + impl crate::commands::CommandRequest for paste::paste! { [<$name Request>] } { const COMMAND: &'static str = $command_name; fn into_request_enum(self) -> crate::Request { @@ -340,7 +338,7 @@ macro_rules! single_item_command_response { pub struct [<$name Response>] ( $item_type ); } - impl crate::commands::CommandResponse<'_> for paste::paste! { [<$name Response>] } { + impl crate::commands::CommandResponse for paste::paste! { [<$name Response>] } { fn into_response_enum(self) -> crate::Response { todo!() } @@ -384,7 +382,7 @@ macro_rules! multi_item_command_response { pub struct [<$name Response>] ( Vec<$item_type> ); } - impl crate::commands::CommandResponse<'_> for paste::paste! { [<$name Response>] } { + impl crate::commands::CommandResponse for paste::paste! { [<$name Response>] } { fn into_response_enum(self) -> crate::Response { todo!() } diff --git a/src/commands/audio_output_devices/disableoutput.rs b/src/commands/audio_output_devices/disableoutput.rs index f99d67f2..d5419048 100644 --- a/src/commands/audio_output_devices/disableoutput.rs +++ b/src/commands/audio_output_devices/disableoutput.rs @@ -9,7 +9,7 @@ single_item_command_request!(DisableOutput, "disableoutput", AudioOutputId); empty_command_response!(DisableOutput); -impl Command<'_, '_> for DisableOutput { +impl Command for DisableOutput { type Request = DisableOutputRequest; type Response = DisableOutputResponse; } diff --git a/src/commands/audio_output_devices/enableoutput.rs b/src/commands/audio_output_devices/enableoutput.rs index cd5c1272..45d1453a 100644 --- a/src/commands/audio_output_devices/enableoutput.rs +++ b/src/commands/audio_output_devices/enableoutput.rs @@ -9,7 +9,7 @@ single_item_command_request!(EnableOutput, "enableoutput", AudioOutputId); empty_command_response!(EnableOutput); -impl Command<'_, '_> for EnableOutput { +impl Command for EnableOutput { type Request = EnableOutputRequest; type Response = EnableOutputResponse; } diff --git a/src/commands/audio_output_devices/outputs.rs b/src/commands/audio_output_devices/outputs.rs index 2c9713d6..b1ec4702 100644 --- a/src/commands/audio_output_devices/outputs.rs +++ b/src/commands/audio_output_devices/outputs.rs @@ -24,7 +24,7 @@ pub struct Output { pub attribute: HashMap, } -impl CommandResponse<'_> for OutputsResponse { +impl CommandResponse for OutputsResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -113,7 +113,7 @@ impl CommandResponse<'_> for OutputsResponse { } } -impl Command<'_, '_> for Outputs { +impl Command for Outputs { type Request = OutputsRequest; type Response = OutputsResponse; } diff --git a/src/commands/audio_output_devices/outputset.rs b/src/commands/audio_output_devices/outputset.rs index e0643cbd..fe44e9a8 100644 --- a/src/commands/audio_output_devices/outputset.rs +++ b/src/commands/audio_output_devices/outputset.rs @@ -15,7 +15,7 @@ pub struct OutputSetRequest { pub attribute_value: String, } -impl CommandRequest<'_> for OutputSetRequest { +impl CommandRequest for OutputSetRequest { const COMMAND: &'static str = "outputset"; fn into_request_enum(self) -> crate::Request { @@ -65,7 +65,7 @@ impl CommandRequest<'_> for OutputSetRequest { empty_command_response!(OutputSet); -impl Command<'_, '_> for OutputSet { +impl Command for OutputSet { type Request = OutputSetRequest; type Response = OutputSetResponse; } diff --git a/src/commands/audio_output_devices/toggleoutput.rs b/src/commands/audio_output_devices/toggleoutput.rs index 1f9d21d1..b82238fa 100644 --- a/src/commands/audio_output_devices/toggleoutput.rs +++ b/src/commands/audio_output_devices/toggleoutput.rs @@ -9,7 +9,7 @@ single_item_command_request!(ToggleOutput, "toggleoutput", AudioOutputId); empty_command_response!(ToggleOutput); -impl Command<'_, '_> for ToggleOutput { +impl Command for ToggleOutput { type Request = ToggleOutputRequest; type Response = ToggleOutputResponse; } diff --git a/src/commands/client_to_client/channels.rs b/src/commands/client_to_client/channels.rs index d707e005..8ea1f152 100644 --- a/src/commands/client_to_client/channels.rs +++ b/src/commands/client_to_client/channels.rs @@ -15,7 +15,7 @@ pub struct ChannelsResponse { pub channels: Vec, } -impl<'a> CommandResponse<'a> for ChannelsResponse { +impl CommandResponse for ChannelsResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -42,7 +42,7 @@ impl<'a> CommandResponse<'a> for ChannelsResponse { } } -impl Command<'_, '_> for Channels { +impl Command for Channels { type Request = ChannelsRequest; type Response = ChannelsResponse; } diff --git a/src/commands/client_to_client/readmessages.rs b/src/commands/client_to_client/readmessages.rs index 7b4cf7fd..e1c115b0 100644 --- a/src/commands/client_to_client/readmessages.rs +++ b/src/commands/client_to_client/readmessages.rs @@ -19,7 +19,7 @@ pub struct ReadMessagesResponseEntry { message: String, } -impl CommandResponse<'_> for ReadMessagesResponse { +impl CommandResponse for ReadMessagesResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -55,7 +55,7 @@ impl CommandResponse<'_> for ReadMessagesResponse { } } -impl Command<'_, '_> for ReadMessages { +impl Command for ReadMessages { type Request = ReadMessagesRequest; type Response = ReadMessagesResponse; } diff --git a/src/commands/client_to_client/sendmessage.rs b/src/commands/client_to_client/sendmessage.rs index 33189224..864c3ef9 100644 --- a/src/commands/client_to_client/sendmessage.rs +++ b/src/commands/client_to_client/sendmessage.rs @@ -14,7 +14,7 @@ pub struct SendMessageRequest { pub message: String, } -impl CommandRequest<'_> for SendMessageRequest { +impl CommandRequest for SendMessageRequest { const COMMAND: &'static str = "sendmessage"; fn into_request_enum(self) -> crate::Request { @@ -51,7 +51,7 @@ impl CommandRequest<'_> for SendMessageRequest { empty_command_response!(SendMessage); -impl Command<'_, '_> for SendMessage { +impl Command for SendMessage { type Request = SendMessageRequest; type Response = SendMessageResponse; } diff --git a/src/commands/client_to_client/subscribe.rs b/src/commands/client_to_client/subscribe.rs index 94448fe1..0e7f1915 100644 --- a/src/commands/client_to_client/subscribe.rs +++ b/src/commands/client_to_client/subscribe.rs @@ -9,7 +9,7 @@ single_item_command_request!(Subscribe, "subscribe", ChannelName); empty_command_response!(Subscribe); -impl Command<'_, '_> for Subscribe { +impl Command for Subscribe { type Request = SubscribeRequest; type Response = SubscribeResponse; } diff --git a/src/commands/client_to_client/unsubscribe.rs b/src/commands/client_to_client/unsubscribe.rs index eef54441..ad7ec131 100644 --- a/src/commands/client_to_client/unsubscribe.rs +++ b/src/commands/client_to_client/unsubscribe.rs @@ -9,7 +9,7 @@ single_item_command_request!(Unsubscribe, "unsubscribe", ChannelName); empty_command_response!(Unsubscribe); -impl Command<'_, '_> for Unsubscribe { +impl Command for Unsubscribe { type Request = UnsubscribeRequest; type Response = UnsubscribeResponse; } diff --git a/src/commands/connection_settings/binary_limit.rs b/src/commands/connection_settings/binary_limit.rs index dca234e9..3872a2b0 100644 --- a/src/commands/connection_settings/binary_limit.rs +++ b/src/commands/connection_settings/binary_limit.rs @@ -6,7 +6,7 @@ single_item_command_request!(BinaryLimit, "binarylimit", u64); empty_command_response!(BinaryLimit); -impl Command<'_, '_> for BinaryLimit { +impl Command for BinaryLimit { type Request = BinaryLimitRequest; type Response = BinaryLimitResponse; } diff --git a/src/commands/connection_settings/close.rs b/src/commands/connection_settings/close.rs index b34c16af..3205b294 100644 --- a/src/commands/connection_settings/close.rs +++ b/src/commands/connection_settings/close.rs @@ -6,7 +6,7 @@ empty_command_request!(Close, "close"); empty_command_response!(Close); -impl Command<'_, '_> for Close { +impl Command for Close { type Request = CloseRequest; type Response = CloseResponse; } diff --git a/src/commands/connection_settings/kill.rs b/src/commands/connection_settings/kill.rs index c6465876..d67f2a42 100644 --- a/src/commands/connection_settings/kill.rs +++ b/src/commands/connection_settings/kill.rs @@ -6,7 +6,7 @@ empty_command_request!(Kill, "kill"); empty_command_response!(Kill); -impl Command<'_, '_> for Kill { +impl Command for Kill { type Request = KillRequest; type Response = KillResponse; } diff --git a/src/commands/connection_settings/password.rs b/src/commands/connection_settings/password.rs index 3f8c92cd..79fcecee 100644 --- a/src/commands/connection_settings/password.rs +++ b/src/commands/connection_settings/password.rs @@ -6,7 +6,7 @@ single_item_command_request!(Password, "password", String); empty_command_response!(Password); -impl Command<'_, '_> for Password { +impl Command for Password { type Request = PasswordRequest; type Response = PasswordResponse; } diff --git a/src/commands/connection_settings/ping.rs b/src/commands/connection_settings/ping.rs index 4463b0b5..98c34dbc 100644 --- a/src/commands/connection_settings/ping.rs +++ b/src/commands/connection_settings/ping.rs @@ -6,7 +6,7 @@ empty_command_request!(Ping, "ping"); empty_command_response!(Ping); -impl Command<'_, '_> for Ping { +impl Command for Ping { type Request = PingRequest; type Response = PingResponse; } diff --git a/src/commands/connection_settings/protocol.rs b/src/commands/connection_settings/protocol.rs index 3c1e8e40..46a115c7 100644 --- a/src/commands/connection_settings/protocol.rs +++ b/src/commands/connection_settings/protocol.rs @@ -9,7 +9,7 @@ empty_command_request!(Protocol, "protocol"); multi_item_command_response!(Protocol, "feature", String); -impl Command<'_, '_> for Protocol { +impl Command for Protocol { type Request = ProtocolRequest; type Response = ProtocolResponse; } diff --git a/src/commands/connection_settings/protocol_all.rs b/src/commands/connection_settings/protocol_all.rs index 69b865b8..c47be8f0 100644 --- a/src/commands/connection_settings/protocol_all.rs +++ b/src/commands/connection_settings/protocol_all.rs @@ -6,7 +6,7 @@ empty_command_request!(ProtocolAll, "protocol all"); empty_command_response!(ProtocolAll); -impl Command<'_, '_> for ProtocolAll { +impl Command for ProtocolAll { type Request = ProtocolAllRequest; type Response = ProtocolAllResponse; } diff --git a/src/commands/connection_settings/protocol_available.rs b/src/commands/connection_settings/protocol_available.rs index cf9d34d7..d1e6e6b2 100644 --- a/src/commands/connection_settings/protocol_available.rs +++ b/src/commands/connection_settings/protocol_available.rs @@ -9,7 +9,7 @@ empty_command_request!(ProtocolAvailable, "protocol available"); multi_item_command_response!(ProtocolAvailable, "feature", String); -impl Command<'_, '_> for ProtocolAvailable { +impl Command for ProtocolAvailable { type Request = ProtocolAvailableRequest; type Response = ProtocolAvailableResponse; } diff --git a/src/commands/connection_settings/protocol_clear.rs b/src/commands/connection_settings/protocol_clear.rs index a722c4a1..8d339d2d 100644 --- a/src/commands/connection_settings/protocol_clear.rs +++ b/src/commands/connection_settings/protocol_clear.rs @@ -6,7 +6,7 @@ empty_command_request!(ProtocolClear, "protocol clear"); empty_command_response!(ProtocolClear); -impl Command<'_, '_> for ProtocolClear { +impl Command for ProtocolClear { type Request = ProtocolClearRequest; type Response = ProtocolClearResponse; } diff --git a/src/commands/connection_settings/protocol_disable.rs b/src/commands/connection_settings/protocol_disable.rs index 96965518..a8b26a32 100644 --- a/src/commands/connection_settings/protocol_disable.rs +++ b/src/commands/connection_settings/protocol_disable.rs @@ -8,7 +8,7 @@ pub struct ProtocolDisable; pub struct ProtocolDisableRequest(Vec); -impl CommandRequest<'_> for ProtocolDisableRequest { +impl CommandRequest for ProtocolDisableRequest { const COMMAND: &'static str = "protocol disable"; fn into_request_enum(self) -> crate::Request { @@ -52,7 +52,7 @@ impl CommandRequest<'_> for ProtocolDisableRequest { empty_command_response!(ProtocolDisable); -impl Command<'_, '_> for ProtocolDisable { +impl Command for ProtocolDisable { type Request = ProtocolDisableRequest; type Response = ProtocolDisableResponse; } diff --git a/src/commands/connection_settings/protocol_enable.rs b/src/commands/connection_settings/protocol_enable.rs index ecfc21fc..2bd5b4a9 100644 --- a/src/commands/connection_settings/protocol_enable.rs +++ b/src/commands/connection_settings/protocol_enable.rs @@ -8,7 +8,7 @@ pub struct ProtocolEnable; pub struct ProtocolEnableRequest(Vec); -impl CommandRequest<'_> for ProtocolEnableRequest { +impl CommandRequest for ProtocolEnableRequest { const COMMAND: &'static str = "protocol enable"; fn into_request_enum(self) -> crate::Request { @@ -52,7 +52,7 @@ impl CommandRequest<'_> for ProtocolEnableRequest { empty_command_response!(ProtocolEnable); -impl Command<'_, '_> for ProtocolEnable { +impl Command for ProtocolEnable { type Request = ProtocolEnableRequest; type Response = ProtocolEnableResponse; } diff --git a/src/commands/connection_settings/tag_types.rs b/src/commands/connection_settings/tag_types.rs index 9e99907e..7b7f47fa 100644 --- a/src/commands/connection_settings/tag_types.rs +++ b/src/commands/connection_settings/tag_types.rs @@ -9,7 +9,7 @@ empty_command_request!(TagTypes, "tagtypes"); multi_item_command_response!(TagTypes, "tagtype", String); -impl Command<'_, '_> for TagTypes { +impl Command for TagTypes { type Request = TagTypesRequest; type Response = TagTypesResponse; } diff --git a/src/commands/connection_settings/tag_types_all.rs b/src/commands/connection_settings/tag_types_all.rs index 5348881c..54deb98b 100644 --- a/src/commands/connection_settings/tag_types_all.rs +++ b/src/commands/connection_settings/tag_types_all.rs @@ -6,7 +6,7 @@ empty_command_request!(TagTypesAll, "tagtypes all"); empty_command_response!(TagTypesAll); -impl Command<'_, '_> for TagTypesAll { +impl Command for TagTypesAll { type Request = TagTypesAllRequest; type Response = TagTypesAllResponse; } diff --git a/src/commands/connection_settings/tag_types_available.rs b/src/commands/connection_settings/tag_types_available.rs index e58ac10a..f6ba8537 100644 --- a/src/commands/connection_settings/tag_types_available.rs +++ b/src/commands/connection_settings/tag_types_available.rs @@ -9,7 +9,7 @@ empty_command_request!(TagTypesAvailable, "tagtypes available"); multi_item_command_response!(TagTypesAvailable, "tagtype", String); -impl Command<'_, '_> for TagTypesAvailable { +impl Command for TagTypesAvailable { type Request = TagTypesAvailableRequest; type Response = TagTypesAvailableResponse; } diff --git a/src/commands/connection_settings/tag_types_clear.rs b/src/commands/connection_settings/tag_types_clear.rs index c2e3e264..8fa92ebd 100644 --- a/src/commands/connection_settings/tag_types_clear.rs +++ b/src/commands/connection_settings/tag_types_clear.rs @@ -6,7 +6,7 @@ empty_command_request!(TagTypesClear, "tagtypes clear"); empty_command_response!(TagTypesClear); -impl Command<'_, '_> for TagTypesClear { +impl Command for TagTypesClear { type Request = TagTypesClearRequest; type Response = TagTypesClearResponse; } diff --git a/src/commands/connection_settings/tag_types_disable.rs b/src/commands/connection_settings/tag_types_disable.rs index 4f8b28c4..31248b79 100644 --- a/src/commands/connection_settings/tag_types_disable.rs +++ b/src/commands/connection_settings/tag_types_disable.rs @@ -8,7 +8,7 @@ pub struct TagTypesDisable; pub struct TagTypesDisableRequest(Vec); -impl CommandRequest<'_> for TagTypesDisableRequest { +impl CommandRequest for TagTypesDisableRequest { const COMMAND: &'static str = "tagtypes disable"; fn into_request_enum(self) -> crate::Request { @@ -53,7 +53,7 @@ impl CommandRequest<'_> for TagTypesDisableRequest { empty_command_response!(TagTypesDisable); -impl Command<'_, '_> for TagTypesDisable { +impl Command for TagTypesDisable { type Request = TagTypesDisableRequest; type Response = TagTypesDisableResponse; } diff --git a/src/commands/connection_settings/tag_types_enable.rs b/src/commands/connection_settings/tag_types_enable.rs index 90bf6aac..714128ab 100644 --- a/src/commands/connection_settings/tag_types_enable.rs +++ b/src/commands/connection_settings/tag_types_enable.rs @@ -8,7 +8,7 @@ pub struct TagTypesEnable; pub struct TagTypesEnableRequest(Vec); -impl CommandRequest<'_> for TagTypesEnableRequest { +impl CommandRequest for TagTypesEnableRequest { const COMMAND: &'static str = "tagtypes enable"; fn into_request_enum(self) -> crate::Request { @@ -53,7 +53,7 @@ impl CommandRequest<'_> for TagTypesEnableRequest { empty_command_response!(TagTypesEnable); -impl Command<'_, '_> for TagTypesEnable { +impl Command for TagTypesEnable { type Request = TagTypesEnableRequest; type Response = TagTypesEnableResponse; } diff --git a/src/commands/connection_settings/tag_types_reset.rs b/src/commands/connection_settings/tag_types_reset.rs index d8748279..fe4b8a10 100644 --- a/src/commands/connection_settings/tag_types_reset.rs +++ b/src/commands/connection_settings/tag_types_reset.rs @@ -8,7 +8,7 @@ pub struct TagTypesReset; pub struct TagTypesResetRequest(Vec); -impl CommandRequest<'_> for TagTypesResetRequest { +impl CommandRequest for TagTypesResetRequest { const COMMAND: &'static str = "tagtypes reset"; fn into_request_enum(self) -> crate::Request { @@ -53,7 +53,7 @@ impl CommandRequest<'_> for TagTypesResetRequest { empty_command_response!(TagTypesReset); -impl Command<'_, '_> for TagTypesReset { +impl Command for TagTypesReset { type Request = TagTypesResetRequest; type Response = TagTypesResetResponse; } diff --git a/src/commands/controlling_playback/next.rs b/src/commands/controlling_playback/next.rs index de29dfce..6f8974b0 100644 --- a/src/commands/controlling_playback/next.rs +++ b/src/commands/controlling_playback/next.rs @@ -6,7 +6,7 @@ empty_command_request!(Next, "next"); empty_command_response!(Next); -impl Command<'_, '_> for Next { +impl Command for Next { type Request = NextRequest; type Response = NextResponse; } diff --git a/src/commands/controlling_playback/pause.rs b/src/commands/controlling_playback/pause.rs index bdaa4067..f4bea63f 100644 --- a/src/commands/controlling_playback/pause.rs +++ b/src/commands/controlling_playback/pause.rs @@ -7,7 +7,7 @@ pub struct Pause; pub struct PauseRequest(Option); -impl CommandRequest<'_> for PauseRequest { +impl CommandRequest for PauseRequest { const COMMAND: &'static str = "pause"; fn into_request_enum(self) -> crate::Request { @@ -45,7 +45,7 @@ impl CommandRequest<'_> for PauseRequest { empty_command_response!(Pause); -impl Command<'_, '_> for Pause { +impl Command for Pause { type Request = PauseRequest; type Response = PauseResponse; } diff --git a/src/commands/controlling_playback/play.rs b/src/commands/controlling_playback/play.rs index 51384a56..56ee5e5e 100644 --- a/src/commands/controlling_playback/play.rs +++ b/src/commands/controlling_playback/play.rs @@ -9,7 +9,7 @@ single_optional_item_command_request!(Play, "play", SongPosition); empty_command_response!(Play); -impl Command<'_, '_> for Play { +impl Command for Play { type Request = PlayRequest; type Response = PlayResponse; } diff --git a/src/commands/controlling_playback/playid.rs b/src/commands/controlling_playback/playid.rs index 98d32892..b325fb03 100644 --- a/src/commands/controlling_playback/playid.rs +++ b/src/commands/controlling_playback/playid.rs @@ -9,7 +9,7 @@ single_optional_item_command_request!(PlayId, "playid", SongId); empty_command_response!(PlayId); -impl Command<'_, '_> for PlayId { +impl Command for PlayId { type Request = PlayIdRequest; type Response = PlayIdResponse; } diff --git a/src/commands/controlling_playback/previous.rs b/src/commands/controlling_playback/previous.rs index d4ea8e12..c2065dd1 100644 --- a/src/commands/controlling_playback/previous.rs +++ b/src/commands/controlling_playback/previous.rs @@ -6,7 +6,7 @@ empty_command_request!(Previous, "previous"); empty_command_response!(Previous); -impl Command<'_, '_> for Previous { +impl Command for Previous { type Request = PreviousRequest; type Response = PreviousResponse; } diff --git a/src/commands/controlling_playback/seek.rs b/src/commands/controlling_playback/seek.rs index 5381554f..6db131f7 100644 --- a/src/commands/controlling_playback/seek.rs +++ b/src/commands/controlling_playback/seek.rs @@ -14,7 +14,7 @@ pub struct SeekRequest { pub time: TimeWithFractions, } -impl CommandRequest<'_> for SeekRequest { +impl CommandRequest for SeekRequest { const COMMAND: &'static str = "seek"; fn into_request_enum(self) -> crate::Request { @@ -55,7 +55,7 @@ impl CommandRequest<'_> for SeekRequest { empty_command_response!(Seek); -impl Command<'_, '_> for Seek { +impl Command for Seek { type Request = SeekRequest; type Response = SeekResponse; } diff --git a/src/commands/controlling_playback/seekcur.rs b/src/commands/controlling_playback/seekcur.rs index 8a5c09a8..c77534be 100644 --- a/src/commands/controlling_playback/seekcur.rs +++ b/src/commands/controlling_playback/seekcur.rs @@ -14,7 +14,7 @@ pub struct SeekCurRequest { pub time: TimeWithFractions, } -impl CommandRequest<'_> for SeekCurRequest { +impl CommandRequest for SeekCurRequest { const COMMAND: &'static str = "seekcur"; fn into_request_enum(self) -> crate::Request { @@ -75,7 +75,7 @@ impl CommandRequest<'_> for SeekCurRequest { empty_command_response!(SeekCur); -impl Command<'_, '_> for SeekCur { +impl Command for SeekCur { type Request = SeekCurRequest; type Response = SeekCurResponse; } diff --git a/src/commands/controlling_playback/seekid.rs b/src/commands/controlling_playback/seekid.rs index a661a6cf..a3bc29d5 100644 --- a/src/commands/controlling_playback/seekid.rs +++ b/src/commands/controlling_playback/seekid.rs @@ -14,7 +14,7 @@ pub struct SeekIdRequest { pub time: TimeWithFractions, } -impl CommandRequest<'_> for SeekIdRequest { +impl CommandRequest for SeekIdRequest { const COMMAND: &'static str = "seekid"; fn into_request_enum(self) -> crate::Request { @@ -55,7 +55,7 @@ impl CommandRequest<'_> for SeekIdRequest { empty_command_response!(SeekId); -impl Command<'_, '_> for SeekId { +impl Command for SeekId { type Request = SeekIdRequest; type Response = SeekIdResponse; } diff --git a/src/commands/controlling_playback/stop.rs b/src/commands/controlling_playback/stop.rs index c25ee8b6..2467f010 100644 --- a/src/commands/controlling_playback/stop.rs +++ b/src/commands/controlling_playback/stop.rs @@ -6,7 +6,7 @@ empty_command_request!(Stop, "stop"); empty_command_response!(Stop); -impl Command<'_, '_> for Stop { +impl Command for Stop { type Request = StopRequest; type Response = StopResponse; } diff --git a/src/commands/mounts_and_neighbors/listmounts.rs b/src/commands/mounts_and_neighbors/listmounts.rs index b7138549..708c5920 100644 --- a/src/commands/mounts_and_neighbors/listmounts.rs +++ b/src/commands/mounts_and_neighbors/listmounts.rs @@ -9,7 +9,7 @@ empty_command_request!(ListMounts, "listmounts"); multi_item_command_response!(ListMounts, "mount", String); -impl Command<'_, '_> for ListMounts { +impl Command for ListMounts { type Request = ListMountsRequest; type Response = ListMountsResponse; } diff --git a/src/commands/mounts_and_neighbors/listneighbors.rs b/src/commands/mounts_and_neighbors/listneighbors.rs index 442c59f5..606b193f 100644 --- a/src/commands/mounts_and_neighbors/listneighbors.rs +++ b/src/commands/mounts_and_neighbors/listneighbors.rs @@ -14,7 +14,7 @@ empty_command_request!(ListNeighbors, "listneighbors"); #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ListNeighborsResponse(HashMap); -impl CommandResponse<'_> for ListNeighborsResponse { +impl CommandResponse for ListNeighborsResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -46,7 +46,7 @@ impl CommandResponse<'_> for ListNeighborsResponse { } } -impl Command<'_, '_> for ListNeighbors { +impl Command for ListNeighbors { type Request = ListNeighborsRequest; type Response = ListNeighborsResponse; } diff --git a/src/commands/mounts_and_neighbors/mount.rs b/src/commands/mounts_and_neighbors/mount.rs index d62c2d2c..161d8dde 100644 --- a/src/commands/mounts_and_neighbors/mount.rs +++ b/src/commands/mounts_and_neighbors/mount.rs @@ -14,7 +14,7 @@ pub struct MountRequest { pub uri: Uri, } -impl CommandRequest<'_> for MountRequest { +impl CommandRequest for MountRequest { const COMMAND: &'static str = "mount"; fn into_request_enum(self) -> crate::Request { @@ -57,7 +57,7 @@ impl CommandRequest<'_> for MountRequest { empty_command_response!(Mount); -impl Command<'_, '_> for Mount { +impl Command for Mount { type Request = MountRequest; type Response = MountResponse; } diff --git a/src/commands/mounts_and_neighbors/unmount.rs b/src/commands/mounts_and_neighbors/unmount.rs index 85eb05bf..3837e39d 100644 --- a/src/commands/mounts_and_neighbors/unmount.rs +++ b/src/commands/mounts_and_neighbors/unmount.rs @@ -10,7 +10,7 @@ pub struct Unmount; #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct UnmountRequest(MountPath); -impl CommandRequest<'_> for UnmountRequest { +impl CommandRequest for UnmountRequest { const COMMAND: &'static str = "unmount"; fn into_request_enum(self) -> crate::Request { @@ -47,7 +47,7 @@ impl CommandRequest<'_> for UnmountRequest { empty_command_response!(Unmount); -impl Command<'_, '_> for Unmount { +impl Command for Unmount { type Request = UnmountRequest; type Response = UnmountResponse; } diff --git a/src/commands/music_database/albumart.rs b/src/commands/music_database/albumart.rs index 34ad3411..c3952d3c 100644 --- a/src/commands/music_database/albumart.rs +++ b/src/commands/music_database/albumart.rs @@ -17,7 +17,7 @@ pub struct AlbumArtRequest { offset: Offset, } -impl CommandRequest<'_> for AlbumArtRequest { +impl CommandRequest for AlbumArtRequest { const COMMAND: &'static str = "albumart"; fn into_request_enum(self) -> crate::Request { @@ -63,7 +63,7 @@ pub struct AlbumArtResponse { pub binary: Vec, } -impl CommandResponse<'_> for AlbumArtResponse { +impl CommandResponse for AlbumArtResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -83,7 +83,7 @@ impl CommandResponse<'_> for AlbumArtResponse { } } -impl Command<'_, '_> for AlbumArt { +impl Command for AlbumArt { type Request = AlbumArtRequest; type Response = AlbumArtResponse; } diff --git a/src/commands/music_database/count.rs b/src/commands/music_database/count.rs index 4193d36a..c72330de 100644 --- a/src/commands/music_database/count.rs +++ b/src/commands/music_database/count.rs @@ -18,7 +18,7 @@ pub struct CountRequest { group: Option, } -impl CommandRequest<'_> for CountRequest { +impl CommandRequest for CountRequest { const COMMAND: &'static str = "count"; fn into_request_enum(self) -> crate::Request { @@ -37,7 +37,7 @@ impl CommandRequest<'_> for CountRequest { if let Some(group) = self.group.as_ref() { cmd.push_str(&format!(" group {}", group)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -73,7 +73,7 @@ pub struct CountResponse { pub playtime: u64, } -impl CommandResponse<'_> for CountResponse { +impl CommandResponse for CountResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -92,7 +92,7 @@ impl CommandResponse<'_> for CountResponse { } } -impl Command<'_, '_> for Count { +impl Command for Count { type Request = CountRequest; type Response = CountResponse; } diff --git a/src/commands/music_database/find.rs b/src/commands/music_database/find.rs index bb34b482..6cb3d8ef 100644 --- a/src/commands/music_database/find.rs +++ b/src/commands/music_database/find.rs @@ -17,7 +17,7 @@ pub struct FindRequest { window: Option, } -impl CommandRequest<'_> for FindRequest { +impl CommandRequest for FindRequest { const COMMAND: &'static str = "find"; fn into_request_enum(self) -> crate::Request { @@ -43,7 +43,7 @@ impl CommandRequest<'_> for FindRequest { if let Some(window) = &self.window { cmd.push_str(&format!(" window {}", window)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -88,7 +88,7 @@ impl CommandRequest<'_> for FindRequest { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct FindResponse(Vec); -impl CommandResponse<'_> for FindResponse { +impl CommandResponse for FindResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -114,7 +114,7 @@ impl CommandResponse<'_> for FindResponse { } } -impl Command<'_, '_> for Find { +impl Command for Find { type Request = FindRequest; type Response = FindResponse; } diff --git a/src/commands/music_database/findadd.rs b/src/commands/music_database/findadd.rs index d677b95b..5d5f3b7f 100644 --- a/src/commands/music_database/findadd.rs +++ b/src/commands/music_database/findadd.rs @@ -17,7 +17,7 @@ pub struct FindAddRequest { position: Option, } -impl CommandRequest<'_> for FindAddRequest { +impl CommandRequest for FindAddRequest { const COMMAND: &'static str = "findadd"; fn into_request_enum(self) -> crate::Request { @@ -47,7 +47,7 @@ impl CommandRequest<'_> for FindAddRequest { if let Some(position) = &self.position { cmd.push_str(&format!(" position {}", position)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -102,7 +102,7 @@ impl CommandRequest<'_> for FindAddRequest { empty_command_response!(FindAdd); -impl Command<'_, '_> for FindAdd { +impl Command for FindAdd { type Request = FindAddRequest; type Response = FindAddResponse; } diff --git a/src/commands/music_database/getfingerprint.rs b/src/commands/music_database/getfingerprint.rs index 0bab460d..7b0fb58c 100644 --- a/src/commands/music_database/getfingerprint.rs +++ b/src/commands/music_database/getfingerprint.rs @@ -17,7 +17,7 @@ pub struct GetFingerprintResponse { pub chromaprint: String, } -impl CommandResponse<'_> for GetFingerprintResponse { +impl CommandResponse for GetFingerprintResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -35,7 +35,7 @@ impl CommandResponse<'_> for GetFingerprintResponse { } } -impl Command<'_, '_> for GetFingerprint { +impl Command for GetFingerprint { type Request = GetFingerprintRequest; type Response = GetFingerprintResponse; } diff --git a/src/commands/music_database/list.rs b/src/commands/music_database/list.rs index 8e18bf9d..8ddafbc6 100644 --- a/src/commands/music_database/list.rs +++ b/src/commands/music_database/list.rs @@ -18,7 +18,7 @@ pub struct ListRequest { window: Option, } -impl CommandRequest<'_> for ListRequest { +impl CommandRequest for ListRequest { const COMMAND: &'static str = "list"; fn into_request_enum(self) -> crate::Request { @@ -48,7 +48,7 @@ impl CommandRequest<'_> for ListRequest { if let Some(window) = &self.window { cmd.push_str(&format!(" window {}", window)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -109,7 +109,7 @@ impl CommandRequest<'_> for ListRequest { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ListResponse(Vec); -impl CommandResponse<'_> for ListResponse { +impl CommandResponse for ListResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -134,7 +134,7 @@ impl CommandResponse<'_> for ListResponse { } } -impl Command<'_, '_> for List { +impl Command for List { type Request = ListRequest; type Response = ListResponse; } diff --git a/src/commands/music_database/listall.rs b/src/commands/music_database/listall.rs index 45abea92..e29bcc81 100644 --- a/src/commands/music_database/listall.rs +++ b/src/commands/music_database/listall.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{ - Command, CommandResponse, RequestParserError, ResponseParserError, + Command, CommandResponse, ResponseParserError, single_optional_item_command_request, }, response_tokenizer::ResponseAttributes, @@ -17,7 +17,7 @@ single_optional_item_command_request!(ListAll, "listall", Uri); #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ListAllResponse(Vec); -impl CommandResponse<'_> for ListAllResponse { +impl CommandResponse for ListAllResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -33,7 +33,7 @@ impl CommandResponse<'_> for ListAllResponse { } } -impl Command<'_, '_> for ListAll { +impl Command for ListAll { type Request = ListAllRequest; type Response = ListAllResponse; } diff --git a/src/commands/music_database/listallinfo.rs b/src/commands/music_database/listallinfo.rs index 6c7747b0..99aa33cc 100644 --- a/src/commands/music_database/listallinfo.rs +++ b/src/commands/music_database/listallinfo.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{ - Command, CommandResponse, RequestParserError, ResponseParserError, + Command, CommandResponse, ResponseParserError, single_optional_item_command_request, }, response_tokenizer::ResponseAttributes, @@ -17,7 +17,7 @@ single_optional_item_command_request!(ListAllInfo, "listallinfo", Uri); #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ListAllInfoResponse(Vec); -impl CommandResponse<'_> for ListAllInfoResponse { +impl CommandResponse for ListAllInfoResponse { fn from_response_enum(response: crate::Response) -> Option { todo!() } @@ -33,7 +33,7 @@ impl CommandResponse<'_> for ListAllInfoResponse { } } -impl Command<'_, '_> for ListAllInfo { +impl Command for ListAllInfo { type Request = ListAllInfoRequest; type Response = ListAllInfoResponse; } diff --git a/src/commands/music_database/listfiles.rs b/src/commands/music_database/listfiles.rs index 05b6a013..f5eb1832 100644 --- a/src/commands/music_database/listfiles.rs +++ b/src/commands/music_database/listfiles.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{ - Command, CommandResponse, RequestParserError, ResponseParserError, + Command, CommandResponse, ResponseParserError, single_optional_item_command_request, }, response_tokenizer::ResponseAttributes, @@ -16,7 +16,7 @@ single_optional_item_command_request!(ListFiles, "listfiles", Uri); #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ListFilesResponse(Vec); -impl CommandResponse<'_> for ListFilesResponse { +impl CommandResponse for ListFilesResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -42,7 +42,7 @@ impl CommandResponse<'_> for ListFilesResponse { } } -impl Command<'_, '_> for ListFiles { +impl Command for ListFiles { type Request = ListFilesRequest; type Response = ListFilesResponse; } diff --git a/src/commands/music_database/lsinfo.rs b/src/commands/music_database/lsinfo.rs index ac9c803a..2e858cc7 100644 --- a/src/commands/music_database/lsinfo.rs +++ b/src/commands/music_database/lsinfo.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{ - Command, CommandResponse, RequestParserError, ResponseParserError, + Command, CommandResponse, ResponseParserError, single_optional_item_command_request, }, response_tokenizer::ResponseAttributes, @@ -16,7 +16,7 @@ single_optional_item_command_request!(LsInfo, "lsinfo", Uri); #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct LsInfoResponse(Vec); -impl CommandResponse<'_> for LsInfoResponse { +impl CommandResponse for LsInfoResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -32,7 +32,7 @@ impl CommandResponse<'_> for LsInfoResponse { } } -impl Command<'_, '_> for LsInfo { +impl Command for LsInfo { type Request = LsInfoRequest; type Response = LsInfoResponse; } diff --git a/src/commands/music_database/readcomments.rs b/src/commands/music_database/readcomments.rs index fe13f0c6..268cf683 100644 --- a/src/commands/music_database/readcomments.rs +++ b/src/commands/music_database/readcomments.rs @@ -15,7 +15,7 @@ single_item_command_request!(ReadComments, "readcomments", Uri); #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ReadCommentsResponse(HashMap); -impl CommandResponse<'_> for ReadCommentsResponse { +impl CommandResponse for ReadCommentsResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -41,7 +41,7 @@ impl CommandResponse<'_> for ReadCommentsResponse { } } -impl Command<'_, '_> for ReadComments { +impl Command for ReadComments { type Request = ReadCommentsRequest; type Response = ReadCommentsResponse; } diff --git a/src/commands/music_database/readpicture.rs b/src/commands/music_database/readpicture.rs index d583ed59..bc15cbc7 100644 --- a/src/commands/music_database/readpicture.rs +++ b/src/commands/music_database/readpicture.rs @@ -19,7 +19,7 @@ pub struct ReadPictureRequest { pub offset: Offset, } -impl CommandRequest<'_> for ReadPictureRequest { +impl CommandRequest for ReadPictureRequest { const COMMAND: &'static str = "readpicture"; fn into_request_enum(self) -> crate::Request { @@ -66,7 +66,7 @@ pub struct ReadPictureResponse { pub mimetype: Option, } -impl CommandResponse<'_> for ReadPictureResponse { +impl CommandResponse for ReadPictureResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -97,7 +97,7 @@ impl CommandResponse<'_> for ReadPictureResponse { } } -impl Command<'_, '_> for ReadPicture { +impl Command for ReadPicture { type Request = ReadPictureRequest; type Response = ReadPictureResponse; } diff --git a/src/commands/music_database/rescan.rs b/src/commands/music_database/rescan.rs index 3b60e33f..ff8ea813 100644 --- a/src/commands/music_database/rescan.rs +++ b/src/commands/music_database/rescan.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{ - Command, CommandResponse, RequestParserError, ResponseParserError, + Command, CommandResponse, ResponseParserError, single_optional_item_command_request, }, response_tokenizer::{ResponseAttributes, get_and_parse_property}, @@ -20,7 +20,7 @@ pub struct RescanResponse { pub updating_db: usize, } -impl CommandResponse<'_> for RescanResponse { +impl CommandResponse for RescanResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -38,7 +38,7 @@ impl CommandResponse<'_> for RescanResponse { } } -impl Command<'_, '_> for Rescan { +impl Command for Rescan { type Request = RescanRequest; type Response = RescanResponse; } diff --git a/src/commands/music_database/search.rs b/src/commands/music_database/search.rs index f9f4b849..d88bc573 100644 --- a/src/commands/music_database/search.rs +++ b/src/commands/music_database/search.rs @@ -17,7 +17,7 @@ pub struct SearchRequest { window: Option, } -impl CommandRequest<'_> for SearchRequest { +impl CommandRequest for SearchRequest { const COMMAND: &'static str = "search"; fn into_request_enum(self) -> crate::Request { @@ -43,7 +43,7 @@ impl CommandRequest<'_> for SearchRequest { if let Some(window) = &self.window { cmd.push_str(&format!(" window {}", window)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -88,7 +88,7 @@ impl CommandRequest<'_> for SearchRequest { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct SearchResponse(Vec); -impl CommandResponse<'_> for SearchResponse { +impl CommandResponse for SearchResponse { fn from_response_enum(response: crate::Response) -> Option { todo!() } @@ -114,7 +114,7 @@ impl CommandResponse<'_> for SearchResponse { } } -impl Command<'_, '_> for Search { +impl Command for Search { type Request = SearchRequest; type Response = SearchResponse; } diff --git a/src/commands/music_database/searchadd.rs b/src/commands/music_database/searchadd.rs index 85bc88ca..4f09b36b 100644 --- a/src/commands/music_database/searchadd.rs +++ b/src/commands/music_database/searchadd.rs @@ -17,7 +17,7 @@ pub struct SearchAddRequest { position: Option, } -impl CommandRequest<'_> for SearchAddRequest { +impl CommandRequest for SearchAddRequest { const COMMAND: &'static str = "searchadd"; fn into_request_enum(self) -> crate::Request { @@ -47,7 +47,7 @@ impl CommandRequest<'_> for SearchAddRequest { if let Some(position) = &self.position { cmd.push_str(&format!(" position {}", position)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -102,7 +102,7 @@ impl CommandRequest<'_> for SearchAddRequest { empty_command_response!(SearchAdd); -impl Command<'_, '_> for SearchAdd { +impl Command for SearchAdd { type Request = SearchAddRequest; type Response = SearchAddResponse; } diff --git a/src/commands/music_database/searchaddpl.rs b/src/commands/music_database/searchaddpl.rs index 60b6c7b2..3a77287c 100644 --- a/src/commands/music_database/searchaddpl.rs +++ b/src/commands/music_database/searchaddpl.rs @@ -18,7 +18,7 @@ pub struct SearchAddPlRequest { position: Option, } -impl CommandRequest<'_> for SearchAddPlRequest { +impl CommandRequest for SearchAddPlRequest { const COMMAND: &'static str = "searchaddpl"; fn into_request_enum(self) -> crate::Request { @@ -57,7 +57,7 @@ impl CommandRequest<'_> for SearchAddPlRequest { if let Some(position) = &self.position { cmd.push_str(&format!(" position {}", position)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -118,7 +118,7 @@ impl CommandRequest<'_> for SearchAddPlRequest { empty_command_response!(SearchAddPl); -impl Command<'_, '_> for SearchAddPl { +impl Command for SearchAddPl { type Request = SearchAddPlRequest; type Response = SearchAddPlResponse; } diff --git a/src/commands/music_database/searchcount.rs b/src/commands/music_database/searchcount.rs index ce73318e..0cb357f4 100644 --- a/src/commands/music_database/searchcount.rs +++ b/src/commands/music_database/searchcount.rs @@ -18,7 +18,7 @@ pub struct SearchCountRequest { group: Option, } -impl CommandRequest<'_> for SearchCountRequest { +impl CommandRequest for SearchCountRequest { const COMMAND: &'static str = "searchcount"; fn into_request_enum(self) -> crate::Request { @@ -39,7 +39,7 @@ impl CommandRequest<'_> for SearchCountRequest { if let Some(group) = &self.group { cmd.push_str(&format!(" group {}", group)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -74,7 +74,7 @@ pub struct SearchCountResponse { pub playtime: Seconds, } -impl CommandResponse<'_> for SearchCountResponse { +impl CommandResponse for SearchCountResponse { fn from_response_enum(response: crate::Response) -> Option { todo!() } @@ -93,7 +93,7 @@ impl CommandResponse<'_> for SearchCountResponse { } } -impl Command<'_, '_> for SearchCount { +impl Command for SearchCount { type Request = SearchCountRequest; type Response = SearchCountResponse; } diff --git a/src/commands/music_database/update.rs b/src/commands/music_database/update.rs index f62e9a57..74d93eff 100644 --- a/src/commands/music_database/update.rs +++ b/src/commands/music_database/update.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{ - Command, CommandResponse, RequestParserError, ResponseParserError, + Command, CommandResponse, ResponseParserError, single_optional_item_command_request, }, response_tokenizer::{ResponseAttributes, get_and_parse_property}, @@ -20,7 +20,7 @@ pub struct UpdateResponse { updating_db: usize, } -impl CommandResponse<'_> for UpdateResponse { +impl CommandResponse for UpdateResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -38,7 +38,7 @@ impl CommandResponse<'_> for UpdateResponse { } } -impl Command<'_, '_> for Update { +impl Command for Update { type Request = UpdateRequest; type Response = UpdateResponse; } diff --git a/src/commands/partition_commands/delpartition.rs b/src/commands/partition_commands/delpartition.rs index ffdae32a..79fdf04c 100644 --- a/src/commands/partition_commands/delpartition.rs +++ b/src/commands/partition_commands/delpartition.rs @@ -9,7 +9,7 @@ single_item_command_request!(DelPartition, "delpartition", PartitionName); empty_command_response!(DelPartition); -impl Command<'_, '_> for DelPartition { +impl Command for DelPartition { type Request = DelPartitionRequest; type Response = DelPartitionResponse; } diff --git a/src/commands/partition_commands/listpartitions.rs b/src/commands/partition_commands/listpartitions.rs index d66392e5..89b99f18 100644 --- a/src/commands/partition_commands/listpartitions.rs +++ b/src/commands/partition_commands/listpartitions.rs @@ -10,7 +10,7 @@ empty_command_request!(ListPartitions, "listpartitions"); multi_item_command_response!(ListPartitions, "partition", PartitionName); -impl Command<'_, '_> for ListPartitions { +impl Command for ListPartitions { type Request = ListPartitionsRequest; type Response = ListPartitionsResponse; } diff --git a/src/commands/partition_commands/moveoutput.rs b/src/commands/partition_commands/moveoutput.rs index a1ea16e1..e686f486 100644 --- a/src/commands/partition_commands/moveoutput.rs +++ b/src/commands/partition_commands/moveoutput.rs @@ -6,7 +6,7 @@ single_item_command_request!(MoveOutput, "moveoutput", String); empty_command_response!(MoveOutput); -impl Command<'_, '_> for MoveOutput { +impl Command for MoveOutput { type Request = MoveOutputRequest; type Response = MoveOutputResponse; } diff --git a/src/commands/partition_commands/newpartition.rs b/src/commands/partition_commands/newpartition.rs index 1cea4c80..cf4d6ffe 100644 --- a/src/commands/partition_commands/newpartition.rs +++ b/src/commands/partition_commands/newpartition.rs @@ -9,7 +9,7 @@ single_item_command_request!(NewPartition, "newpartition", PartitionName); empty_command_response!(NewPartition); -impl Command<'_, '_> for NewPartition { +impl Command for NewPartition { type Request = NewPartitionRequest; type Response = NewPartitionResponse; } diff --git a/src/commands/partition_commands/partition.rs b/src/commands/partition_commands/partition.rs index f0f468ad..408b73b0 100644 --- a/src/commands/partition_commands/partition.rs +++ b/src/commands/partition_commands/partition.rs @@ -9,7 +9,7 @@ single_item_command_request!(Partition, "partition", PartitionName); empty_command_response!(Partition); -impl Command<'_, '_> for Partition { +impl Command for Partition { type Request = PartitionRequest; type Response = PartitionResponse; } diff --git a/src/commands/playback_options/consume.rs b/src/commands/playback_options/consume.rs index 1df02062..5c95ccd9 100644 --- a/src/commands/playback_options/consume.rs +++ b/src/commands/playback_options/consume.rs @@ -9,7 +9,7 @@ single_item_command_request!(Consume, "consume", BoolOrOneshot); empty_command_response!(Consume); -impl Command<'_, '_> for Consume { +impl Command for Consume { type Request = ConsumeRequest; type Response = ConsumeResponse; } diff --git a/src/commands/playback_options/crossfade.rs b/src/commands/playback_options/crossfade.rs index 85625930..15f67541 100644 --- a/src/commands/playback_options/crossfade.rs +++ b/src/commands/playback_options/crossfade.rs @@ -9,7 +9,7 @@ single_item_command_request!(Crossfade, "crossfade", Seconds); empty_command_response!(Crossfade); -impl Command<'_, '_> for Crossfade { +impl Command for Crossfade { type Request = CrossfadeRequest; type Response = CrossfadeResponse; } diff --git a/src/commands/playback_options/getvol.rs b/src/commands/playback_options/getvol.rs index fcc8740e..134fa642 100644 --- a/src/commands/playback_options/getvol.rs +++ b/src/commands/playback_options/getvol.rs @@ -9,7 +9,7 @@ empty_command_request!(GetVol, "getvol"); single_item_command_response!(GetVol, "volume", VolumeValue); -impl Command<'_, '_> for GetVol { +impl Command for GetVol { type Request = GetVolRequest; type Response = GetVolResponse; } diff --git a/src/commands/playback_options/mixrampdb.rs b/src/commands/playback_options/mixrampdb.rs index 34842969..0a06c40d 100644 --- a/src/commands/playback_options/mixrampdb.rs +++ b/src/commands/playback_options/mixrampdb.rs @@ -6,7 +6,7 @@ single_item_command_request!(MixRampDb, "mixrampdb", f32); empty_command_response!(MixRampDb); -impl Command<'_, '_> for MixRampDb { +impl Command for MixRampDb { type Request = MixRampDbRequest; type Response = MixRampDbResponse; } diff --git a/src/commands/playback_options/mixrampdelay.rs b/src/commands/playback_options/mixrampdelay.rs index b73d6577..95f77786 100644 --- a/src/commands/playback_options/mixrampdelay.rs +++ b/src/commands/playback_options/mixrampdelay.rs @@ -8,7 +8,7 @@ pub struct MixRampDelay; single_item_command_request!(MixRampDelay, "mixrampdelay", Seconds); empty_command_response!(MixRampDelay); -impl Command<'_, '_> for MixRampDelay { +impl Command for MixRampDelay { type Request = MixRampDelayRequest; type Response = MixRampDelayResponse; } diff --git a/src/commands/playback_options/random.rs b/src/commands/playback_options/random.rs index c1e554f2..77bee431 100644 --- a/src/commands/playback_options/random.rs +++ b/src/commands/playback_options/random.rs @@ -7,7 +7,7 @@ pub struct Random; pub struct RandomRequest(bool); -impl CommandRequest<'_> for RandomRequest { +impl CommandRequest for RandomRequest { const COMMAND: &'static str = "random"; fn into_request_enum(self) -> crate::Request { @@ -42,7 +42,7 @@ impl CommandRequest<'_> for RandomRequest { empty_command_response!(Random); -impl Command<'_, '_> for Random { +impl Command for Random { type Request = RandomRequest; type Response = RandomResponse; } diff --git a/src/commands/playback_options/repeat.rs b/src/commands/playback_options/repeat.rs index 68a4c595..2e3ad3dc 100644 --- a/src/commands/playback_options/repeat.rs +++ b/src/commands/playback_options/repeat.rs @@ -7,7 +7,7 @@ pub struct Repeat; pub struct RepeatRequest(bool); -impl CommandRequest<'_> for RepeatRequest { +impl CommandRequest for RepeatRequest { const COMMAND: &'static str = "repeat"; fn into_request_enum(self) -> crate::Request { @@ -42,7 +42,7 @@ impl CommandRequest<'_> for RepeatRequest { empty_command_response!(Repeat); -impl Command<'_, '_> for Repeat { +impl Command for Repeat { type Request = RepeatRequest; type Response = RepeatResponse; } diff --git a/src/commands/playback_options/replay_gain_mode.rs b/src/commands/playback_options/replay_gain_mode.rs index caa2ce7d..fdf0fc6b 100644 --- a/src/commands/playback_options/replay_gain_mode.rs +++ b/src/commands/playback_options/replay_gain_mode.rs @@ -9,7 +9,7 @@ single_item_command_request!(ReplayGainMode, "replay_gain_mode", ReplayGainModeM empty_command_response!(ReplayGainMode); -impl Command<'_, '_> for ReplayGainMode { +impl Command for ReplayGainMode { type Request = ReplayGainModeRequest; type Response = ReplayGainModeResponse; } diff --git a/src/commands/playback_options/replay_gain_status.rs b/src/commands/playback_options/replay_gain_status.rs index c5adbee9..01b987ae 100644 --- a/src/commands/playback_options/replay_gain_status.rs +++ b/src/commands/playback_options/replay_gain_status.rs @@ -17,7 +17,7 @@ pub struct ReplayGainStatusResponse { pub replay_gain_mode: ReplayGainModeMode, } -impl CommandResponse<'_> for ReplayGainStatusResponse { +impl CommandResponse for ReplayGainStatusResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -41,7 +41,7 @@ impl CommandResponse<'_> for ReplayGainStatusResponse { } } -impl Command<'_, '_> for ReplayGainStatus { +impl Command for ReplayGainStatus { type Request = ReplayGainStatusRequest; type Response = ReplayGainStatusResponse; } diff --git a/src/commands/playback_options/setvol.rs b/src/commands/playback_options/setvol.rs index d4dbbd59..59daaa4f 100644 --- a/src/commands/playback_options/setvol.rs +++ b/src/commands/playback_options/setvol.rs @@ -9,7 +9,7 @@ single_item_command_request!(SetVol, "setvol", VolumeValue); empty_command_response!(SetVol); -impl Command<'_, '_> for SetVol { +impl Command for SetVol { type Request = SetVolRequest; type Response = SetVolResponse; } diff --git a/src/commands/playback_options/single.rs b/src/commands/playback_options/single.rs index 240995aa..d1b44281 100644 --- a/src/commands/playback_options/single.rs +++ b/src/commands/playback_options/single.rs @@ -9,7 +9,7 @@ single_item_command_request!(Single, "single", BoolOrOneshot); empty_command_response!(Single); -impl Command<'_, '_> for Single { +impl Command for Single { type Request = SingleRequest; type Response = SingleResponse; } diff --git a/src/commands/playback_options/volume.rs b/src/commands/playback_options/volume.rs index 41ade4bb..51a1c4c4 100644 --- a/src/commands/playback_options/volume.rs +++ b/src/commands/playback_options/volume.rs @@ -9,7 +9,7 @@ single_item_command_request!(Volume, "volume", VolumeValue); empty_command_response!(Volume); -impl Command<'_, '_> for Volume { +impl Command for Volume { type Request = VolumeRequest; type Response = VolumeResponse; } diff --git a/src/commands/querying_mpd_status/clearerror.rs b/src/commands/querying_mpd_status/clearerror.rs index c59c8dba..21b8c3d3 100644 --- a/src/commands/querying_mpd_status/clearerror.rs +++ b/src/commands/querying_mpd_status/clearerror.rs @@ -7,7 +7,7 @@ empty_command_request!(ClearError, "clearerror"); empty_command_response!(ClearError); -impl Command<'_, '_> for ClearError { +impl Command for ClearError { type Request = ClearErrorRequest; type Response = ClearErrorResponse; } diff --git a/src/commands/querying_mpd_status/currentsong.rs b/src/commands/querying_mpd_status/currentsong.rs index 00e98d55..3cdf1084 100644 --- a/src/commands/querying_mpd_status/currentsong.rs +++ b/src/commands/querying_mpd_status/currentsong.rs @@ -23,7 +23,7 @@ pub struct CurrentSongResponse { song_info: DbSongInfo, } -impl CommandResponse<'_> for CurrentSongResponse { +impl CommandResponse for CurrentSongResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -54,7 +54,7 @@ impl CommandResponse<'_> for CurrentSongResponse { } } -impl Command<'_, '_> for CurrentSong { +impl Command for CurrentSong { type Request = CurrentSongRequest; type Response = CurrentSongResponse; } diff --git a/src/commands/querying_mpd_status/idle.rs b/src/commands/querying_mpd_status/idle.rs index 96546660..372ca983 100644 --- a/src/commands/querying_mpd_status/idle.rs +++ b/src/commands/querying_mpd_status/idle.rs @@ -10,7 +10,7 @@ pub struct Idle; pub struct IdleRequest(Option>); -impl CommandRequest<'_> for IdleRequest { +impl CommandRequest for IdleRequest { const COMMAND: &'static str = "idle"; fn into_request_enum(self) -> crate::Request { @@ -56,7 +56,7 @@ impl CommandRequest<'_> for IdleRequest { empty_command_response!(Idle); -impl Command<'_, '_> for Idle { +impl Command for Idle { type Request = IdleRequest; type Response = IdleResponse; } diff --git a/src/commands/querying_mpd_status/stats.rs b/src/commands/querying_mpd_status/stats.rs index 1dee3d7f..206fbd3a 100644 --- a/src/commands/querying_mpd_status/stats.rs +++ b/src/commands/querying_mpd_status/stats.rs @@ -24,7 +24,7 @@ pub struct StatsResponse { pub db_update: Option, } -impl CommandResponse<'_> for StatsResponse { +impl CommandResponse for StatsResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -56,7 +56,7 @@ impl CommandResponse<'_> for StatsResponse { } } -impl Command<'_, '_> for Stats { +impl Command for Stats { type Request = StatsRequest; type Response = StatsResponse; } diff --git a/src/commands/querying_mpd_status/status.rs b/src/commands/querying_mpd_status/status.rs index f94333f1..993c350b 100644 --- a/src/commands/querying_mpd_status/status.rs +++ b/src/commands/querying_mpd_status/status.rs @@ -65,7 +65,7 @@ pub struct StatusResponse { pub last_loaded_playlist: Option, } -impl CommandResponse<'_> for StatusResponse { +impl CommandResponse for StatusResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -178,7 +178,7 @@ impl CommandResponse<'_> for StatusResponse { } } -impl Command<'_, '_> for Status { +impl Command for Status { type Request = StatusRequest; type Response = StatusResponse; } diff --git a/src/commands/queue/add.rs b/src/commands/queue/add.rs index 9b7e588b..85733c93 100644 --- a/src/commands/queue/add.rs +++ b/src/commands/queue/add.rs @@ -14,7 +14,7 @@ pub struct AddRequest { position: Option, } -impl CommandRequest<'_> for AddRequest { +impl CommandRequest for AddRequest { const COMMAND: &'static str = "add"; fn into_request_enum(self) -> crate::Request { @@ -60,7 +60,7 @@ impl CommandRequest<'_> for AddRequest { empty_command_response!(Add); -impl Command<'_, '_> for Add { +impl Command for Add { type Request = AddRequest; type Response = AddResponse; } diff --git a/src/commands/queue/addid.rs b/src/commands/queue/addid.rs index 9be6e035..7a0668db 100644 --- a/src/commands/queue/addid.rs +++ b/src/commands/queue/addid.rs @@ -15,7 +15,7 @@ pub struct AddIdRequest { pub position: Option, } -impl CommandRequest<'_> for AddIdRequest { +impl CommandRequest for AddIdRequest { const COMMAND: &'static str = "addid"; fn into_request_enum(self) -> crate::Request { @@ -64,7 +64,7 @@ pub struct AddIdResponse { pub id: SongId, } -impl CommandResponse<'_> for AddIdResponse { +impl CommandResponse for AddIdResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -84,7 +84,7 @@ impl CommandResponse<'_> for AddIdResponse { } } -impl Command<'_, '_> for AddId { +impl Command for AddId { type Request = AddIdRequest; type Response = AddIdResponse; } diff --git a/src/commands/queue/addtagid.rs b/src/commands/queue/addtagid.rs index a09c4327..32d88688 100644 --- a/src/commands/queue/addtagid.rs +++ b/src/commands/queue/addtagid.rs @@ -15,7 +15,7 @@ pub struct AddTagIdRequest { pub tag_value: TagValue, } -impl CommandRequest<'_> for AddTagIdRequest { +impl CommandRequest for AddTagIdRequest { const COMMAND: &'static str = "addtagid"; fn into_request_enum(self) -> crate::Request { @@ -71,7 +71,7 @@ impl CommandRequest<'_> for AddTagIdRequest { empty_command_response!(AddTagId); -impl Command<'_, '_> for AddTagId { +impl Command for AddTagId { type Request = AddTagIdRequest; type Response = AddTagIdResponse; } diff --git a/src/commands/queue/clear.rs b/src/commands/queue/clear.rs index 2e289005..aad90b5f 100644 --- a/src/commands/queue/clear.rs +++ b/src/commands/queue/clear.rs @@ -6,7 +6,7 @@ empty_command_request!(Clear, "clear"); empty_command_response!(Clear); -impl Command<'_, '_> for Clear { +impl Command for Clear { type Request = ClearRequest; type Response = ClearResponse; } diff --git a/src/commands/queue/cleartagid.rs b/src/commands/queue/cleartagid.rs index 10309f16..30ac1731 100644 --- a/src/commands/queue/cleartagid.rs +++ b/src/commands/queue/cleartagid.rs @@ -14,7 +14,7 @@ pub struct ClearTagIdRequest { pub tag_name: TagName, } -impl CommandRequest<'_> for ClearTagIdRequest { +impl CommandRequest for ClearTagIdRequest { const COMMAND: &'static str = "cleartagid"; fn into_request_enum(self) -> crate::Request { @@ -53,7 +53,7 @@ impl CommandRequest<'_> for ClearTagIdRequest { empty_command_response!(ClearTagId); -impl Command<'_, '_> for ClearTagId { +impl Command for ClearTagId { type Request = ClearTagIdRequest; type Response = ClearTagIdResponse; } diff --git a/src/commands/queue/delete.rs b/src/commands/queue/delete.rs index 2bb8b430..b304573c 100644 --- a/src/commands/queue/delete.rs +++ b/src/commands/queue/delete.rs @@ -9,7 +9,7 @@ single_item_command_request!(Delete, "delete", OneOrRange); empty_command_response!(Delete); -impl Command<'_, '_> for Delete { +impl Command for Delete { type Request = DeleteRequest; type Response = DeleteResponse; } diff --git a/src/commands/queue/deleteid.rs b/src/commands/queue/deleteid.rs index 220f1153..e13be58c 100644 --- a/src/commands/queue/deleteid.rs +++ b/src/commands/queue/deleteid.rs @@ -9,7 +9,7 @@ single_item_command_request!(DeleteId, "deleteid", SongId); empty_command_response!(DeleteId); -impl Command<'_, '_> for DeleteId { +impl Command for DeleteId { type Request = DeleteIdRequest; type Response = DeleteIdResponse; } diff --git a/src/commands/queue/move_.rs b/src/commands/queue/move_.rs index d1e0a246..62e595f8 100644 --- a/src/commands/queue/move_.rs +++ b/src/commands/queue/move_.rs @@ -14,7 +14,7 @@ pub struct MoveRequest { pub to: AbsouluteRelativeSongPosition, } -impl CommandRequest<'_> for MoveRequest { +impl CommandRequest for MoveRequest { const COMMAND: &'static str = "move"; fn into_request_enum(self) -> crate::Request { @@ -51,7 +51,7 @@ impl CommandRequest<'_> for MoveRequest { empty_command_response!(Move); -impl Command<'_, '_> for Move { +impl Command for Move { type Request = MoveRequest; type Response = MoveResponse; } diff --git a/src/commands/queue/moveid.rs b/src/commands/queue/moveid.rs index c1e4051f..9148fbc8 100644 --- a/src/commands/queue/moveid.rs +++ b/src/commands/queue/moveid.rs @@ -14,7 +14,7 @@ pub struct MoveIdRequest { pub to: AbsouluteRelativeSongPosition, } -impl CommandRequest<'_> for MoveIdRequest { +impl CommandRequest for MoveIdRequest { const COMMAND: &'static str = "moveid"; fn into_request_enum(self) -> crate::Request { @@ -51,7 +51,7 @@ impl CommandRequest<'_> for MoveIdRequest { empty_command_response!(MoveId); -impl Command<'_, '_> for MoveId { +impl Command for MoveId { type Request = MoveIdRequest; type Response = MoveIdResponse; } diff --git a/src/commands/queue/playlist.rs b/src/commands/queue/playlist.rs index f4d60366..4ecf76ec 100644 --- a/src/commands/queue/playlist.rs +++ b/src/commands/queue/playlist.rs @@ -13,7 +13,7 @@ empty_command_request!(Playlist, "playlist"); #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct PlaylistResponse(Vec); -impl CommandResponse<'_> for PlaylistResponse { +impl CommandResponse for PlaylistResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -27,7 +27,7 @@ impl CommandResponse<'_> for PlaylistResponse { } } -impl Command<'_, '_> for Playlist { +impl Command for Playlist { type Request = PlaylistRequest; type Response = PlaylistResponse; } diff --git a/src/commands/queue/playlistfind.rs b/src/commands/queue/playlistfind.rs index f9619983..9a14d6e9 100644 --- a/src/commands/queue/playlistfind.rs +++ b/src/commands/queue/playlistfind.rs @@ -18,7 +18,7 @@ pub struct PlaylistFindRequest { window: Option, } -impl CommandRequest<'_> for PlaylistFindRequest { +impl CommandRequest for PlaylistFindRequest { const COMMAND: &'static str = "playlistfind"; fn into_request_enum(self) -> crate::Request { @@ -44,7 +44,7 @@ impl CommandRequest<'_> for PlaylistFindRequest { if let Some(window) = &self.window { cmd.push_str(&format!(" window {}", window)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -97,7 +97,7 @@ pub struct PlaylistFindResponseEntry { pub song_info: DbSongInfo, } -impl CommandResponse<'_> for PlaylistFindResponse { +impl CommandResponse for PlaylistFindResponse { fn into_response_enum(self) -> Response { todo!() } @@ -111,7 +111,7 @@ impl CommandResponse<'_> for PlaylistFindResponse { } } -impl Command<'_, '_> for PlaylistFind { +impl Command for PlaylistFind { type Request = PlaylistFindRequest; type Response = PlaylistFindResponse; } diff --git a/src/commands/queue/playlistid.rs b/src/commands/queue/playlistid.rs index aedff987..30bba463 100644 --- a/src/commands/queue/playlistid.rs +++ b/src/commands/queue/playlistid.rs @@ -21,7 +21,7 @@ pub struct PlaylistIdResponseEntry { pub song_info: DbSongInfo, } -impl CommandResponse<'_> for PlaylistIdResponse { +impl CommandResponse for PlaylistIdResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -35,7 +35,7 @@ impl CommandResponse<'_> for PlaylistIdResponse { } } -impl Command<'_, '_> for PlaylistId { +impl Command for PlaylistId { type Request = PlaylistIdRequest; type Response = PlaylistIdResponse; } diff --git a/src/commands/queue/playlistinfo.rs b/src/commands/queue/playlistinfo.rs index 5ef699ce..812a6ad5 100644 --- a/src/commands/queue/playlistinfo.rs +++ b/src/commands/queue/playlistinfo.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{ - Command, CommandResponse, RequestParserError, ResponseParserError, + Command, CommandResponse, ResponseParserError, single_optional_item_command_request, }, response_tokenizer::ResponseAttributes, @@ -24,7 +24,7 @@ pub struct PlaylistInfoResponseEntry { pub song_info: DbSongInfo, } -impl CommandResponse<'_> for PlaylistInfoResponse { +impl CommandResponse for PlaylistInfoResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -38,7 +38,7 @@ impl CommandResponse<'_> for PlaylistInfoResponse { } } -impl Command<'_, '_> for PlaylistInfo { +impl Command for PlaylistInfo { type Request = PlaylistInfoRequest; type Response = PlaylistInfoResponse; } diff --git a/src/commands/queue/playlistsearch.rs b/src/commands/queue/playlistsearch.rs index 1e283ce8..5b8d8504 100644 --- a/src/commands/queue/playlistsearch.rs +++ b/src/commands/queue/playlistsearch.rs @@ -17,7 +17,7 @@ pub struct PlaylistSearchRequest { window: Option, } -impl CommandRequest<'_> for PlaylistSearchRequest { +impl CommandRequest for PlaylistSearchRequest { const COMMAND: &'static str = "playlistsearch"; fn into_request_enum(self) -> crate::Request { @@ -43,7 +43,7 @@ impl CommandRequest<'_> for PlaylistSearchRequest { if let Some(window) = &self.window { cmd.push_str(&format!(" window {}", window)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -96,7 +96,7 @@ pub struct PlaylistSearchResponseEntry { pub song_info: DbSongInfo, } -impl CommandResponse<'_> for PlaylistSearchResponse { +impl CommandResponse for PlaylistSearchResponse { fn from_response_enum(response: crate::Response) -> Option { todo!() } @@ -110,7 +110,7 @@ impl CommandResponse<'_> for PlaylistSearchResponse { } } -impl Command<'_, '_> for PlaylistSearch { +impl Command for PlaylistSearch { type Request = PlaylistSearchRequest; type Response = PlaylistSearchResponse; } diff --git a/src/commands/queue/plchanges.rs b/src/commands/queue/plchanges.rs index 3f7fff51..0bb74fdf 100644 --- a/src/commands/queue/plchanges.rs +++ b/src/commands/queue/plchanges.rs @@ -15,7 +15,7 @@ pub struct PlChangesRequest { pub window: Option, } -impl CommandRequest<'_> for PlChangesRequest { +impl CommandRequest for PlChangesRequest { const COMMAND: &'static str = "plchanges"; fn into_request_enum(self) -> crate::Request { @@ -69,7 +69,7 @@ pub struct PlChangesResponseEntry { pub song_info: DbSongInfo, } -impl CommandResponse<'_> for PlChangesResponse { +impl CommandResponse for PlChangesResponse { fn from_response_enum(response: crate::Response) -> Option { todo!() } @@ -83,7 +83,7 @@ impl CommandResponse<'_> for PlChangesResponse { } } -impl Command<'_, '_> for PlChanges { +impl Command for PlChanges { type Request = PlChangesRequest; type Response = PlChangesResponse; } diff --git a/src/commands/queue/plchangesposid.rs b/src/commands/queue/plchangesposid.rs index 0fb1854a..12a1daad 100644 --- a/src/commands/queue/plchangesposid.rs +++ b/src/commands/queue/plchangesposid.rs @@ -15,7 +15,7 @@ pub struct PlChangesPosIdRequest { pub window: Option, } -impl CommandRequest<'_> for PlChangesPosIdRequest { +impl CommandRequest for PlChangesPosIdRequest { const COMMAND: &'static str = "plchangesposid"; fn into_request_enum(self) -> crate::Request { @@ -68,7 +68,7 @@ pub struct PlChangesPosIdResponseEntry { pub id: SongId, } -impl CommandResponse<'_> for PlChangesPosIdResponse { +impl CommandResponse for PlChangesPosIdResponse { fn from_response_enum(response: crate::Response) -> Option { todo!() } @@ -82,7 +82,7 @@ impl CommandResponse<'_> for PlChangesPosIdResponse { } } -impl Command<'_, '_> for PlChangesPosId { +impl Command for PlChangesPosId { type Request = PlChangesPosIdRequest; type Response = PlChangesPosIdResponse; } diff --git a/src/commands/queue/prio.rs b/src/commands/queue/prio.rs index 9fe18bff..b46bb580 100644 --- a/src/commands/queue/prio.rs +++ b/src/commands/queue/prio.rs @@ -14,7 +14,7 @@ pub struct PrioRequest { pub window: WindowRange, } -impl CommandRequest<'_> for PrioRequest { +impl CommandRequest for PrioRequest { const COMMAND: &'static str = "prio"; fn into_request_enum(self) -> crate::Request { @@ -51,7 +51,7 @@ impl CommandRequest<'_> for PrioRequest { empty_command_response!(Prio); -impl Command<'_, '_> for Prio { +impl Command for Prio { type Request = PrioRequest; type Response = PrioResponse; } diff --git a/src/commands/queue/prioid.rs b/src/commands/queue/prioid.rs index 7d80712e..2312eba2 100644 --- a/src/commands/queue/prioid.rs +++ b/src/commands/queue/prioid.rs @@ -14,7 +14,7 @@ pub struct PrioIdRequest { pub songids: Vec, } -impl CommandRequest<'_> for PrioIdRequest { +impl CommandRequest for PrioIdRequest { const COMMAND: &'static str = "prioid"; fn into_request_enum(self) -> crate::Request { @@ -61,7 +61,7 @@ impl CommandRequest<'_> for PrioIdRequest { empty_command_response!(PrioId); -impl Command<'_, '_> for PrioId { +impl Command for PrioId { type Request = PrioIdRequest; type Response = PrioIdResponse; } diff --git a/src/commands/queue/rangeid.rs b/src/commands/queue/rangeid.rs index 4e5f5642..df1ccd2b 100644 --- a/src/commands/queue/rangeid.rs +++ b/src/commands/queue/rangeid.rs @@ -14,7 +14,7 @@ pub struct RangeIdRequest { time_interval: TimeInterval, } -impl CommandRequest<'_> for RangeIdRequest { +impl CommandRequest for RangeIdRequest { const COMMAND: &'static str = "rangeid"; fn into_request_enum(self) -> crate::Request { @@ -57,7 +57,7 @@ impl CommandRequest<'_> for RangeIdRequest { empty_command_response!(RangeId); -impl Command<'_, '_> for RangeId { +impl Command for RangeId { type Request = RangeIdRequest; type Response = RangeIdResponse; } diff --git a/src/commands/queue/shuffle.rs b/src/commands/queue/shuffle.rs index b9818ec7..d2822fae 100644 --- a/src/commands/queue/shuffle.rs +++ b/src/commands/queue/shuffle.rs @@ -1,6 +1,6 @@ use crate::{ commands::{ - Command, RequestParserError, empty_command_response, single_optional_item_command_request, + Command, empty_command_response, single_optional_item_command_request, }, types::OneOrRange, }; @@ -11,7 +11,7 @@ single_optional_item_command_request!(Shuffle, "shuffle", OneOrRange); empty_command_response!(Shuffle); -impl Command<'_, '_> for Shuffle { +impl Command for Shuffle { type Request = ShuffleRequest; type Response = ShuffleResponse; } diff --git a/src/commands/queue/swap.rs b/src/commands/queue/swap.rs index dd28c431..26d4719a 100644 --- a/src/commands/queue/swap.rs +++ b/src/commands/queue/swap.rs @@ -14,7 +14,7 @@ pub struct SwapRequest { pub songpos2: SongPosition, } -impl CommandRequest<'_> for SwapRequest { +impl CommandRequest for SwapRequest { const COMMAND: &'static str = "swap"; fn into_request_enum(self) -> crate::Request { @@ -51,7 +51,7 @@ impl CommandRequest<'_> for SwapRequest { empty_command_response!(Swap); -impl Command<'_, '_> for Swap { +impl Command for Swap { type Request = SwapRequest; type Response = SwapResponse; } diff --git a/src/commands/queue/swapid.rs b/src/commands/queue/swapid.rs index 0f4813f1..618cf2ac 100644 --- a/src/commands/queue/swapid.rs +++ b/src/commands/queue/swapid.rs @@ -14,7 +14,7 @@ pub struct SwapIdRequest { pub songid2: SongId, } -impl CommandRequest<'_> for SwapIdRequest { +impl CommandRequest for SwapIdRequest { const COMMAND: &'static str = "swapid"; fn into_request_enum(self) -> crate::Request { @@ -51,7 +51,7 @@ impl CommandRequest<'_> for SwapIdRequest { empty_command_response!(SwapId); -impl Command<'_, '_> for SwapId { +impl Command for SwapId { type Request = SwapIdRequest; type Response = SwapIdResponse; } diff --git a/src/commands/reflection/commands.rs b/src/commands/reflection/commands.rs index e2c0b74f..ba6360dd 100644 --- a/src/commands/reflection/commands.rs +++ b/src/commands/reflection/commands.rs @@ -9,7 +9,7 @@ empty_command_request!(Commands, "commands"); multi_item_command_response!(Commands, "command", String); -impl Command<'_, '_> for Commands { +impl Command for Commands { type Request = CommandsRequest; type Response = CommandsResponse; } diff --git a/src/commands/reflection/config.rs b/src/commands/reflection/config.rs index 1d8473ea..3788a6ed 100644 --- a/src/commands/reflection/config.rs +++ b/src/commands/reflection/config.rs @@ -18,7 +18,7 @@ pub struct ConfigResponse { pub pcre: bool, } -impl CommandResponse<'_> for ConfigResponse { +impl CommandResponse for ConfigResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -44,7 +44,7 @@ impl CommandResponse<'_> for ConfigResponse { } } -impl Command<'_, '_> for Config { +impl Command for Config { type Request = ConfigRequest; type Response = ConfigResponse; } diff --git a/src/commands/reflection/decoders.rs b/src/commands/reflection/decoders.rs index f0158376..7966774e 100644 --- a/src/commands/reflection/decoders.rs +++ b/src/commands/reflection/decoders.rs @@ -19,7 +19,7 @@ pub struct Decoder { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct DecodersResponse(Vec); -impl CommandResponse<'_> for DecodersResponse { +impl CommandResponse for DecodersResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -74,7 +74,7 @@ impl CommandResponse<'_> for DecodersResponse { } } -impl Command<'_, '_> for Decoders { +impl Command for Decoders { type Request = DecodersRequest; type Response = DecodersResponse; } diff --git a/src/commands/reflection/not_commands.rs b/src/commands/reflection/not_commands.rs index 6458c7e3..84fead65 100644 --- a/src/commands/reflection/not_commands.rs +++ b/src/commands/reflection/not_commands.rs @@ -9,7 +9,7 @@ empty_command_request!(NotCommands, "notcommands"); multi_item_command_response!(NotCommands, "command", String); -impl Command<'_, '_> for NotCommands { +impl Command for NotCommands { type Request = NotCommandsRequest; type Response = NotCommandsResponse; } diff --git a/src/commands/reflection/url_handlers.rs b/src/commands/reflection/url_handlers.rs index 261a3d05..edf95075 100644 --- a/src/commands/reflection/url_handlers.rs +++ b/src/commands/reflection/url_handlers.rs @@ -9,7 +9,7 @@ empty_command_request!(UrlHandlers, "urlhandlers"); multi_item_command_response!(UrlHandlers, "handler", String); -impl Command<'_, '_> for UrlHandlers { +impl Command for UrlHandlers { type Request = UrlHandlersRequest; type Response = UrlHandlersResponse; } diff --git a/src/commands/stickers/sticker_dec.rs b/src/commands/stickers/sticker_dec.rs index 53fee14f..5592ff1b 100644 --- a/src/commands/stickers/sticker_dec.rs +++ b/src/commands/stickers/sticker_dec.rs @@ -16,7 +16,7 @@ pub struct StickerDecRequest { pub value: usize, } -impl CommandRequest<'_> for StickerDecRequest { +impl CommandRequest for StickerDecRequest { const COMMAND: &'static str = "sticker dec"; fn into_request_enum(self) -> crate::Request { @@ -80,7 +80,7 @@ impl CommandRequest<'_> for StickerDecRequest { empty_command_response!(StickerDec); -impl Command<'_, '_> for StickerDec { +impl Command for StickerDec { type Request = StickerDecRequest; type Response = StickerDecResponse; } diff --git a/src/commands/stickers/sticker_delete.rs b/src/commands/stickers/sticker_delete.rs index eb9c8eed..3b5f0b2c 100644 --- a/src/commands/stickers/sticker_delete.rs +++ b/src/commands/stickers/sticker_delete.rs @@ -15,7 +15,7 @@ pub struct StickerDeleteRequest { pub name: String, } -impl CommandRequest<'_> for StickerDeleteRequest { +impl CommandRequest for StickerDeleteRequest { const COMMAND: &'static str = "sticker delete"; fn into_request_enum(self) -> crate::Request { @@ -71,7 +71,7 @@ impl CommandRequest<'_> for StickerDeleteRequest { empty_command_response!(StickerDelete); -impl Command<'_, '_> for StickerDelete { +impl Command for StickerDelete { type Request = StickerDeleteRequest; type Response = StickerDeleteResponse; } diff --git a/src/commands/stickers/sticker_find.rs b/src/commands/stickers/sticker_find.rs index 417563e4..38bcc1aa 100644 --- a/src/commands/stickers/sticker_find.rs +++ b/src/commands/stickers/sticker_find.rs @@ -18,7 +18,7 @@ pub struct StickerFindRequest { pub window: Option, } -impl CommandRequest<'_> for StickerFindRequest { +impl CommandRequest for StickerFindRequest { const COMMAND: &'static str = "sticker find"; fn into_request_enum(self) -> crate::Request { @@ -60,7 +60,7 @@ impl CommandRequest<'_> for StickerFindRequest { if let Some(window) = &self.window { cmd.push_str(&format!(" window {}", window)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -122,7 +122,7 @@ pub struct StickerFindResponseEntry { pub value: String, } -impl CommandResponse<'_> for StickerFindResponse { +impl CommandResponse for StickerFindResponse { fn from_response_enum(response: crate::Response) -> Option { todo!() } @@ -174,7 +174,7 @@ impl CommandResponse<'_> for StickerFindResponse { } } -impl Command<'_, '_> for StickerFind { +impl Command for StickerFind { type Request = StickerFindRequest; type Response = StickerFindResponse; } diff --git a/src/commands/stickers/sticker_get.rs b/src/commands/stickers/sticker_get.rs index 92388238..1af3bd51 100644 --- a/src/commands/stickers/sticker_get.rs +++ b/src/commands/stickers/sticker_get.rs @@ -15,7 +15,7 @@ pub struct StickerGetRequest { pub name: String, } -impl CommandRequest<'_> for StickerGetRequest { +impl CommandRequest for StickerGetRequest { const COMMAND: &'static str = "sticker get"; fn into_request_enum(self) -> crate::Request { @@ -71,7 +71,7 @@ impl CommandRequest<'_> for StickerGetRequest { single_item_command_response!(StickerGet, "string", String); -impl Command<'_, '_> for StickerGet { +impl Command for StickerGet { type Request = StickerGetRequest; type Response = StickerGetResponse; } diff --git a/src/commands/stickers/sticker_inc.rs b/src/commands/stickers/sticker_inc.rs index 4596c5b6..c0299619 100644 --- a/src/commands/stickers/sticker_inc.rs +++ b/src/commands/stickers/sticker_inc.rs @@ -16,7 +16,7 @@ pub struct StickerIncRequest { pub value: usize, } -impl CommandRequest<'_> for StickerIncRequest { +impl CommandRequest for StickerIncRequest { const COMMAND: &'static str = "sticker inc"; fn into_request_enum(self) -> crate::Request { @@ -80,7 +80,7 @@ impl CommandRequest<'_> for StickerIncRequest { empty_command_response!(StickerInc); -impl Command<'_, '_> for StickerInc { +impl Command for StickerInc { type Request = StickerIncRequest; type Response = StickerIncResponse; } diff --git a/src/commands/stickers/sticker_list.rs b/src/commands/stickers/sticker_list.rs index c6b34c85..c0452122 100644 --- a/src/commands/stickers/sticker_list.rs +++ b/src/commands/stickers/sticker_list.rs @@ -17,7 +17,7 @@ pub struct StickerListRequest { pub uri: Uri, } -impl CommandRequest<'_> for StickerListRequest { +impl CommandRequest for StickerListRequest { const COMMAND: &'static str = "sticker list"; fn into_request_enum(self) -> crate::Request { @@ -57,7 +57,7 @@ impl CommandRequest<'_> for StickerListRequest { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct StickerListResponse(HashMap); -impl CommandResponse<'_> for StickerListResponse { +impl CommandResponse for StickerListResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -104,7 +104,7 @@ impl CommandResponse<'_> for StickerListResponse { } } -impl Command<'_, '_> for StickerList { +impl Command for StickerList { type Request = StickerListRequest; type Response = StickerListResponse; } diff --git a/src/commands/stickers/sticker_set.rs b/src/commands/stickers/sticker_set.rs index ac06fe3a..ed221c09 100644 --- a/src/commands/stickers/sticker_set.rs +++ b/src/commands/stickers/sticker_set.rs @@ -16,7 +16,7 @@ pub struct StickerSetRequest { pub value: String, } -impl CommandRequest<'_> for StickerSetRequest { +impl CommandRequest for StickerSetRequest { const COMMAND: &'static str = "sticker set"; fn into_request_enum(self) -> crate::Request { @@ -77,7 +77,7 @@ impl CommandRequest<'_> for StickerSetRequest { empty_command_response!(StickerSet); -impl Command<'_, '_> for StickerSet { +impl Command for StickerSet { type Request = StickerSetRequest; type Response = StickerSetResponse; } diff --git a/src/commands/stickers/stickernames.rs b/src/commands/stickers/stickernames.rs index 27aeb812..41ed9032 100644 --- a/src/commands/stickers/stickernames.rs +++ b/src/commands/stickers/stickernames.rs @@ -9,7 +9,7 @@ empty_command_request!(StickerNames, "stickernames"); multi_item_command_response!(StickerNames, "name", String); -impl Command<'_, '_> for StickerNames { +impl Command for StickerNames { type Request = StickerNamesRequest; type Response = StickerNamesResponse; } diff --git a/src/commands/stickers/stickernamestypes.rs b/src/commands/stickers/stickernamestypes.rs index 6097fcc2..b0bff5b2 100644 --- a/src/commands/stickers/stickernamestypes.rs +++ b/src/commands/stickers/stickernamestypes.rs @@ -14,7 +14,7 @@ pub struct StickerNamesTypes; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct StickerNamesTypesRequest(Option); -impl CommandRequest<'_> for StickerNamesTypesRequest { +impl CommandRequest for StickerNamesTypesRequest { const COMMAND: &'static str = "stickernamestypes"; fn into_request_enum(self) -> crate::Request { @@ -57,7 +57,7 @@ impl CommandRequest<'_> for StickerNamesTypesRequest { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct StickerNamesTypesResponse(HashMap>); -impl CommandResponse<'_> for StickerNamesTypesResponse { +impl CommandResponse for StickerNamesTypesResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -99,7 +99,7 @@ impl CommandResponse<'_> for StickerNamesTypesResponse { } } -impl Command<'_, '_> for StickerNamesTypes { +impl Command for StickerNamesTypes { type Request = StickerNamesTypesRequest; type Response = StickerNamesTypesResponse; } diff --git a/src/commands/stickers/stickertypes.rs b/src/commands/stickers/stickertypes.rs index 37c0f4cf..4a8202bf 100644 --- a/src/commands/stickers/stickertypes.rs +++ b/src/commands/stickers/stickertypes.rs @@ -9,7 +9,7 @@ empty_command_request!(StickerTypes, "stickertypes"); multi_item_command_response!(StickerTypes, "stickertype", String); -impl Command<'_, '_> for StickerTypes { +impl Command for StickerTypes { type Request = StickerTypesRequest; type Response = StickerTypesResponse; } diff --git a/src/commands/stored_playlists/listplaylist.rs b/src/commands/stored_playlists/listplaylist.rs index d75a61b4..07d1a468 100644 --- a/src/commands/stored_playlists/listplaylist.rs +++ b/src/commands/stored_playlists/listplaylist.rs @@ -20,7 +20,7 @@ pub struct ListPlaylistRequest { range: Option, } -impl CommandRequest<'_> for ListPlaylistRequest { +impl CommandRequest for ListPlaylistRequest { const COMMAND: &'static str = "listplaylist"; fn into_request_enum(self) -> crate::Request { @@ -65,7 +65,7 @@ impl CommandRequest<'_> for ListPlaylistRequest { // NOTE: this is actually supposed to be Vec multi_item_command_response!(ListPlaylist, "file", PathBuf); -impl Command<'_, '_> for ListPlaylist { +impl Command for ListPlaylist { type Request = ListPlaylistRequest; type Response = ListPlaylistResponse; } diff --git a/src/commands/stored_playlists/listplaylistinfo.rs b/src/commands/stored_playlists/listplaylistinfo.rs index 6fab7a6b..156c5491 100644 --- a/src/commands/stored_playlists/listplaylistinfo.rs +++ b/src/commands/stored_playlists/listplaylistinfo.rs @@ -15,7 +15,7 @@ pub struct ListPlaylistInfoRequest { range: Option, } -impl CommandRequest<'_> for ListPlaylistInfoRequest { +impl CommandRequest for ListPlaylistInfoRequest { const COMMAND: &'static str = "listplaylistinfo"; fn into_request_enum(self) -> crate::Request { @@ -61,7 +61,7 @@ impl CommandRequest<'_> for ListPlaylistInfoRequest { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ListPlaylistInfoResponse(Vec); -impl CommandResponse<'_> for ListPlaylistInfoResponse { +impl CommandResponse for ListPlaylistInfoResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -75,7 +75,7 @@ impl CommandResponse<'_> for ListPlaylistInfoResponse { } } -impl Command<'_, '_> for ListPlaylistInfo { +impl Command for ListPlaylistInfo { type Request = ListPlaylistInfoRequest; type Response = ListPlaylistInfoResponse; } diff --git a/src/commands/stored_playlists/listplaylists.rs b/src/commands/stored_playlists/listplaylists.rs index 3c25a89a..8fc2045b 100644 --- a/src/commands/stored_playlists/listplaylists.rs +++ b/src/commands/stored_playlists/listplaylists.rs @@ -20,7 +20,7 @@ pub struct ListPlaylistsResponseEntry { pub last_modified: Option, } -impl CommandResponse<'_> for ListPlaylistsResponse { +impl CommandResponse for ListPlaylistsResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -54,7 +54,7 @@ impl CommandResponse<'_> for ListPlaylistsResponse { } } -impl Command<'_, '_> for ListPlaylists { +impl Command for ListPlaylists { type Request = ListPlaylistsRequest; type Response = ListPlaylistsResponse; } diff --git a/src/commands/stored_playlists/load.rs b/src/commands/stored_playlists/load.rs index 067a3654..adf05966 100644 --- a/src/commands/stored_playlists/load.rs +++ b/src/commands/stored_playlists/load.rs @@ -15,7 +15,7 @@ pub struct LoadRequest { position: Option, } -impl CommandRequest<'_> for LoadRequest { +impl CommandRequest for LoadRequest { const COMMAND: &'static str = "load"; fn into_request_enum(self) -> crate::Request { @@ -85,7 +85,7 @@ impl CommandRequest<'_> for LoadRequest { empty_command_response!(Load); -impl Command<'_, '_> for Load { +impl Command for Load { type Request = LoadRequest; type Response = LoadResponse; } diff --git a/src/commands/stored_playlists/playlistadd.rs b/src/commands/stored_playlists/playlistadd.rs index ec8055c2..319786ec 100644 --- a/src/commands/stored_playlists/playlistadd.rs +++ b/src/commands/stored_playlists/playlistadd.rs @@ -15,7 +15,7 @@ pub struct PlaylistAddRequest { pub position: Option, } -impl CommandRequest<'_> for PlaylistAddRequest { +impl CommandRequest for PlaylistAddRequest { const COMMAND: &'static str = "playlistadd"; fn into_request_enum(self) -> crate::Request { @@ -81,7 +81,7 @@ impl CommandRequest<'_> for PlaylistAddRequest { empty_command_response!(PlaylistAdd); -impl Command<'_, '_> for PlaylistAdd { +impl Command for PlaylistAdd { type Request = PlaylistAddRequest; type Response = PlaylistAddResponse; } diff --git a/src/commands/stored_playlists/playlistclear.rs b/src/commands/stored_playlists/playlistclear.rs index 0992dfb3..3868e606 100644 --- a/src/commands/stored_playlists/playlistclear.rs +++ b/src/commands/stored_playlists/playlistclear.rs @@ -9,7 +9,7 @@ single_item_command_request!(PlaylistClear, "playlistclear", PlaylistName); empty_command_response!(PlaylistClear); -impl Command<'_, '_> for PlaylistClear { +impl Command for PlaylistClear { type Request = PlaylistClearRequest; type Response = PlaylistClearResponse; } diff --git a/src/commands/stored_playlists/playlistdelete.rs b/src/commands/stored_playlists/playlistdelete.rs index 2371d09c..015f675f 100644 --- a/src/commands/stored_playlists/playlistdelete.rs +++ b/src/commands/stored_playlists/playlistdelete.rs @@ -14,7 +14,7 @@ pub struct PlaylistDeleteRequest { pub position: OneOrRange, } -impl CommandRequest<'_> for PlaylistDeleteRequest { +impl CommandRequest for PlaylistDeleteRequest { const COMMAND: &'static str = "playlistdelete"; fn into_request_enum(self) -> crate::Request { @@ -65,7 +65,7 @@ impl CommandRequest<'_> for PlaylistDeleteRequest { empty_command_response!(PlaylistDelete); -impl Command<'_, '_> for PlaylistDelete { +impl Command for PlaylistDelete { type Request = PlaylistDeleteRequest; type Response = PlaylistDeleteResponse; } diff --git a/src/commands/stored_playlists/playlistlength.rs b/src/commands/stored_playlists/playlistlength.rs index bcb5d4ed..f31a09b8 100644 --- a/src/commands/stored_playlists/playlistlength.rs +++ b/src/commands/stored_playlists/playlistlength.rs @@ -18,7 +18,7 @@ pub struct PlaylistLengthResponse { pub playtime: u64, } -impl CommandResponse<'_> for PlaylistLengthResponse { +impl CommandResponse for PlaylistLengthResponse { fn into_response_enum(self) -> crate::Response { todo!() } @@ -37,7 +37,7 @@ impl CommandResponse<'_> for PlaylistLengthResponse { } } -impl Command<'_, '_> for PlaylistLength { +impl Command for PlaylistLength { type Request = PlaylistLengthRequest; type Response = PlaylistLengthResponse; } diff --git a/src/commands/stored_playlists/playlistmove.rs b/src/commands/stored_playlists/playlistmove.rs index 4a219743..df01ab16 100644 --- a/src/commands/stored_playlists/playlistmove.rs +++ b/src/commands/stored_playlists/playlistmove.rs @@ -15,7 +15,7 @@ pub struct PlaylistMoveRequest { pub to: SongPosition, } -impl CommandRequest<'_> for PlaylistMoveRequest { +impl CommandRequest for PlaylistMoveRequest { const COMMAND: &'static str = "playlistmove"; fn into_request_enum(self) -> crate::Request { @@ -85,7 +85,7 @@ impl CommandRequest<'_> for PlaylistMoveRequest { empty_command_response!(PlaylistMove); -impl Command<'_, '_> for PlaylistMove { +impl Command for PlaylistMove { type Request = PlaylistMoveRequest; type Response = PlaylistMoveResponse; } diff --git a/src/commands/stored_playlists/rename.rs b/src/commands/stored_playlists/rename.rs index d9c16994..17191db6 100644 --- a/src/commands/stored_playlists/rename.rs +++ b/src/commands/stored_playlists/rename.rs @@ -13,7 +13,7 @@ pub struct RenameRequest { pub new_name: String, } -impl CommandRequest<'_> for RenameRequest { +impl CommandRequest for RenameRequest { const COMMAND: &'static str = "rename"; fn into_request_enum(self) -> crate::Request { @@ -52,7 +52,7 @@ impl CommandRequest<'_> for RenameRequest { empty_command_response!(Rename); -impl Command<'_, '_> for Rename { +impl Command for Rename { type Request = RenameRequest; type Response = RenameResponse; } diff --git a/src/commands/stored_playlists/rm.rs b/src/commands/stored_playlists/rm.rs index d8853eea..86793d7e 100644 --- a/src/commands/stored_playlists/rm.rs +++ b/src/commands/stored_playlists/rm.rs @@ -9,7 +9,7 @@ single_item_command_request!(Rm, "rm", PlaylistName); empty_command_response!(Rm); -impl Command<'_, '_> for Rm { +impl Command for Rm { type Request = RmRequest; type Response = RmResponse; } diff --git a/src/commands/stored_playlists/save.rs b/src/commands/stored_playlists/save.rs index 68163f6f..f0a5aa0f 100644 --- a/src/commands/stored_playlists/save.rs +++ b/src/commands/stored_playlists/save.rs @@ -14,7 +14,7 @@ pub struct SaveRequest { pub mode: Option, } -impl CommandRequest<'_> for SaveRequest { +impl CommandRequest for SaveRequest { const COMMAND: &'static str = "save"; fn into_request_enum(self) -> crate::Request { @@ -67,7 +67,7 @@ impl CommandRequest<'_> for SaveRequest { empty_command_response!(Save); -impl Command<'_, '_> for Save { +impl Command for Save { type Request = SaveRequest; type Response = SaveResponse; } diff --git a/src/commands/stored_playlists/searchplaylist.rs b/src/commands/stored_playlists/searchplaylist.rs index 4dd12468..7a686330 100644 --- a/src/commands/stored_playlists/searchplaylist.rs +++ b/src/commands/stored_playlists/searchplaylist.rs @@ -16,7 +16,7 @@ pub struct SearchPlaylistRequest { pub range: Option, } -impl CommandRequest<'_> for SearchPlaylistRequest { +impl CommandRequest for SearchPlaylistRequest { const COMMAND: &'static str = "searchplaylist"; fn into_request_enum(self) -> crate::Request { @@ -39,7 +39,7 @@ impl CommandRequest<'_> for SearchPlaylistRequest { if let Some(range) = &self.range { cmd.push_str(&format!(" {}", range)); } - cmd.push_str("\n"); + cmd.push('\n'); cmd } @@ -76,7 +76,7 @@ impl CommandRequest<'_> for SearchPlaylistRequest { empty_command_response!(SearchPlaylist); -impl Command<'_, '_> for SearchPlaylist { +impl Command for SearchPlaylist { type Request = SearchPlaylistRequest; type Response = SearchPlaylistResponse; } diff --git a/src/request.rs b/src/request.rs index f63e58a7..ff7e7c59 100644 --- a/src/request.rs +++ b/src/request.rs @@ -207,8 +207,8 @@ pub enum Request { macro_rules! serialize_req { ($request_enum:expr, $request_struct:ty) => { { - if let Some(request) = <$request_struct as CommandRequest<'_>>::from_request_enum($request_enum) { - return <$request_struct as CommandRequest<'_>>::serialize(&request); + if let Some(request) = <$request_struct as CommandRequest>::from_request_enum($request_enum) { + return <$request_struct as CommandRequest>::serialize(&request); } else { panic!("Mismatched request enum and struct in serialize_request macro, this should never happen!"); }