diff --git a/Cargo.toml b/Cargo.toml index 1f78ab1..2df32a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ reqwest = { version = "0.11.11", features = [ "rustls-tls", ], default-features = false } serde = { version = "1.0.144", features = ["derive"] } -enum-iterator = "0.8.1" +enum-iterator = "1.2.0" dotenvy = "0.15.5" log = "0.4.17" diff --git a/src/types/request.rs b/src/types/request.rs index 61357c1..8f3e011 100644 --- a/src/types/request.rs +++ b/src/types/request.rs @@ -1,4 +1,4 @@ -use enum_iterator::IntoEnumIterator; +use enum_iterator::{all, Sequence}; use serde::Serialize; #[derive(Serialize, Debug)] @@ -53,7 +53,7 @@ impl RpcRequest { pub fn torrent_get(fields: Option>, ids: Option>) -> RpcRequest { let string_fields = fields - .unwrap_or(TorrentGetField::all()) + .unwrap_or(all::().collect()) .iter() .map(TorrentGetField::to_str) .collect(); @@ -155,9 +155,7 @@ pub struct TorrentGetArgs { impl Default for TorrentGetArgs { fn default() -> Self { - let all_fields = TorrentGetField::into_enum_iter() - .map(|it| it.to_str()) - .collect(); + let all_fields = all::().map(|it| it.to_str()).collect(); TorrentGetArgs { fields: Some(all_fields), ids: None, @@ -239,7 +237,7 @@ pub struct TorrentAddArgs { pub labels: Option>, } -#[derive(Clone, Copy, IntoEnumIterator)] +#[derive(Clone, Copy, Sequence)] pub enum TorrentGetField { ActivityDate, AddedDate, @@ -283,10 +281,6 @@ pub enum TorrentGetField { } impl TorrentGetField { - pub fn all() -> Vec { - TorrentGetField::into_enum_iter().collect() - } - #[must_use] pub fn to_str(&self) -> String { match self {