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

@KrishnaSannasi : yeah, just dug up the response from @cuviper at https://github.com/rust-num/num-bigint/issues/80

It looks like you are trying to implement bigdecimal

https://crates.io/crates/bigdecimal