Fix serialization/deserialization of status codes
This commit is contained in:
parent
375377f56a
commit
1da05e29e1
3 changed files with 15 additions and 1 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -177,6 +177,7 @@ dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"serde_repr",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"time",
|
"time",
|
||||||
]
|
]
|
||||||
|
@ -733,6 +734,17 @@ dependencies = [
|
||||||
"serde",
|
"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]]
|
[[package]]
|
||||||
name = "serde_urlencoded"
|
name = "serde_urlencoded"
|
||||||
version = "0.7.1"
|
version = "0.7.1"
|
||||||
|
|
|
@ -11,3 +11,4 @@ reqwest = { version = "0.11", features = ["blocking", "json"]}
|
||||||
strum_macros = { version = "0.26.1"}
|
strum_macros = { version = "0.26.1"}
|
||||||
time = { version = "0.3.32", features = ["serde", "serde-well-known"]}
|
time = { version = "0.3.32", features = ["serde", "serde-well-known"]}
|
||||||
serde_json = "1.0.113"
|
serde_json = "1.0.113"
|
||||||
|
serde_repr = "0.1.18"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
|
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -19,7 +20,7 @@ pub struct FroniousResponse<T> {
|
||||||
body: T,
|
body: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize_repr, Deserialize_repr)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum StatusCode {
|
pub enum StatusCode {
|
||||||
Okay = 0,
|
Okay = 0,
|
||||||
|
|
Loading…
Reference in a new issue