deserialize_vip_level

Function deserialize_vip_level 

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

Deserializes an OKX VIP level string into OKXVipLevel.

OKX returns VIP levels in multiple formats:

  • “VIP0”, “VIP1”, …, “VIP9” (VIP tier format)
  • “Lv0”, “Lv1”, …, “Lv9” (Level format)
  • “0”, “1”, …, “9” (bare numeric)
  • “” (empty string, defaults to VIP0)

This function handles all formats by stripping any prefix and parsing the numeric value.

§Errors

Returns an error if the string cannot be parsed into a valid VIP level.