Skip to main content

contextualize

Function contextualize 

Source
pub fn contextualize(context: &str, err: &dyn Display) -> String
Expand description

Format a contextualized error string.

Convenience function for call sites that have a non-String error and want to produce Err(String) with function-name context in one step:

serde_json::from_str(data)
    .map_err(|e| contextualize("json.parse", &e))?;