Skip to main content

get_required_parsed

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

Extracts and parses a required value from a Python dictionary.

§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.