Rust edition 2024
Some checks failed
Build and test / build (push) Successful in 59s
Build and test / check (push) Failing after 1m2s
Build and test / test (push) Successful in 1m42s
Build and test / docs (push) Successful in 1m19s

This commit is contained in:
2025-02-26 16:39:34 +01:00
parent 58a06bd930
commit e910d29aa4
67 changed files with 96 additions and 95 deletions

View File

@@ -7,8 +7,8 @@ authors = [
description = "A rust implementation of the mpd protocol, both client and serverside"
repository = "https://git.pvv.ntnu.no/Grzegorz/empidee"
documentation = "https://pages.pvv.ntnu.no/Grzegorz/empidee/main/docs/empidee/"
edition = "2021"
rust-version = "1.83.0"
edition = "2024"
rust-version = "1.85.0"
[dependencies]
serde = { version = "1.0.210", features = ["derive"] }

12
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1739866667,
"narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=",
"lastModified": 1740367490,
"narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680",
"rev": "0196c0175e9191c474c26ab5548db27ef5d34b05",
"type": "github"
},
"original": {
@@ -29,11 +29,11 @@
]
},
"locked": {
"lastModified": 1740277845,
"narHash": "sha256-NNU0CdiaSbAeZ8tpDG4aFi9qtcdlItRvk8Xns9oBrVU=",
"lastModified": 1740536993,
"narHash": "sha256-3YI+1ONZ28chM19Hep9Z+TSyiybYf/1VC/gwImVZKUw=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "f933070c29f9c1c5457447a51903f27f76ebb519",
"rev": "9f05c0655de9dc2c7b60b689447c48abb9190bf8",
"type": "github"
},
"original": {

1
rustfmt.toml Normal file
View File

@@ -0,0 +1 @@
style_edition = "2024"

View File

@@ -1,8 +1,8 @@
use serde::{Deserialize, Serialize};
use crate::commands::{
expect_property_type, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
expect_property_type,
};
pub struct Channels;

View File

@@ -1,8 +1,8 @@
use serde::{Deserialize, Serialize};
use crate::commands::{
expect_property_type, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
expect_property_type,
};
pub struct ReadMessages;

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct Protocol;

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct ProtocolAll;

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct ProtocolAvailable;

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct ProtocolClear;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct ProtocolDisable;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct ProtocolEnable;

View File

@@ -30,7 +30,7 @@ impl Command for TagTypes {
GenericResponseValue::Binary(_) => {
return Err(ResponseParserError::UnexpectedPropertyType(
"tagtype", "Binary",
))
));
}
};

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct TagTypesAll;

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct TagTypesAvailable;

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct TagTypesClear;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct TagTypesDisable;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct TagTypesEnable;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct TagTypesReset;

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct ListMounts;

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct ListNeighbors;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct Mount;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct Unmount;

View File

@@ -2,8 +2,8 @@ use std::collections::HashMap;
use crate::{
commands::{
get_and_parse_property, get_property, Command, Request, RequestParserError,
RequestParserResult, ResponseAttributes, ResponseParserError,
Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
ResponseParserError, get_and_parse_property, get_property,
},
common::Offset,
};

View File

@@ -2,8 +2,8 @@ use std::collections::HashMap;
use crate::{
commands::{
get_and_parse_property, Command, Request, RequestParserError, RequestParserResult,
ResponseAttributes, ResponseParserError,
Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
ResponseParserError, get_and_parse_property,
},
filter::parse_filter,
};

View File

@@ -1,8 +1,8 @@
use std::collections::HashMap;
use crate::commands::{
get_and_parse_property, Command, Request, RequestParserError, RequestParserResult,
ResponseAttributes, ResponseParserError,
Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
ResponseParserError, get_and_parse_property,
};
pub struct GetFingerprint;

View File

@@ -1,7 +1,7 @@
use crate::{
commands::{
expect_property_type, Command, Request, RequestParserError, RequestParserResult,
ResponseAttributes, ResponseParserError,
Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
ResponseParserError, expect_property_type,
},
filter::parse_filter,
};

View File

@@ -2,8 +2,8 @@ use std::collections::HashMap;
use crate::{
commands::{
get_and_parse_property, get_optional_property, get_property, Command, Request,
RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
ResponseParserError, get_and_parse_property, get_optional_property, get_property,
},
common::Offset,
};

View File

@@ -1,8 +1,8 @@
use std::collections::HashMap;
use crate::commands::{
get_and_parse_property, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
get_and_parse_property,
};
pub struct Rescan;

View File

@@ -2,8 +2,8 @@ use std::collections::HashMap;
use crate::{
commands::{
get_and_parse_property, Command, Request, RequestParserError, RequestParserResult,
ResponseAttributes, ResponseParserError,
Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
ResponseParserError, get_and_parse_property,
},
filter::parse_filter,
};

View File

@@ -1,8 +1,8 @@
use std::collections::HashMap;
use crate::commands::{
get_and_parse_property, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
get_and_parse_property,
};
pub struct Update;

View File

@@ -1,6 +1,6 @@
use crate::commands::{
expect_property_type, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
expect_property_type,
};
pub struct ListPartitions;

View File

@@ -2,8 +2,8 @@ use std::collections::HashMap;
use crate::{
commands::{
get_and_parse_property, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
get_and_parse_property,
},
common::VolumeValue,
};

View File

@@ -4,8 +4,8 @@ use serde::{Deserialize, Serialize};
use crate::{
commands::{
get_property, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
get_property,
},
common::ReplayGainModeMode,
};

