get_required

Function get_required 

Source
pub fn get_required<T>(dict: &Bound<'_, PyDict>, key: &str) -> PyResult<T>
where T: for<'a, 'py> FromPyObject<'a, 'py>, for<'a, 'py> PyErr: From<<T as FromPyObject<'a, 'py>>::Error>,
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.