From f470f19c2cfe16a0b18b77ff475a781e009623ef Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 8 Dec 2025 04:14:32 +0900 Subject: [PATCH] common/types: flatten to `types` --- src/commands/audio_output_devices/disableoutput.rs | 2 +- src/commands/audio_output_devices/enableoutput.rs | 2 +- src/commands/audio_output_devices/outputs.rs | 2 +- src/commands/audio_output_devices/outputset.rs | 2 +- src/commands/audio_output_devices/toggleoutput.rs | 2 +- src/commands/client_to_client/channels.rs | 2 +- src/commands/client_to_client/readmessages.rs | 2 +- src/commands/client_to_client/sendmessage.rs | 2 +- src/commands/client_to_client/subscribe.rs | 2 +- src/commands/client_to_client/unsubscribe.rs | 2 +- src/commands/connection_settings/protocol_disable.rs | 2 +- src/commands/connection_settings/protocol_enable.rs | 2 +- src/commands/connection_settings/tag_types_disable.rs | 2 +- src/commands/connection_settings/tag_types_enable.rs | 2 +- src/commands/connection_settings/tag_types_reset.rs | 2 +- src/commands/controlling_playback/play.rs | 2 +- src/commands/controlling_playback/playid.rs | 2 +- src/commands/controlling_playback/seek.rs | 2 +- src/commands/controlling_playback/seekcur.rs | 2 +- src/commands/controlling_playback/seekid.rs | 2 +- src/commands/mounts_and_neighbors/mount.rs | 2 +- src/commands/mounts_and_neighbors/unmount.rs | 2 +- src/commands/music_database/albumart.rs | 2 +- src/commands/music_database/count.rs | 2 +- src/commands/music_database/find.rs | 2 +- src/commands/music_database/findadd.rs | 2 +- src/commands/music_database/getfingerprint.rs | 2 +- src/commands/music_database/list.rs | 2 +- src/commands/music_database/listall.rs | 5 ++--- src/commands/music_database/listallinfo.rs | 5 ++--- src/commands/music_database/listfiles.rs | 3 +-- src/commands/music_database/lsinfo.rs | 5 ++--- src/commands/music_database/readcomments.rs | 2 +- src/commands/music_database/readpicture.rs | 2 +- src/commands/music_database/rescan.rs | 2 +- src/commands/music_database/search.rs | 3 +-- src/commands/music_database/searchadd.rs | 2 +- src/commands/music_database/searchaddpl.rs | 2 +- src/commands/music_database/searchcount.rs | 3 +-- src/commands/music_database/update.rs | 2 +- src/commands/partition_commands/delpartition.rs | 2 +- src/commands/partition_commands/listpartitions.rs | 2 +- src/commands/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/mixrampdelay.rs | 2 +- src/commands/playback_options/replay_gain_mode.rs | 2 +- src/commands/playback_options/replay_gain_status.rs | 2 +- src/commands/playback_options/setvol.rs | 2 +- src/commands/playback_options/single.rs | 2 +- src/commands/playback_options/volume.rs | 2 +- src/commands/querying_mpd_status/currentsong.rs | 2 +- src/commands/querying_mpd_status/idle.rs | 2 +- src/commands/querying_mpd_status/status.rs | 2 +- src/commands/queue/add.rs | 2 +- src/commands/queue/addid.rs | 2 +- src/commands/queue/addtagid.rs | 2 +- src/commands/queue/cleartagid.rs | 2 +- src/commands/queue/delete.rs | 2 +- src/commands/queue/deleteid.rs | 2 +- src/commands/queue/move_.rs | 2 +- src/commands/queue/moveid.rs | 2 +- src/commands/queue/playlist.rs | 2 +- src/commands/queue/playlistfind.rs | 4 ++-- src/commands/queue/playlistid.rs | 3 +-- src/commands/queue/playlistinfo.rs | 3 +-- src/commands/queue/playlistsearch.rs | 3 +-- src/commands/queue/plchanges.rs | 3 +-- src/commands/queue/plchangesposid.rs | 3 +-- src/commands/queue/prio.rs | 2 +- src/commands/queue/prioid.rs | 2 +- src/commands/queue/rangeid.rs | 2 +- src/commands/queue/shuffle.rs | 2 +- src/commands/queue/swap.rs | 2 +- src/commands/queue/swapid.rs | 2 +- src/commands/stickers/sticker_dec.rs | 2 +- src/commands/stickers/sticker_delete.rs | 2 +- src/commands/stickers/sticker_find.rs | 2 +- src/commands/stickers/sticker_get.rs | 2 +- src/commands/stickers/sticker_inc.rs | 2 +- src/commands/stickers/sticker_list.rs | 2 +- src/commands/stickers/sticker_set.rs | 2 +- src/commands/stickers/stickernamestypes.rs | 2 +- src/commands/stored_playlists/listplaylist.rs | 2 +- src/commands/stored_playlists/listplaylistinfo.rs | 3 +-- src/commands/stored_playlists/listplaylists.rs | 2 +- src/commands/stored_playlists/load.rs | 2 +- src/commands/stored_playlists/playlistadd.rs | 2 +- src/commands/stored_playlists/playlistclear.rs | 2 +- src/commands/stored_playlists/playlistdelete.rs | 2 +- src/commands/stored_playlists/playlistlength.rs | 2 +- src/commands/stored_playlists/playlistmove.rs | 2 +- src/commands/stored_playlists/rm.rs | 2 +- src/commands/stored_playlists/save.rs | 2 +- src/commands/stored_playlists/searchplaylist.rs | 2 +- src/common.rs | 1 - src/filter/filter.rs | 2 +- src/filter/filter_grammar.lalrpop | 2 +- src/lib.rs | 8 ++++---- src/request.rs | 2 +- src/server.rs | 2 +- src/{common => }/types.rs | 2 ++ src/{common => }/types/absolute_relative_song_position.rs | 0 src/{common => }/types/audio.rs | 0 src/{common => }/types/bool_or_oneshot.rs | 0 src/{common => }/types/channel_name.rs | 0 src/{common => }/types/db_directory_info.rs | 0 src/{common => }/types/db_playlist_info.rs | 0 src/{common => }/types/db_selection_print.rs | 0 src/{common => }/types/db_song_info.rs | 0 src/{common => }/types/group_type.rs | 0 src/{common => }/types/one_or_range.rs | 0 src/{common => }/types/replay_gain_mode_mode.rs | 0 src/{common => }/types/save_mode.rs | 0 src/{common => }/types/seek_mode.rs | 0 src/{common => }/types/sort.rs | 0 src/{common => }/types/subsystem.rs | 0 src/{common => }/types/tag.rs | 0 src/{common => }/types/time_interval.rs | 0 src/{common => }/types/volume_value.rs | 0 src/{common => }/types/window_range.rs | 0 123 files changed, 111 insertions(+), 122 deletions(-) delete mode 100644 src/common.rs rename src/{common => }/types.rs (96%) rename src/{common => }/types/absolute_relative_song_position.rs (100%) rename src/{common => }/types/audio.rs (100%) rename src/{common => }/types/bool_or_oneshot.rs (100%) rename src/{common => }/types/channel_name.rs (100%) rename src/{common => }/types/db_directory_info.rs (100%) rename src/{common => }/types/db_playlist_info.rs (100%) rename src/{common => }/types/db_selection_print.rs (100%) rename src/{common => }/types/db_song_info.rs (100%) rename src/{common => }/types/group_type.rs (100%) rename src/{common => }/types/one_or_range.rs (100%) rename src/{common => }/types/replay_gain_mode_mode.rs (100%) rename src/{common => }/types/save_mode.rs (100%) rename src/{common => }/types/seek_mode.rs (100%) rename src/{common => }/types/sort.rs (100%) rename src/{common => }/types/subsystem.rs (100%) rename src/{common => }/types/tag.rs (100%) rename src/{common => }/types/time_interval.rs (100%) rename src/{common => }/types/volume_value.rs (100%) rename src/{common => }/types/window_range.rs (100%) diff --git a/src/commands/audio_output_devices/disableoutput.rs b/src/commands/audio_output_devices/disableoutput.rs index d6e8136..f99d67f 100644 --- a/src/commands/audio_output_devices/disableoutput.rs +++ b/src/commands/audio_output_devices/disableoutput.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::AudioOutputId, + types::AudioOutputId, }; pub struct DisableOutput; diff --git a/src/commands/audio_output_devices/enableoutput.rs b/src/commands/audio_output_devices/enableoutput.rs index 3b96010..cd5c127 100644 --- a/src/commands/audio_output_devices/enableoutput.rs +++ b/src/commands/audio_output_devices/enableoutput.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::AudioOutputId, + types::AudioOutputId, }; pub struct EnableOutput; diff --git a/src/commands/audio_output_devices/outputs.rs b/src/commands/audio_output_devices/outputs.rs index d0bea5c..7be7398 100644 --- a/src/commands/audio_output_devices/outputs.rs +++ b/src/commands/audio_output_devices/outputs.rs @@ -4,8 +4,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandResponse, ResponseParserError, empty_command_request}, - common::types::AudioOutputId, response_tokenizer::{ResponseAttributes, expect_property_type}, + types::AudioOutputId, }; pub struct Outputs; diff --git a/src/commands/audio_output_devices/outputset.rs b/src/commands/audio_output_devices/outputset.rs index 2e6a44a..e0643cb 100644 --- a/src/commands/audio_output_devices/outputset.rs +++ b/src/commands/audio_output_devices/outputset.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::AudioOutputId, request_tokenizer::RequestTokenizer, + types::AudioOutputId, }; pub struct OutputSet; diff --git a/src/commands/audio_output_devices/toggleoutput.rs b/src/commands/audio_output_devices/toggleoutput.rs index 4b426de..1f9d21d 100644 --- a/src/commands/audio_output_devices/toggleoutput.rs +++ b/src/commands/audio_output_devices/toggleoutput.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::AudioOutputId, + types::AudioOutputId, }; pub struct ToggleOutput; diff --git a/src/commands/client_to_client/channels.rs b/src/commands/client_to_client/channels.rs index 2601c8a..8224b37 100644 --- a/src/commands/client_to_client/channels.rs +++ b/src/commands/client_to_client/channels.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandResponse, ResponseParserError, empty_command_request}, - common::types::ChannelName, response_tokenizer::{ResponseAttributes, expect_property_type}, + types::ChannelName, }; pub struct Channels; diff --git a/src/commands/client_to_client/readmessages.rs b/src/commands/client_to_client/readmessages.rs index cca5e91..f9725a3 100644 --- a/src/commands/client_to_client/readmessages.rs +++ b/src/commands/client_to_client/readmessages.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandResponse, ResponseParserError, empty_command_request}, - common::types::ChannelName, response_tokenizer::{ResponseAttributes, expect_property_type}, + types::ChannelName, }; pub struct ReadMessages; diff --git a/src/commands/client_to_client/sendmessage.rs b/src/commands/client_to_client/sendmessage.rs index f2a3b0f..3318922 100644 --- a/src/commands/client_to_client/sendmessage.rs +++ b/src/commands/client_to_client/sendmessage.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::ChannelName, request_tokenizer::RequestTokenizer, + types::ChannelName, }; pub struct SendMessage; diff --git a/src/commands/client_to_client/subscribe.rs b/src/commands/client_to_client/subscribe.rs index 2b01819..94448fe 100644 --- a/src/commands/client_to_client/subscribe.rs +++ b/src/commands/client_to_client/subscribe.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::ChannelName, + types::ChannelName, }; pub struct Subscribe; diff --git a/src/commands/client_to_client/unsubscribe.rs b/src/commands/client_to_client/unsubscribe.rs index 8271c46..eef5444 100644 --- a/src/commands/client_to_client/unsubscribe.rs +++ b/src/commands/client_to_client/unsubscribe.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::ChannelName, + types::ChannelName, }; pub struct Unsubscribe; diff --git a/src/commands/connection_settings/protocol_disable.rs b/src/commands/connection_settings/protocol_disable.rs index 77d0f99..9696551 100644 --- a/src/commands/connection_settings/protocol_disable.rs +++ b/src/commands/connection_settings/protocol_disable.rs @@ -1,7 +1,7 @@ use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::Feature, request_tokenizer::RequestTokenizer, + types::Feature, }; pub struct ProtocolDisable; diff --git a/src/commands/connection_settings/protocol_enable.rs b/src/commands/connection_settings/protocol_enable.rs index 716234b..ecfc21f 100644 --- a/src/commands/connection_settings/protocol_enable.rs +++ b/src/commands/connection_settings/protocol_enable.rs @@ -1,7 +1,7 @@ use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::Feature, request_tokenizer::RequestTokenizer, + types::Feature, }; pub struct ProtocolEnable; diff --git a/src/commands/connection_settings/tag_types_disable.rs b/src/commands/connection_settings/tag_types_disable.rs index b48da8d..4f8b28c 100644 --- a/src/commands/connection_settings/tag_types_disable.rs +++ b/src/commands/connection_settings/tag_types_disable.rs @@ -1,7 +1,7 @@ use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::TagName, request_tokenizer::RequestTokenizer, + types::TagName, }; pub struct TagTypesDisable; diff --git a/src/commands/connection_settings/tag_types_enable.rs b/src/commands/connection_settings/tag_types_enable.rs index b4e2ded..90bf6aa 100644 --- a/src/commands/connection_settings/tag_types_enable.rs +++ b/src/commands/connection_settings/tag_types_enable.rs @@ -1,7 +1,7 @@ use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::TagName, request_tokenizer::RequestTokenizer, + types::TagName, }; pub struct TagTypesEnable; diff --git a/src/commands/connection_settings/tag_types_reset.rs b/src/commands/connection_settings/tag_types_reset.rs index c03a176..d874827 100644 --- a/src/commands/connection_settings/tag_types_reset.rs +++ b/src/commands/connection_settings/tag_types_reset.rs @@ -1,7 +1,7 @@ use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::TagName, request_tokenizer::RequestTokenizer, + types::TagName, }; pub struct TagTypesReset; diff --git a/src/commands/controlling_playback/play.rs b/src/commands/controlling_playback/play.rs index 83c0e8a..0430963 100644 --- a/src/commands/controlling_playback/play.rs +++ b/src/commands/controlling_playback/play.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::SongPosition, + types::SongPosition, }; pub struct Play; diff --git a/src/commands/controlling_playback/playid.rs b/src/commands/controlling_playback/playid.rs index 1002059..fdc1930 100644 --- a/src/commands/controlling_playback/playid.rs +++ b/src/commands/controlling_playback/playid.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::SongId, + types::SongId, }; pub struct PlayId; diff --git a/src/commands/controlling_playback/seek.rs b/src/commands/controlling_playback/seek.rs index f531329..961626c 100644 --- a/src/commands/controlling_playback/seek.rs +++ b/src/commands/controlling_playback/seek.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{SongPosition, TimeWithFractions}, request_tokenizer::RequestTokenizer, + types::{SongPosition, TimeWithFractions}, }; pub struct Seek; diff --git a/src/commands/controlling_playback/seekcur.rs b/src/commands/controlling_playback/seekcur.rs index 7ebc6fd..a354f81 100644 --- a/src/commands/controlling_playback/seekcur.rs +++ b/src/commands/controlling_playback/seekcur.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{SeekMode, TimeWithFractions}, request_tokenizer::RequestTokenizer, + types::{SeekMode, TimeWithFractions}, }; pub struct SeekCur; diff --git a/src/commands/controlling_playback/seekid.rs b/src/commands/controlling_playback/seekid.rs index 9cc7f77..9a7c8c9 100644 --- a/src/commands/controlling_playback/seekid.rs +++ b/src/commands/controlling_playback/seekid.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{SongId, TimeWithFractions}, request_tokenizer::RequestTokenizer, + types::{SongId, TimeWithFractions}, }; pub struct SeekId; diff --git a/src/commands/mounts_and_neighbors/mount.rs b/src/commands/mounts_and_neighbors/mount.rs index b001786..708fd5b 100644 --- a/src/commands/mounts_and_neighbors/mount.rs +++ b/src/commands/mounts_and_neighbors/mount.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{MountPath, Uri}, request_tokenizer::RequestTokenizer, + types::{MountPath, Uri}, }; pub struct Mount; diff --git a/src/commands/mounts_and_neighbors/unmount.rs b/src/commands/mounts_and_neighbors/unmount.rs index af1fc12..dc0b8db 100644 --- a/src/commands/mounts_and_neighbors/unmount.rs +++ b/src/commands/mounts_and_neighbors/unmount.rs @@ -1,8 +1,8 @@ use crate::{ - MountPath, commands::{ Command, CommandRequest, RequestParserError, RequestTokenizer, empty_command_response, }, + types::MountPath, }; pub struct Unmount; diff --git a/src/commands/music_database/albumart.rs b/src/commands/music_database/albumart.rs index e2541a5..cad25ba 100644 --- a/src/commands/music_database/albumart.rs +++ b/src/commands/music_database/albumart.rs @@ -4,9 +4,9 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{Offset, Uri}, request_tokenizer::RequestTokenizer, response_tokenizer::{ResponseAttributes, get_and_parse_property, get_property}, + types::{Offset, Uri}, }; pub struct AlbumArt; diff --git a/src/commands/music_database/count.rs b/src/commands/music_database/count.rs index b1a42ef..fe19f0d 100644 --- a/src/commands/music_database/count.rs +++ b/src/commands/music_database/count.rs @@ -4,10 +4,10 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::GroupType, filter::Filter, request_tokenizer::RequestTokenizer, response_tokenizer::{ResponseAttributes, get_and_parse_property}, + types::GroupType, }; pub struct Count; diff --git a/src/commands/music_database/find.rs b/src/commands/music_database/find.rs index bb5f0e8..aeb3139 100644 --- a/src/commands/music_database/find.rs +++ b/src/commands/music_database/find.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{DbSelectionPrintResponse, DbSongInfo, Sort, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, response_tokenizer::ResponseAttributes, + types::{DbSelectionPrintResponse, DbSongInfo, Sort, WindowRange}, }; pub struct Find; diff --git a/src/commands/music_database/findadd.rs b/src/commands/music_database/findadd.rs index 14a57c7..4d3bd64 100644 --- a/src/commands/music_database/findadd.rs +++ b/src/commands/music_database/findadd.rs @@ -2,9 +2,9 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{SongPosition, Sort, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, + types::{SongPosition, Sort, WindowRange}, }; pub struct FindAdd; diff --git a/src/commands/music_database/getfingerprint.rs b/src/commands/music_database/getfingerprint.rs index f892435..8905abc 100644 --- a/src/commands/music_database/getfingerprint.rs +++ b/src/commands/music_database/getfingerprint.rs @@ -4,8 +4,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandResponse, ResponseParserError, single_item_command_request}, - common::types::Uri, response_tokenizer::{ResponseAttributes, get_and_parse_property}, + types::Uri, }; pub struct GetFingerprint; diff --git a/src/commands/music_database/list.rs b/src/commands/music_database/list.rs index 669a97c..8b82a46 100644 --- a/src/commands/music_database/list.rs +++ b/src/commands/music_database/list.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{GroupType, TagName, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, response_tokenizer::{ResponseAttributes, expect_property_type}, + types::{GroupType, TagName, WindowRange}, }; pub struct List; diff --git a/src/commands/music_database/listall.rs b/src/commands/music_database/listall.rs index 8ef0249..9855855 100644 --- a/src/commands/music_database/listall.rs +++ b/src/commands/music_database/listall.rs @@ -1,13 +1,12 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSelectionPrintResponse, commands::{ Command, CommandResponse, RequestParserError, ResponseParserError, single_optional_item_command_request, }, - common::types::Uri, response_tokenizer::ResponseAttributes, + types::{DbSelectionPrintResponse, Uri}, }; pub struct ListAll; @@ -43,7 +42,7 @@ impl Command<'_, '_> for ListAll { mod tests { use std::path::PathBuf; - use crate::{DbDirectoryInfo, DbPlaylistInfo, DbSongInfo}; + use crate::types::{DbDirectoryInfo, DbPlaylistInfo, DbSongInfo}; use super::*; diff --git a/src/commands/music_database/listallinfo.rs b/src/commands/music_database/listallinfo.rs index f513ebb..cbe0f56 100644 --- a/src/commands/music_database/listallinfo.rs +++ b/src/commands/music_database/listallinfo.rs @@ -1,13 +1,12 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSelectionPrintResponse, commands::{ Command, CommandResponse, RequestParserError, ResponseParserError, single_optional_item_command_request, }, - common::types::Uri, response_tokenizer::ResponseAttributes, + types::{DbSelectionPrintResponse, Uri}, }; pub struct ListAllInfo; @@ -43,7 +42,7 @@ impl Command<'_, '_> for ListAllInfo { mod tests { use std::path::PathBuf; - use crate::{DbDirectoryInfo, DbPlaylistInfo, DbSongInfo, Tag}; + use crate::types::{DbDirectoryInfo, DbPlaylistInfo, DbSongInfo, Tag}; use super::*; diff --git a/src/commands/music_database/listfiles.rs b/src/commands/music_database/listfiles.rs index d567f24..df2e603 100644 --- a/src/commands/music_database/listfiles.rs +++ b/src/commands/music_database/listfiles.rs @@ -1,13 +1,12 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbDirectoryInfo, DbSelectionPrintResponse, commands::{ Command, CommandResponse, RequestParserError, ResponseParserError, single_optional_item_command_request, }, - common::types::Uri, response_tokenizer::ResponseAttributes, + types::{DbDirectoryInfo, DbSelectionPrintResponse, Uri}, }; pub struct ListFiles; diff --git a/src/commands/music_database/lsinfo.rs b/src/commands/music_database/lsinfo.rs index 6c2f592..dbb0639 100644 --- a/src/commands/music_database/lsinfo.rs +++ b/src/commands/music_database/lsinfo.rs @@ -1,13 +1,12 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSelectionPrintResponse, commands::{ Command, CommandResponse, RequestParserError, ResponseParserError, single_optional_item_command_request, }, - common::types::Uri, response_tokenizer::ResponseAttributes, + types::{DbSelectionPrintResponse, Uri}, }; pub struct LsInfo; @@ -42,7 +41,7 @@ impl Command<'_, '_> for LsInfo { mod tests { use std::path::PathBuf; - use crate::{DbDirectoryInfo, DbPlaylistInfo}; + use crate::types::{DbDirectoryInfo, DbPlaylistInfo}; use super::*; diff --git a/src/commands/music_database/readcomments.rs b/src/commands/music_database/readcomments.rs index 07e2ef2..0d88331 100644 --- a/src/commands/music_database/readcomments.rs +++ b/src/commands/music_database/readcomments.rs @@ -4,8 +4,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandResponse, ResponseParserError, single_item_command_request}, - common::types::Uri, response_tokenizer::{GenericResponseValue, ResponseAttributes}, + types::Uri, }; pub struct ReadComments; diff --git a/src/commands/music_database/readpicture.rs b/src/commands/music_database/readpicture.rs index 640ecd6..bad4a57 100644 --- a/src/commands/music_database/readpicture.rs +++ b/src/commands/music_database/readpicture.rs @@ -4,11 +4,11 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{Offset, Uri}, request_tokenizer::RequestTokenizer, response_tokenizer::{ ResponseAttributes, get_and_parse_property, get_optional_property, get_property, }, + types::{Offset, Uri}, }; pub struct ReadPicture; diff --git a/src/commands/music_database/rescan.rs b/src/commands/music_database/rescan.rs index cd4bd55..59fa3f8 100644 --- a/src/commands/music_database/rescan.rs +++ b/src/commands/music_database/rescan.rs @@ -7,8 +7,8 @@ use crate::{ Command, CommandResponse, RequestParserError, ResponseParserError, single_optional_item_command_request, }, - common::types::Uri, response_tokenizer::{ResponseAttributes, get_and_parse_property}, + types::Uri, }; pub struct Rescan; diff --git a/src/commands/music_database/search.rs b/src/commands/music_database/search.rs index 6108647..fb224d1 100644 --- a/src/commands/music_database/search.rs +++ b/src/commands/music_database/search.rs @@ -1,12 +1,11 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSelectionPrintResponse, DbSongInfo, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{Sort, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, response_tokenizer::ResponseAttributes, + types::{DbSelectionPrintResponse, DbSongInfo, Sort, WindowRange}, }; pub struct Search; diff --git a/src/commands/music_database/searchadd.rs b/src/commands/music_database/searchadd.rs index 1272a8c..b150166 100644 --- a/src/commands/music_database/searchadd.rs +++ b/src/commands/music_database/searchadd.rs @@ -2,9 +2,9 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{SongPosition, Sort, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, + types::{SongPosition, Sort, WindowRange}, }; pub struct SearchAdd; diff --git a/src/commands/music_database/searchaddpl.rs b/src/commands/music_database/searchaddpl.rs index 3635c31..12e27cf 100644 --- a/src/commands/music_database/searchaddpl.rs +++ b/src/commands/music_database/searchaddpl.rs @@ -2,9 +2,9 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{PlaylistName, SongPosition, Sort, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, + types::{PlaylistName, SongPosition, Sort, WindowRange}, }; pub struct SearchAddPl; diff --git a/src/commands/music_database/searchcount.rs b/src/commands/music_database/searchcount.rs index 9261c64..970e454 100644 --- a/src/commands/music_database/searchcount.rs +++ b/src/commands/music_database/searchcount.rs @@ -3,12 +3,11 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; use crate::{ - Seconds, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::GroupType, filter::Filter, request_tokenizer::RequestTokenizer, response_tokenizer::{ResponseAttributes, get_and_parse_property}, + types::{GroupType, Seconds}, }; pub struct SearchCount; diff --git a/src/commands/music_database/update.rs b/src/commands/music_database/update.rs index 5fa2da5..6cc7aa3 100644 --- a/src/commands/music_database/update.rs +++ b/src/commands/music_database/update.rs @@ -7,8 +7,8 @@ use crate::{ Command, CommandResponse, RequestParserError, ResponseParserError, single_optional_item_command_request, }, - common::types::Uri, response_tokenizer::{ResponseAttributes, get_and_parse_property}, + types::Uri, }; pub struct Update; diff --git a/src/commands/partition_commands/delpartition.rs b/src/commands/partition_commands/delpartition.rs index 0d8b3c9..ffdae32 100644 --- a/src/commands/partition_commands/delpartition.rs +++ b/src/commands/partition_commands/delpartition.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::PartitionName, + types::PartitionName, }; pub struct DelPartition; diff --git a/src/commands/partition_commands/listpartitions.rs b/src/commands/partition_commands/listpartitions.rs index 2ec877d..d66392e 100644 --- a/src/commands/partition_commands/listpartitions.rs +++ b/src/commands/partition_commands/listpartitions.rs @@ -1,7 +1,7 @@ use crate::{ commands::{Command, ResponseParserError, empty_command_request, multi_item_command_response}, - common::types::PartitionName, response_tokenizer::expect_property_type, + types::PartitionName, }; pub struct ListPartitions; diff --git a/src/commands/partition_commands/newpartition.rs b/src/commands/partition_commands/newpartition.rs index d66404b..1cea4c8 100644 --- a/src/commands/partition_commands/newpartition.rs +++ b/src/commands/partition_commands/newpartition.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::PartitionName, + types::PartitionName, }; pub struct NewPartition; diff --git a/src/commands/partition_commands/partition.rs b/src/commands/partition_commands/partition.rs index 5e0a134..f0f468a 100644 --- a/src/commands/partition_commands/partition.rs +++ b/src/commands/partition_commands/partition.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::PartitionName, + types::PartitionName, }; pub struct Partition; diff --git a/src/commands/playback_options/consume.rs b/src/commands/playback_options/consume.rs index 66ff082..1df0206 100644 --- a/src/commands/playback_options/consume.rs +++ b/src/commands/playback_options/consume.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::BoolOrOneshot, + types::BoolOrOneshot, }; pub struct Consume; diff --git a/src/commands/playback_options/crossfade.rs b/src/commands/playback_options/crossfade.rs index 214fec1..8562593 100644 --- a/src/commands/playback_options/crossfade.rs +++ b/src/commands/playback_options/crossfade.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::Seconds, + types::Seconds, }; pub struct Crossfade; diff --git a/src/commands/playback_options/getvol.rs b/src/commands/playback_options/getvol.rs index d9c654e..fcc8740 100644 --- a/src/commands/playback_options/getvol.rs +++ b/src/commands/playback_options/getvol.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_request, single_item_command_response}, - common::types::VolumeValue, + types::VolumeValue, }; pub struct GetVol; diff --git a/src/commands/playback_options/mixrampdelay.rs b/src/commands/playback_options/mixrampdelay.rs index 45e387e..b73d657 100644 --- a/src/commands/playback_options/mixrampdelay.rs +++ b/src/commands/playback_options/mixrampdelay.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::Seconds, + types::Seconds, }; pub struct MixRampDelay; diff --git a/src/commands/playback_options/replay_gain_mode.rs b/src/commands/playback_options/replay_gain_mode.rs index 895efc4..caa2ce7 100644 --- a/src/commands/playback_options/replay_gain_mode.rs +++ b/src/commands/playback_options/replay_gain_mode.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::ReplayGainModeMode, + types::ReplayGainModeMode, }; pub struct ReplayGainMode; diff --git a/src/commands/playback_options/replay_gain_status.rs b/src/commands/playback_options/replay_gain_status.rs index 3bd10c3..4a142d6 100644 --- a/src/commands/playback_options/replay_gain_status.rs +++ b/src/commands/playback_options/replay_gain_status.rs @@ -4,8 +4,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandResponse, ResponseParserError, empty_command_request}, - common::types::ReplayGainModeMode, response_tokenizer::{ResponseAttributes, get_property}, + types::ReplayGainModeMode, }; pub struct ReplayGainStatus; diff --git a/src/commands/playback_options/setvol.rs b/src/commands/playback_options/setvol.rs index a78ac0d..d4dbbd5 100644 --- a/src/commands/playback_options/setvol.rs +++ b/src/commands/playback_options/setvol.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::VolumeValue, + types::VolumeValue, }; pub struct SetVol; diff --git a/src/commands/playback_options/single.rs b/src/commands/playback_options/single.rs index 45c97a1..240995a 100644 --- a/src/commands/playback_options/single.rs +++ b/src/commands/playback_options/single.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::BoolOrOneshot, + types::BoolOrOneshot, }; pub struct Single; diff --git a/src/commands/playback_options/volume.rs b/src/commands/playback_options/volume.rs index c95643e..41ade4b 100644 --- a/src/commands/playback_options/volume.rs +++ b/src/commands/playback_options/volume.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::VolumeValue, + types::VolumeValue, }; pub struct Volume; diff --git a/src/commands/querying_mpd_status/currentsong.rs b/src/commands/querying_mpd_status/currentsong.rs index 357cf21..3fe469d 100644 --- a/src/commands/querying_mpd_status/currentsong.rs +++ b/src/commands/querying_mpd_status/currentsong.rs @@ -3,11 +3,11 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; use crate::{ - DbSongInfo, Priority, SongId, SongPosition, commands::{Command, CommandResponse, ResponseParserError, empty_command_request}, response_tokenizer::{ ResponseAttributes, get_and_parse_optional_property, get_and_parse_property, }, + types::{DbSongInfo, Priority, SongId, SongPosition}, }; /// Displays the song info of the current song (same song that is identified in status) diff --git a/src/commands/querying_mpd_status/idle.rs b/src/commands/querying_mpd_status/idle.rs index d3c4557..6ef9598 100644 --- a/src/commands/querying_mpd_status/idle.rs +++ b/src/commands/querying_mpd_status/idle.rs @@ -2,8 +2,8 @@ use std::str::FromStr; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::SubSystem, request_tokenizer::RequestTokenizer, + types::SubSystem, }; pub struct Idle; diff --git a/src/commands/querying_mpd_status/status.rs b/src/commands/querying_mpd_status/status.rs index 1300646..7d2bfac 100644 --- a/src/commands/querying_mpd_status/status.rs +++ b/src/commands/querying_mpd_status/status.rs @@ -5,11 +5,11 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandResponse, ResponseParserError, empty_command_request}, - common::types::{Audio, BoolOrOneshot, SongId, SongPosition}, response_tokenizer::{ ResponseAttributes, get_and_parse_optional_property, get_and_parse_property, get_optional_property, get_property, }, + types::{Audio, BoolOrOneshot, SongId, SongPosition}, }; pub struct Status; diff --git a/src/commands/queue/add.rs b/src/commands/queue/add.rs index 39957ee..f5df8c0 100644 --- a/src/commands/queue/add.rs +++ b/src/commands/queue/add.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{SongPosition, Uri}, request_tokenizer::RequestTokenizer, + types::{SongPosition, Uri}, }; pub struct Add; diff --git a/src/commands/queue/addid.rs b/src/commands/queue/addid.rs index 05541eb..66de188 100644 --- a/src/commands/queue/addid.rs +++ b/src/commands/queue/addid.rs @@ -2,9 +2,9 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{SongId, SongPosition, Uri}, request_tokenizer::RequestTokenizer, response_tokenizer::{ResponseAttributes, get_next_and_parse_property}, + types::{SongId, SongPosition, Uri}, }; pub struct AddId; diff --git a/src/commands/queue/addtagid.rs b/src/commands/queue/addtagid.rs index 458b42d..cf07ac1 100644 --- a/src/commands/queue/addtagid.rs +++ b/src/commands/queue/addtagid.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{SongId, TagName, TagValue}, request_tokenizer::RequestTokenizer, + types::{SongId, TagName, TagValue}, }; pub struct AddTagId; diff --git a/src/commands/queue/cleartagid.rs b/src/commands/queue/cleartagid.rs index ca67779..768d5f1 100644 --- a/src/commands/queue/cleartagid.rs +++ b/src/commands/queue/cleartagid.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{SongId, TagName}, request_tokenizer::RequestTokenizer, + types::{SongId, TagName}, }; pub struct ClearTagId; diff --git a/src/commands/queue/delete.rs b/src/commands/queue/delete.rs index 2c9e48e..2bb8b43 100644 --- a/src/commands/queue/delete.rs +++ b/src/commands/queue/delete.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::OneOrRange, + types::OneOrRange, }; pub struct Delete; diff --git a/src/commands/queue/deleteid.rs b/src/commands/queue/deleteid.rs index 3273c2a..220f115 100644 --- a/src/commands/queue/deleteid.rs +++ b/src/commands/queue/deleteid.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::SongId, + types::SongId, }; pub struct DeleteId; diff --git a/src/commands/queue/move_.rs b/src/commands/queue/move_.rs index 1878cd0..6a0bda8 100644 --- a/src/commands/queue/move_.rs +++ b/src/commands/queue/move_.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{AbsouluteRelativeSongPosition, OneOrRange}, request_tokenizer::RequestTokenizer, + types::{AbsouluteRelativeSongPosition, OneOrRange}, }; pub struct Move; diff --git a/src/commands/queue/moveid.rs b/src/commands/queue/moveid.rs index 7e4ef99..9ac7533 100644 --- a/src/commands/queue/moveid.rs +++ b/src/commands/queue/moveid.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{AbsouluteRelativeSongPosition, SongId}, request_tokenizer::RequestTokenizer, + types::{AbsouluteRelativeSongPosition, SongId}, }; pub struct MoveId; diff --git a/src/commands/queue/playlist.rs b/src/commands/queue/playlist.rs index 5d465c3..56b5fae 100644 --- a/src/commands/queue/playlist.rs +++ b/src/commands/queue/playlist.rs @@ -1,9 +1,9 @@ use serde::{Deserialize, Serialize}; use crate::{ - Uri, commands::{Command, CommandResponse, ResponseParserError, empty_command_request}, response_tokenizer::ResponseAttributes, + types::Uri, }; pub struct Playlist; diff --git a/src/commands/queue/playlistfind.rs b/src/commands/queue/playlistfind.rs index 5d1d430..9b01183 100644 --- a/src/commands/queue/playlistfind.rs +++ b/src/commands/queue/playlistfind.rs @@ -1,12 +1,12 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSongInfo, Priority, Response, SongId, SongPosition, + Response, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{Sort, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, response_tokenizer::ResponseAttributes, + types::{DbSongInfo, Priority, SongId, SongPosition, Sort, WindowRange}, }; pub struct PlaylistFind; diff --git a/src/commands/queue/playlistid.rs b/src/commands/queue/playlistid.rs index 6e5414c..3453cd7 100644 --- a/src/commands/queue/playlistid.rs +++ b/src/commands/queue/playlistid.rs @@ -1,10 +1,9 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSongInfo, Priority, SongPosition, commands::{Command, CommandResponse, ResponseParserError, single_item_command_request}, - common::types::SongId, response_tokenizer::ResponseAttributes, + types::{DbSongInfo, Priority, SongId, SongPosition}, }; pub struct PlaylistId; diff --git a/src/commands/queue/playlistinfo.rs b/src/commands/queue/playlistinfo.rs index 299cba1..7a40008 100644 --- a/src/commands/queue/playlistinfo.rs +++ b/src/commands/queue/playlistinfo.rs @@ -1,13 +1,12 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSongInfo, Priority, SongId, SongPosition, commands::{ Command, CommandResponse, RequestParserError, ResponseParserError, single_optional_item_command_request, }, - common::types::OneOrRange, response_tokenizer::ResponseAttributes, + types::{DbSongInfo, OneOrRange, Priority, SongId, SongPosition}, }; pub struct PlaylistInfo; diff --git a/src/commands/queue/playlistsearch.rs b/src/commands/queue/playlistsearch.rs index dcffe70..b396017 100644 --- a/src/commands/queue/playlistsearch.rs +++ b/src/commands/queue/playlistsearch.rs @@ -1,12 +1,11 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSongInfo, Priority, SongId, SongPosition, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{Sort, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, response_tokenizer::ResponseAttributes, + types::{DbSongInfo, Priority, SongId, SongPosition, Sort, WindowRange}, }; pub struct PlaylistSearch; diff --git a/src/commands/queue/plchanges.rs b/src/commands/queue/plchanges.rs index c079fde..f902a05 100644 --- a/src/commands/queue/plchanges.rs +++ b/src/commands/queue/plchanges.rs @@ -1,11 +1,10 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSongInfo, Priority, SongId, SongPosition, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{PlaylistVersion, WindowRange}, request_tokenizer::RequestTokenizer, response_tokenizer::ResponseAttributes, + types::{DbSongInfo, PlaylistVersion, Priority, SongId, SongPosition, WindowRange}, }; pub struct PlChanges; diff --git a/src/commands/queue/plchangesposid.rs b/src/commands/queue/plchangesposid.rs index 7fd497f..1aca07a 100644 --- a/src/commands/queue/plchangesposid.rs +++ b/src/commands/queue/plchangesposid.rs @@ -1,11 +1,10 @@ use serde::{Deserialize, Serialize}; use crate::{ - SongId, SongPosition, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{PlaylistVersion, WindowRange}, request_tokenizer::RequestTokenizer, response_tokenizer::ResponseAttributes, + types::{PlaylistVersion, SongId, SongPosition, WindowRange}, }; pub struct PlChangesPosId; diff --git a/src/commands/queue/prio.rs b/src/commands/queue/prio.rs index 7ca818b..d854f3a 100644 --- a/src/commands/queue/prio.rs +++ b/src/commands/queue/prio.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{Priority, WindowRange}, request_tokenizer::RequestTokenizer, + types::{Priority, WindowRange}, }; pub struct Prio; diff --git a/src/commands/queue/prioid.rs b/src/commands/queue/prioid.rs index 2503714..ebed4ee 100644 --- a/src/commands/queue/prioid.rs +++ b/src/commands/queue/prioid.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{Priority, SongId}, request_tokenizer::RequestTokenizer, + types::{Priority, SongId}, }; pub struct PrioId; diff --git a/src/commands/queue/rangeid.rs b/src/commands/queue/rangeid.rs index b35a5e6..bd840a7 100644 --- a/src/commands/queue/rangeid.rs +++ b/src/commands/queue/rangeid.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{SongId, TimeInterval}, request_tokenizer::RequestTokenizer, + types::{SongId, TimeInterval}, }; pub struct RangeId; diff --git a/src/commands/queue/shuffle.rs b/src/commands/queue/shuffle.rs index 91cd014..b9818ec 100644 --- a/src/commands/queue/shuffle.rs +++ b/src/commands/queue/shuffle.rs @@ -2,7 +2,7 @@ use crate::{ commands::{ Command, RequestParserError, empty_command_response, single_optional_item_command_request, }, - common::types::OneOrRange, + types::OneOrRange, }; pub struct Shuffle; diff --git a/src/commands/queue/swap.rs b/src/commands/queue/swap.rs index 39e722a..d01f03e 100644 --- a/src/commands/queue/swap.rs +++ b/src/commands/queue/swap.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::SongPosition, request_tokenizer::RequestTokenizer, + types::SongPosition, }; pub struct Swap; diff --git a/src/commands/queue/swapid.rs b/src/commands/queue/swapid.rs index 6c1c9a0..b13a94b 100644 --- a/src/commands/queue/swapid.rs +++ b/src/commands/queue/swapid.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::SongId, request_tokenizer::RequestTokenizer, + types::SongId, }; pub struct SwapId; diff --git a/src/commands/stickers/sticker_dec.rs b/src/commands/stickers/sticker_dec.rs index 98d0adb..3c84d95 100644 --- a/src/commands/stickers/sticker_dec.rs +++ b/src/commands/stickers/sticker_dec.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{StickerType, Uri}, request_tokenizer::RequestTokenizer, + types::{StickerType, Uri}, }; pub struct StickerDec; diff --git a/src/commands/stickers/sticker_delete.rs b/src/commands/stickers/sticker_delete.rs index 9c73846..b610d15 100644 --- a/src/commands/stickers/sticker_delete.rs +++ b/src/commands/stickers/sticker_delete.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{StickerType, Uri}, request_tokenizer::RequestTokenizer, + types::{StickerType, Uri}, }; pub struct StickerDelete; diff --git a/src/commands/stickers/sticker_find.rs b/src/commands/stickers/sticker_find.rs index 9c0abec..2cd910b 100644 --- a/src/commands/stickers/sticker_find.rs +++ b/src/commands/stickers/sticker_find.rs @@ -2,9 +2,9 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{Sort, StickerType, Uri, WindowRange}, request_tokenizer::RequestTokenizer, response_tokenizer::{ResponseAttributes, expect_property_type}, + types::{Sort, StickerType, Uri, WindowRange}, }; pub struct StickerFind; diff --git a/src/commands/stickers/sticker_get.rs b/src/commands/stickers/sticker_get.rs index 8b9827e..7ea687d 100644 --- a/src/commands/stickers/sticker_get.rs +++ b/src/commands/stickers/sticker_get.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, single_item_command_response}, - common::types::{StickerType, Uri}, request_tokenizer::RequestTokenizer, + types::{StickerType, Uri}, }; pub struct StickerGet; diff --git a/src/commands/stickers/sticker_inc.rs b/src/commands/stickers/sticker_inc.rs index cd69e39..b3a06e9 100644 --- a/src/commands/stickers/sticker_inc.rs +++ b/src/commands/stickers/sticker_inc.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{StickerType, Uri}, request_tokenizer::RequestTokenizer, + types::{StickerType, Uri}, }; pub struct StickerInc; diff --git a/src/commands/stickers/sticker_list.rs b/src/commands/stickers/sticker_list.rs index e7898bc..87e5918 100644 --- a/src/commands/stickers/sticker_list.rs +++ b/src/commands/stickers/sticker_list.rs @@ -4,9 +4,9 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{StickerType, Uri}, request_tokenizer::RequestTokenizer, response_tokenizer::{GenericResponseValue, ResponseAttributes}, + types::{StickerType, Uri}, }; pub struct StickerList; diff --git a/src/commands/stickers/sticker_set.rs b/src/commands/stickers/sticker_set.rs index d4886b9..cc4d304 100644 --- a/src/commands/stickers/sticker_set.rs +++ b/src/commands/stickers/sticker_set.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{StickerType, Uri}, request_tokenizer::RequestTokenizer, + types::{StickerType, Uri}, }; pub struct StickerSet; diff --git a/src/commands/stickers/stickernamestypes.rs b/src/commands/stickers/stickernamestypes.rs index 27fce49..fa40a65 100644 --- a/src/commands/stickers/stickernamestypes.rs +++ b/src/commands/stickers/stickernamestypes.rs @@ -4,9 +4,9 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::StickerType, request_tokenizer::RequestTokenizer, response_tokenizer::{ResponseAttributes, expect_property_type}, + types::StickerType, }; pub struct StickerNamesTypes; diff --git a/src/commands/stored_playlists/listplaylist.rs b/src/commands/stored_playlists/listplaylist.rs index 0090736..42f2ee7 100644 --- a/src/commands/stored_playlists/listplaylist.rs +++ b/src/commands/stored_playlists/listplaylist.rs @@ -7,9 +7,9 @@ use crate::{ Command, CommandRequest, RequestParserError, ResponseParserError, multi_item_command_response, }, - common::types::{PlaylistName, WindowRange}, request_tokenizer::RequestTokenizer, response_tokenizer::expect_property_type, + types::{PlaylistName, WindowRange}, }; pub struct ListPlaylist; diff --git a/src/commands/stored_playlists/listplaylistinfo.rs b/src/commands/stored_playlists/listplaylistinfo.rs index a8a7b53..0f9a3da 100644 --- a/src/commands/stored_playlists/listplaylistinfo.rs +++ b/src/commands/stored_playlists/listplaylistinfo.rs @@ -1,11 +1,10 @@ use serde::{Deserialize, Serialize}; use crate::{ - DbSongInfo, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, - common::types::{PlaylistName, WindowRange}, request_tokenizer::RequestTokenizer, response_tokenizer::ResponseAttributes, + types::{DbSongInfo, PlaylistName, WindowRange}, }; pub struct ListPlaylistInfo; diff --git a/src/commands/stored_playlists/listplaylists.rs b/src/commands/stored_playlists/listplaylists.rs index 7d1a070..f806d6b 100644 --- a/src/commands/stored_playlists/listplaylists.rs +++ b/src/commands/stored_playlists/listplaylists.rs @@ -1,9 +1,9 @@ use serde::{Deserialize, Serialize}; use crate::{ - PlaylistName, commands::{Command, CommandResponse, ResponseParserError, empty_command_request}, response_tokenizer::{ResponseAttributes, get_next_and_parse_property, get_next_property}, + types::PlaylistName, }; pub struct ListPlaylists; diff --git a/src/commands/stored_playlists/load.rs b/src/commands/stored_playlists/load.rs index a637893..dbfb953 100644 --- a/src/commands/stored_playlists/load.rs +++ b/src/commands/stored_playlists/load.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{PlaylistName, SongPosition, WindowRange}, request_tokenizer::RequestTokenizer, + types::{PlaylistName, SongPosition, WindowRange}, }; pub struct Load; diff --git a/src/commands/stored_playlists/playlistadd.rs b/src/commands/stored_playlists/playlistadd.rs index 35c8944..26d3374 100644 --- a/src/commands/stored_playlists/playlistadd.rs +++ b/src/commands/stored_playlists/playlistadd.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{PlaylistName, SongPosition, Uri}, request_tokenizer::RequestTokenizer, + types::{PlaylistName, SongPosition, Uri}, }; pub struct PlaylistAdd; diff --git a/src/commands/stored_playlists/playlistclear.rs b/src/commands/stored_playlists/playlistclear.rs index 05bf490..0992dfb 100644 --- a/src/commands/stored_playlists/playlistclear.rs +++ b/src/commands/stored_playlists/playlistclear.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::PlaylistName, + types::PlaylistName, }; pub struct PlaylistClear; diff --git a/src/commands/stored_playlists/playlistdelete.rs b/src/commands/stored_playlists/playlistdelete.rs index 3f907ac..1f0e098 100644 --- a/src/commands/stored_playlists/playlistdelete.rs +++ b/src/commands/stored_playlists/playlistdelete.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{OneOrRange, PlaylistName}, request_tokenizer::RequestTokenizer, + types::{OneOrRange, PlaylistName}, }; pub struct PlaylistDelete; diff --git a/src/commands/stored_playlists/playlistlength.rs b/src/commands/stored_playlists/playlistlength.rs index 96f5f2c..e3cb99e 100644 --- a/src/commands/stored_playlists/playlistlength.rs +++ b/src/commands/stored_playlists/playlistlength.rs @@ -4,8 +4,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandResponse, ResponseParserError, single_item_command_request}, - common::types::PlaylistName, response_tokenizer::{ResponseAttributes, get_and_parse_property}, + types::PlaylistName, }; pub struct PlaylistLength; diff --git a/src/commands/stored_playlists/playlistmove.rs b/src/commands/stored_playlists/playlistmove.rs index 01b0092..4e604eb 100644 --- a/src/commands/stored_playlists/playlistmove.rs +++ b/src/commands/stored_playlists/playlistmove.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{OneOrRange, PlaylistName, SongPosition}, request_tokenizer::RequestTokenizer, + types::{OneOrRange, PlaylistName, SongPosition}, }; pub struct PlaylistMove; diff --git a/src/commands/stored_playlists/rm.rs b/src/commands/stored_playlists/rm.rs index f1a3d2e..d8853ee 100644 --- a/src/commands/stored_playlists/rm.rs +++ b/src/commands/stored_playlists/rm.rs @@ -1,6 +1,6 @@ use crate::{ commands::{Command, empty_command_response, single_item_command_request}, - common::types::PlaylistName, + types::PlaylistName, }; pub struct Rm; diff --git a/src/commands/stored_playlists/save.rs b/src/commands/stored_playlists/save.rs index 2321074..662cbb0 100644 --- a/src/commands/stored_playlists/save.rs +++ b/src/commands/stored_playlists/save.rs @@ -2,8 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{PlaylistName, SaveMode}, request_tokenizer::RequestTokenizer, + types::{PlaylistName, SaveMode}, }; pub struct Save; diff --git a/src/commands/stored_playlists/searchplaylist.rs b/src/commands/stored_playlists/searchplaylist.rs index 8d60d60..ecc4772 100644 --- a/src/commands/stored_playlists/searchplaylist.rs +++ b/src/commands/stored_playlists/searchplaylist.rs @@ -2,9 +2,9 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::{Command, CommandRequest, RequestParserError, empty_command_response}, - common::types::{PlaylistName, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, + types::{PlaylistName, WindowRange}, }; pub struct SearchPlaylist; diff --git a/src/common.rs b/src/common.rs deleted file mode 100644 index 0d87a63..0000000 --- a/src/common.rs +++ /dev/null @@ -1 +0,0 @@ -pub(crate) mod types; diff --git a/src/filter/filter.rs b/src/filter/filter.rs index 6169a92..e94860b 100644 --- a/src/filter/filter.rs +++ b/src/filter/filter.rs @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize}; use crate::{ commands::RequestParserError, - common::types::{Priority, Tag}, + types::{Priority, Tag}, }; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] diff --git a/src/filter/filter_grammar.lalrpop b/src/filter/filter_grammar.lalrpop index 156c87a..31e3285 100644 --- a/src/filter/filter_grammar.lalrpop +++ b/src/filter/filter_grammar.lalrpop @@ -1,7 +1,7 @@ use std::str::FromStr; use chrono::{DateTime, Utc}; use crate::filter::filter::{CaseSensitivity, ComparisonOperator, Filter, unescape_string}; -use crate::common::types::Tag; +use crate::types::Tag; grammar; diff --git a/src/lib.rs b/src/lib.rs index fb6da45..376442d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,8 +3,8 @@ //! //! It does not provide any client or server implementation +mod client; mod commands; -mod common; mod filter; mod request; mod request_tokenizer; @@ -12,9 +12,9 @@ mod response; mod response_tokenizer; mod server; +pub mod types; + +pub use filter::{CaseSensitivity, ComparisonOperator, Filter}; pub use request::Request; pub use response::Response; pub use server::MPDServer; - -pub use common::types::*; -pub use filter::{CaseSensitivity, ComparisonOperator, Filter}; diff --git a/src/request.rs b/src/request.rs index 2301be8..28f5014 100644 --- a/src/request.rs +++ b/src/request.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; use crate::commands::*; -use crate::common::types::*; +use crate::types::*; use crate::filter::Filter; use crate::request_tokenizer::RequestTokenizer; diff --git a/src/server.rs b/src/server.rs index 6c5e62d..159a6f8 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1,4 +1,4 @@ -use crate::{Request, Response, common::types::SubSystem}; +use crate::{Request, Response, types::SubSystem}; pub trait MPDServer { type Error; diff --git a/src/common/types.rs b/src/types.rs similarity index 96% rename from src/common/types.rs rename to src/types.rs index 4ff3c83..1cb2a27 100644 --- a/src/common/types.rs +++ b/src/types.rs @@ -1,3 +1,5 @@ +//! Common types used throughout the empidee codebase. + mod absolute_relative_song_position; mod audio; mod bool_or_oneshot; diff --git a/src/common/types/absolute_relative_song_position.rs b/src/types/absolute_relative_song_position.rs similarity index 100% rename from src/common/types/absolute_relative_song_position.rs rename to src/types/absolute_relative_song_position.rs diff --git a/src/common/types/audio.rs b/src/types/audio.rs similarity index 100% rename from src/common/types/audio.rs rename to src/types/audio.rs diff --git a/src/common/types/bool_or_oneshot.rs b/src/types/bool_or_oneshot.rs similarity index 100% rename from src/common/types/bool_or_oneshot.rs rename to src/types/bool_or_oneshot.rs diff --git a/src/common/types/channel_name.rs b/src/types/channel_name.rs similarity index 100% rename from src/common/types/channel_name.rs rename to src/types/channel_name.rs diff --git a/src/common/types/db_directory_info.rs b/src/types/db_directory_info.rs similarity index 100% rename from src/common/types/db_directory_info.rs rename to src/types/db_directory_info.rs diff --git a/src/common/types/db_playlist_info.rs b/src/types/db_playlist_info.rs similarity index 100% rename from src/common/types/db_playlist_info.rs rename to src/types/db_playlist_info.rs diff --git a/src/common/types/db_selection_print.rs b/src/types/db_selection_print.rs similarity index 100% rename from src/common/types/db_selection_print.rs rename to src/types/db_selection_print.rs diff --git a/src/common/types/db_song_info.rs b/src/types/db_song_info.rs similarity index 100% rename from src/common/types/db_song_info.rs rename to src/types/db_song_info.rs diff --git a/src/common/types/group_type.rs b/src/types/group_type.rs similarity index 100% rename from src/common/types/group_type.rs rename to src/types/group_type.rs diff --git a/src/common/types/one_or_range.rs b/src/types/one_or_range.rs similarity index 100% rename from src/common/types/one_or_range.rs rename to src/types/one_or_range.rs diff --git a/src/common/types/replay_gain_mode_mode.rs b/src/types/replay_gain_mode_mode.rs similarity index 100% rename from src/common/types/replay_gain_mode_mode.rs rename to src/types/replay_gain_mode_mode.rs diff --git a/src/common/types/save_mode.rs b/src/types/save_mode.rs similarity index 100% rename from src/common/types/save_mode.rs rename to src/types/save_mode.rs diff --git a/src/common/types/seek_mode.rs b/src/types/seek_mode.rs similarity index 100% rename from src/common/types/seek_mode.rs rename to src/types/seek_mode.rs diff --git a/src/common/types/sort.rs b/src/types/sort.rs similarity index 100% rename from src/common/types/sort.rs rename to src/types/sort.rs diff --git a/src/common/types/subsystem.rs b/src/types/subsystem.rs similarity index 100% rename from src/common/types/subsystem.rs rename to src/types/subsystem.rs diff --git a/src/common/types/tag.rs b/src/types/tag.rs similarity index 100% rename from src/common/types/tag.rs rename to src/types/tag.rs diff --git a/src/common/types/time_interval.rs b/src/types/time_interval.rs similarity index 100% rename from src/common/types/time_interval.rs rename to src/types/time_interval.rs diff --git a/src/common/types/volume_value.rs b/src/types/volume_value.rs similarity index 100% rename from src/common/types/volume_value.rs rename to src/types/volume_value.rs diff --git a/src/common/types/window_range.rs b/src/types/window_range.rs similarity index 100% rename from src/common/types/window_range.rs rename to src/types/window_range.rs