Enumify the torrent error type

This commit is contained in:
Leopith 2023-01-01 14:09:32 +11:00 committed by Aleksandr
parent e82d71adc7
commit 4fe84956da
2 changed files with 13 additions and 3 deletions

View File

@ -17,6 +17,7 @@ pub use self::request::{
pub(crate) use self::response::RpcResponseArgument;
pub use self::response::{
BlocklistUpdate, FreeSpace, Nothing, PortTest, RpcResponse, SessionClose, SessionGet,
SessionStats, Torrent, TorrentAddedOrDuplicate, TorrentRenamePath, TorrentStatus, Torrents,
BlocklistUpdate, ErrorType, FreeSpace, Nothing, PortTest, RpcResponse, SessionClose,
SessionGet, SessionStats, Torrent, TorrentAddedOrDuplicate, TorrentRenamePath, TorrentStatus,
Torrents,
};

View File

@ -81,6 +81,15 @@ pub enum TorrentStatus {
Seeding = 6,
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Deserialize_repr)]
#[repr(u8)]
pub enum ErrorType {
Ok = 0,
TrackerWarning = 1,
TrackerError = 2,
LocalError = 3,
}
#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Torrent {
@ -89,7 +98,7 @@ pub struct Torrent {
pub done_date: Option<i64>,
pub download_dir: Option<String>,
pub edit_date: Option<i64>,
pub error: Option<i64>,
pub error: Option<ErrorType>,
pub error_string: Option<String>,
pub eta: Option<i64>,
pub id: Option<i64>,