pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<BigUint>, D::Error>
where
    D: Deserializer<'de>,
{
    struct BigUintVisitor;

    impl<'de> de::Visitor<'de> for BigUintVisitor {
        type Value = Option<BigUint>;

        fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
            formatter.write_str("a Base64urlUInt string")
        }

        fn visit_none<E>(self) -> Result<Self::Value, E>
        where
            E: de::Error,
        {
            Ok(None)
        }

        fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
        where
            D: Deserializer<'de>,
        {
            deserializer.deserialize_str(self)
        }

        fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
        where
            E: de::Error,
        {
            let bytes = BASE64URL_NOPAD
                .decode(value.as_bytes())
                .map_err(E::custom)?;
            Ok(Some(BigUint::from_bytes_be(&bytes)))
        }
    }

    deserializer.deserialize_option(BigUintVisitor)
}
/// Deserialize a `BigUint` from Base64 URL encoded big endian bytes
Deserialize a `BigUint` from Base64 URL encoded big endian bytes
Deserialize a ` BigUint ` from Base64 URL encoded big endian bytes
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<BigUint>, D::Error>
where
    D: Deserializer<'de>,
{
    struct BigUintVisitor;
    impl<'de> de::Visitor<'de> for BigUintVisitor {
        type Value = Option<BigUint>;
        fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
            formatter.write_str("a Base64urlUInt string")
        }
        fn visit_none<E>(self) -> Result<Self::Value, E>
        where
            E: de::Error,
        {
            Ok(None)
        }
        fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
        where
            D: Deserializer<'de>,
        {
            deserializer.deserialize_str(self)
        }
        fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
        where
            E: de::Error,
        {
            let bytes = BASE64URL_NOPAD
                .decode(value.as_bytes())
                .map_err(E::custom)?;
            Ok(Some(BigUint::from_bytes_be(&bytes)))
        }
    }
    deserializer.deserialize_option(BigUintVisitor)
}
pub fn deserialize < ' de , D > ( deserializer : D ) -> Result < Option < BigUint > , D :: Error > where D : Deserializer < ' de > , { struct BigUintVisitor ; impl < ' de > de :: Visitor < ' de > for BigUintVisitor { type Value = Option < BigUint > ; fn expecting ( & self , formatter : & mut fmt :: Formatter < ' _ > ) -> fmt :: Result { formatter . write_str ( " " ) } fn visit_none < E > ( self ) -> Result < Self :: Value , E > where E : de :: Error , { Ok ( None ) } fn visit_some < D > ( self , deserializer : D ) -> Result < Self :: Value , D :: Error > where D : Deserializer < ' de > , { deserializer . deserialize_str ( self ) } fn visit_str < E > ( self , value : & str ) -> Result < Self :: Value , E > where E : de :: Error , { let bytes = BASE64URL_NOPAD . decode ( value . as_bytes ( ) ) . map_err ( E :: custom ) ? ; Ok ( Some ( BigUint :: from_bytes_be ( & bytes ) ) ) } } deserializer . deserialize_option ( BigUintVisitor ) }
Deserialize a `BigUint` from Base64 URL encoded big endian bytes
Deserialize a ` BigUint ` from Base64 URL encoded big endian bytes
deserializer
D
deserializer
D