Function calamine::deserialize_as_i64_or_string

source ·
pub fn deserialize_as_i64_or_string<'de, D>(
    deserializer: D
) -> Result<Result<i64, String>, D::Error>
where D: Deserializer<'de>,
Expand description

A helper function to deserialize cell values as i64, useful when cells may also contain invalid values (i.e. strings). It applies the [as_i64] method to the cell value, and returns Ok(Ok(value_as_i64)) if successful or Ok(Err(value_to_string)) if unsuccessful, therefore never failing. This function is intended to be used with Serde’s deserialize_with field attribute.