Function get_required_parsed

Source
pub fn get_required_parsed<T, F>(
    dict: &Bound<'_, PyDict>,
    key: &str,
    parser: F,
) -> PyResult<T>
where F: FnOnce(String) -> Result<T, String>,
Expand description

Helper function to get a required value, parse it with a closure, and handle parse errors.

§Returns

Returns the parsed value or a PyErr if the key is missing, extraction fails, or parsing fails.

§Errors

Returns PyErr if the key is missing, value extraction fails, or parsing fails.