diff --git a/Cargo.lock b/Cargo.lock index 352765d..8675251 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -177,6 +177,7 @@ dependencies = [ "reqwest", "serde", "serde_json", + "serde_repr", "strum_macros", "time", ] @@ -733,6 +734,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" diff --git a/Cargo.toml b/Cargo.toml index 3afa102..de655b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,3 +11,4 @@ reqwest = { version = "0.11", features = ["blocking", "json"]} strum_macros = { version = "0.26.1"} time = { version = "0.3.32", features = ["serde", "serde-well-known"]} serde_json = "1.0.113" +serde_repr = "0.1.18" diff --git a/src/fronious.rs b/src/fronious.rs index 677037c..7b3274a 100644 --- a/src/fronious.rs +++ b/src/fronious.rs @@ -1,4 +1,5 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde_repr::{Deserialize_repr, Serialize_repr}; use std::net::IpAddr; #[derive(Debug)] @@ -19,7 +20,7 @@ pub struct FroniousResponse { body: T, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize_repr, Deserialize_repr)] #[repr(u8)] pub enum StatusCode { Okay = 0,