Skip to main content

deserialize_optional_decimal_token

Function deserialize_optional_decimal_token 

Source
pub fn deserialize_optional_decimal_token<'de, D>(
    deserializer: D,
) -> Result<Option<Decimal>, D::Error>
where D: Deserializer<'de>,
Expand description

Deserializes an Option<Decimal> from the source text of a JSON number, numeric string, or null.

Null and empty strings read as None; other tokens parse as in deserialize_decimal_token. Add #[serde(default)] to accept a missing field.

§Errors

Returns an error if a token other than null or an empty string is not a decimal or is outside Decimal’s range.