Derive Serialize, Deserialize for num_bigint::BigInt

  1. I am using https://crates.io/crates/num-bigint . I have:
#[derive(serde::Serialize, serde::Deserialize)]
pub struct BigFloat {
  big_int: num_bigint::BigInt,
  exp: num_bigint::BigInt,
}
  1. This appears to not be working due to BigInt not implementing serde Serialize/Deserialize.

  2. What is the easiest way to add serde::Serialize/Deserialize for BigFloat?

By adding the serde feature to num-bigint in your Caro.toml. This will implement Serialize/Deseriialize for BitInt

1 Like

@RustyYato : yeah, just dug up the response from @cuviper at How to implement Serialize and Deserialize · Issue #80 · rust-num/num-bigint · GitHub

It looks like you are trying to implement bigdecimal

https://crates.io/crates/bigdecimal

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.