deserialize_code

Function deserialize_code 

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

Custom deserializer for the ‘code’ field that handles both string and numeric values

This function allows deserializing the ‘code’ field from either a string or numeric value, converting numeric values to strings. This is useful when the API may return codes in different formats.

§Arguments

  • deserializer - The deserializer to use for reading the value

§Returns

A Result containing either an Option<String> with the code value or a deserialization error