Deserializing Amount::MAX currently fails with
---- amount::serde::tests::can_serde_as_btc stdout ----
thread 'amount::serde::tests::can_serde_as_btc' panicked at units/src/amount/serde.rs:423:61:
failed to deser: Error("amount out of range: the amount is greater than 18446744073709551615", line: 1, column: 29)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I would expect this test to pass:
#[test]
fn can_serde_as_btc() {
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct HasAmount {
#[serde(with = "crate::amount::serde::as_btc")]
pub amount: Amount,
}
let orig = HasAmount {
amount: Amount::MAX,
};
let json = serde_json::to_string(&orig).expect("failed to ser");
let rinsed: HasAmount = serde_json::from_str(&json).expect("failed to deser");
assert_eq!(rinsed, orig)
}
Deserializing
Amount::MAXcurrently fails withI would expect this test to pass: