Function get_required

Source
pub fn get_required<T>(dict: &Bound<'_, PyDict>, key: &str) -> PyResult<T>
where T: for<'py> FromPyObject<'py>,
Expand description

Helper function to get a required value from a Python dictionary and extract it.

§Returns

Returns the extracted value or a PyErr if the key is missing or extraction fails.

§Errors

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