mirror of
https://github.com/kristoferssolo/transmission-rpc.git
synced 2025-10-21 20:10:37 +00:00
Remove deprecated rustc-serialize
This commit is contained in:
parent
2e9dbdf2cc
commit
78c9980844
@ -17,7 +17,6 @@ include = [
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
reqwest = { version = "0.11.2", features = ["json", "rustls-tls"], default-features = false }
|
reqwest = { version = "0.11.2", features = ["json", "rustls-tls"], default-features = false }
|
||||||
serde = { version = "1.0.124", features = ["derive"] }
|
serde = { version = "1.0.124", features = ["derive"] }
|
||||||
rustc-serialize = "0.3.24"
|
|
||||||
enum-iterator = "0.7.0"
|
enum-iterator = "0.7.0"
|
||||||
|
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use enum_iterator::IntoEnumIterator;
|
use enum_iterator::IntoEnumIterator;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Serialize, Debug, RustcEncodable)]
|
#[derive(Serialize, Debug)]
|
||||||
pub struct RpcRequest {
|
pub struct RpcRequest {
|
||||||
method: String,
|
method: String,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
@ -108,7 +108,7 @@ impl RpcRequest {
|
|||||||
pub trait ArgumentFields {}
|
pub trait ArgumentFields {}
|
||||||
impl ArgumentFields for TorrentGetField {}
|
impl ArgumentFields for TorrentGetField {}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum Args {
|
pub enum Args {
|
||||||
FreeSpaceArgs(FreeSpaceArgs),
|
FreeSpaceArgs(FreeSpaceArgs),
|
||||||
@ -120,12 +120,12 @@ pub enum Args {
|
|||||||
TorrentRenamePathArgs(TorrentRenamePathArgs),
|
TorrentRenamePathArgs(TorrentRenamePathArgs),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
pub struct FreeSpaceArgs {
|
pub struct FreeSpaceArgs {
|
||||||
path: String,
|
path: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
pub struct TorrentGetArgs {
|
pub struct TorrentGetArgs {
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
fields: Option<Vec<String>>,
|
fields: Option<Vec<String>>,
|
||||||
@ -145,18 +145,18 @@ impl Default for TorrentGetArgs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
pub struct TorrentActionArgs {
|
pub struct TorrentActionArgs {
|
||||||
ids: Vec<Id>,
|
ids: Vec<Id>,
|
||||||
}
|
}
|
||||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
pub struct TorrentRemoveArgs {
|
pub struct TorrentRemoveArgs {
|
||||||
ids: Vec<Id>,
|
ids: Vec<Id>,
|
||||||
#[serde(rename = "delete-local-data")]
|
#[serde(rename = "delete-local-data")]
|
||||||
delete_local_data: bool,
|
delete_local_data: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
pub struct TorrentSetLocationArgs {
|
pub struct TorrentSetLocationArgs {
|
||||||
ids: Vec<Id>,
|
ids: Vec<Id>,
|
||||||
location: String,
|
location: String,
|
||||||
@ -164,21 +164,21 @@ pub struct TorrentSetLocationArgs {
|
|||||||
move_from: Option<bool>,
|
move_from: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
pub struct TorrentRenamePathArgs {
|
pub struct TorrentRenamePathArgs {
|
||||||
ids: Vec<Id>,
|
ids: Vec<Id>,
|
||||||
path: String,
|
path: String,
|
||||||
name: String,
|
name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum Id {
|
pub enum Id {
|
||||||
Id(i64),
|
Id(i64),
|
||||||
Hash(String),
|
Hash(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
pub struct TorrentAddArgs {
|
pub struct TorrentAddArgs {
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub cookies: Option<String>,
|
pub cookies: Option<String>,
|
||||||
|
|||||||
@ -68,7 +68,7 @@ pub struct PortTest {
|
|||||||
}
|
}
|
||||||
impl RpcResponseArgument for PortTest {}
|
impl RpcResponseArgument for PortTest {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, RustcEncodable, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
pub struct Torrent {
|
pub struct Torrent {
|
||||||
#[serde(rename = "addedDate")]
|
#[serde(rename = "addedDate")]
|
||||||
pub added_date: Option<i64>,
|
pub added_date: Option<i64>,
|
||||||
@ -139,19 +139,19 @@ pub struct Stats {
|
|||||||
pub session_count: Option<i32>
|
pub session_count: Option<i32>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, RustcEncodable)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct Torrents<T> {
|
pub struct Torrents<T> {
|
||||||
pub torrents: Vec<T>,
|
pub torrents: Vec<T>,
|
||||||
}
|
}
|
||||||
impl RpcResponseArgument for Torrents<Torrent> {}
|
impl RpcResponseArgument for Torrents<Torrent> {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, RustcEncodable, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
pub struct Trackers {
|
pub struct Trackers {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub announce: String,
|
pub announce: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, RustcEncodable, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
pub struct File {
|
pub struct File {
|
||||||
pub length: i64,
|
pub length: i64,
|
||||||
#[serde(rename = "bytesCompleted")]
|
#[serde(rename = "bytesCompleted")]
|
||||||
@ -159,7 +159,7 @@ pub struct File {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, RustcEncodable, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
pub struct FileStat {
|
pub struct FileStat {
|
||||||
#[serde(rename = "bytesCompleted")]
|
#[serde(rename = "bytesCompleted")]
|
||||||
pub bytes_completed: i64,
|
pub bytes_completed: i64,
|
||||||
@ -168,18 +168,18 @@ pub struct FileStat {
|
|||||||
pub priority: i8,
|
pub priority: i8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, RustcEncodable)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct Nothing {}
|
pub struct Nothing {}
|
||||||
impl RpcResponseArgument for Nothing {}
|
impl RpcResponseArgument for Nothing {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, RustcEncodable)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct TorrentAdded {
|
pub struct TorrentAdded {
|
||||||
#[serde(rename = "torrent-added")]
|
#[serde(rename = "torrent-added")]
|
||||||
pub torrent_added: Option<Torrent>,
|
pub torrent_added: Option<Torrent>,
|
||||||
}
|
}
|
||||||
impl RpcResponseArgument for TorrentAdded {}
|
impl RpcResponseArgument for TorrentAdded {}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, RustcEncodable)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct TorrentRenamePath{
|
pub struct TorrentRenamePath{
|
||||||
pub path: String,
|
pub path: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user