View File

@@ -3,8 +3,8 @@ use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use crate::commands::{
get_and_parse_optional_property, get_and_parse_property, Command, Request, RequestParserResult,
ResponseAttributes, ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
get_and_parse_optional_property, get_and_parse_property,
};
pub struct Stats;

View File

@@ -6,9 +6,9 @@ use serde::{Deserialize, Serialize};
use crate::common::{Audio, BoolOrOneshot, SongId, SongPosition};
use crate::commands::{
get_and_parse_optional_property, get_and_parse_property, get_optional_property, get_property,
Command, GenericResponseValue, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
ResponseParserError, get_and_parse_optional_property, get_and_parse_property,
get_optional_property, get_property,
};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]

View File

@@ -1,7 +1,7 @@
use crate::{
commands::{
get_next_and_parse_property, Command, Request, RequestParserError, RequestParserResult,
ResponseAttributes, ResponseParserError,
Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
ResponseParserError, get_next_and_parse_property,
},
common::{SongId, SongPosition},
};

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct AddTagId;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct ClearTagId;

View File

@@ -1,11 +1,11 @@
use std::str::FromStr;
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
common::OneOrRange,
Request,
};
pub struct Delete;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct DeleteId;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct Move;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct MoveId;

View File

@@ -1,6 +1,6 @@
use crate::{
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
Request,
commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError},
};
pub struct Playlist;

View File

@@ -1,9 +1,9 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
filter::parse_filter,
Request,
};
pub struct PlaylistFind;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct PlaylistId;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct PlaylistInfo;

View File

@@ -1,9 +1,9 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
filter::parse_filter,
Request,
};
pub struct PlaylistSearch;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct PlChanges;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct PlChangesPosId;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct Prio;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct PrioId;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct RangeId;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct Shuffle;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct Swap;

View File

@@ -1,8 +1,8 @@
use crate::{
Request,
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
pub struct SwapId;

View File

@@ -30,7 +30,7 @@ impl Command for Commands {
GenericResponseValue::Binary(_) => {
return Err(ResponseParserError::UnexpectedPropertyType(
"handler", "Binary",
))
));
}
};
result.push(value.to_string());

View File

@@ -1,8 +1,8 @@
use std::collections::HashMap;
use crate::commands::{
get_and_parse_property, get_property, Command, Request, RequestParserResult,
ResponseAttributes, ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
get_and_parse_property, get_property,
};
pub struct Config;

View File

@@ -30,7 +30,7 @@ impl Command for NotCommands {
GenericResponseValue::Binary(_) => {
return Err(ResponseParserError::UnexpectedPropertyType(
"handler", "Binary",
))
));
}
};
result.push(value.to_string());

View File

@@ -30,7 +30,7 @@ impl Command for UrlHandlers {
GenericResponseValue::Binary(_) => {
return Err(ResponseParserError::UnexpectedPropertyType(
"handler", "Binary",
))
));
}
};
url_handlers.push(value.to_string());

View File

@@ -87,7 +87,7 @@ impl Command for StickerFind {
let uri = match uri.1 {
GenericResponseValue::Text(s) => s.to_string(),
GenericResponseValue::Binary(_) => {
return Err(ResponseParserError::UnexpectedPropertyType(uri.0, "Binary"))
return Err(ResponseParserError::UnexpectedPropertyType(uri.0, "Binary"));
}
};
@@ -96,7 +96,7 @@ impl Command for StickerFind {
GenericResponseValue::Binary(_) => {
return Err(ResponseParserError::UnexpectedPropertyType(
"sticker", "Binary",
))
));
}
};

View File

@@ -1,6 +1,6 @@
use crate::commands::{
get_next_property, Command, Request, RequestParserError, RequestParserResult,
ResponseAttributes, ResponseParserError,
Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
ResponseParserError, get_next_property,
};
pub struct StickerGet;

View File

@@ -1,6 +1,6 @@
use crate::commands::{
expect_property_type, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
expect_property_type,
};
pub struct StickerNames;

View File

@@ -39,7 +39,7 @@ impl Command for StickerNamesTypes {
GenericResponseValue::Binary(_) => {
return Err(ResponseParserError::UnexpectedPropertyType(
"name", "Binary",
))
));
}
};
@@ -48,7 +48,7 @@ impl Command for StickerNamesTypes {
GenericResponseValue::Binary(_) => {
return Err(ResponseParserError::UnexpectedPropertyType(
"type", "Binary",
))
));
}
};

View File

@@ -1,6 +1,6 @@
use crate::commands::{
expect_property_type, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
expect_property_type,
};
pub struct StickerTypes;

View File

@@ -1,8 +1,8 @@
use std::collections::HashMap;
use crate::commands::{
get_and_parse_property, Command, Request, RequestParserError, RequestParserResult,
ResponseAttributes, ResponseParserError,
Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
ResponseParserError, get_and_parse_property,
};
pub struct PlaylistLength;

View File

@@ -239,7 +239,7 @@ impl Request {
.ok_or(RequestParserError::MissingCommandListEnd(i))?;
match line.trim() {
"command_list_begin" => {
return Err(RequestParserError::NestedCommandList(i))
return Err(RequestParserError::NestedCommandList(i));
}
"command_list_end" => {
return Ok((Request::CommandList(commands), rest));

View File

@@ -1,4 +1,4 @@
use crate::{common::SubSystem, Request, Response};
use crate::{Request, Response, common::SubSystem};
pub trait MPDServer {
type Error;