Skip to main content

hashmap_from_pyobject_pyo3

Function hashmap_from_pyobject_pyo3 

Source
pub fn hashmap_from_pyobject_pyo3<K, V>(
    py: Python<'_>,
    value: &Bound<'_, PyAny>,
) -> PyResult<HashMap<K, V>>
where K: for<'py> FromPyObjectOwned<'py> + DeserializeOwned + Eq + Hash, V: for<'py> FromPyObjectOwned<'py> + DeserializeOwned, HashMap<K, V>: DeserializeOwned,
Expand description

Convert a Python mapping to a HashMap using typed PyO3 objects when possible.

Falls back to the generic JSON bridge when the input is not a Python dict. Individual dict keys and values first try typed PyO3 extraction, then JSON/Serde extraction.

ยงErrors

Returns an error if the Python object cannot be converted to the requested map type.