pub(crate) fn bigint_from_serde_json_number<'de, D>(
    deserializer: D,
) -> Result<Option<BigInt>, D::Error>
where
    D: Deserializer<'de>,
{
    use serde::de::Error;

    match DeserializeBigIntFrom::deserialize(deserializer) {
        Ok(s) => match s {
            DeserializeBigIntFrom::String(s) => BigInt::from_str(&s)
                .map(Some)
                .map_err(|e| Error::custom(e.to_string())),
            DeserializeBigIntFrom::SerdeJsonNumber(n) => BigInt::from_str(&n.to_string())
                .map(Some)
                .map_err(|e| Error::custom(e.to_string())),
        },
        Err(e) => Err(Error::custom(e.to_string())),
    }
}
/// Deserialize a `BigInt` instance from either a String or from a `serde_json::Number` value.  We
/// need to do this because the JSON specification allows for arbitrarily-large numbers, a feature
/// that Autolykos makes use of to encode the PoW-distance (d) parameter. Note that we also need to
/// use `serde_json` with the `arbitrary_precision` feature for this to work.
Deserialize a `BigInt` instance from either a String or from a `serde_json::Number` value.  We
need to do this because the JSON specification allows for arbitrarily-large numbers, a feature
that Autolykos makes use of to encode the PoW-distance (d) parameter. Note that we also need to
use `serde_json` with the `arbitrary_precision` feature for this to work.
Deserialize a ` BigInt ` instance from either a String or from a ` serde_json :: Number ` value . We need to do this because the JSON specification allows for arbitrarily - large numbers a feature that Autolykos makes use of to encode the PoW - distance ( d ) parameter . Note that we also need to use ` serde_json ` with the ` arbitrary_precision ` feature for this to work .
pub(crate) fn bigint_from_serde_json_number<'de, D>(
    deserializer: D,
) -> Result<Option<BigInt>, D::Error>
where
    D: Deserializer<'de>,
{
    use serde::de::Error;
    match DeserializeBigIntFrom::deserialize(deserializer) {
        Ok(s) => match s {
            DeserializeBigIntFrom::String(s) => BigInt::from_str(&s)
                .map(Some)
                .map_err(|e| Error::custom(e.to_string())),
            DeserializeBigIntFrom::SerdeJsonNumber(n) => BigInt::from_str(&n.to_string())
                .map(Some)
                .map_err(|e| Error::custom(e.to_string())),
        },
        Err(e) => Err(Error::custom(e.to_string())),
    }
}
pub ( crate ) fn bigint_from_serde_json_number < ' de , D > ( deserializer : D , ) -> Result < Option < BigInt > , D :: Error > where D : Deserializer < ' de > , { use serde :: de :: Error ; match DeserializeBigIntFrom :: deserialize ( deserializer ) { Ok ( s ) => match s { DeserializeBigIntFrom :: String ( s ) => BigInt :: from_str ( & s ) . map ( Some ) . map_err ( | e | Error :: custom ( e . to_string ( ) ) ) , DeserializeBigIntFrom :: SerdeJsonNumber ( n ) => BigInt :: from_str ( & n . to_string ( ) ) . map ( Some ) . map_err ( | e | Error :: custom ( e . to_string ( ) ) ) , } , Err ( e ) => Err ( Error :: custom ( e . to_string ( ) ) ) , } }
Deserialize a `BigInt` instance from either a String or from a `serde_json::Number` value.
Deserialize a ` BigInt ` instance from either a String or from a ` serde_json :: Number ` value .
deserializer
D
deserializer
D