Function to_dict_pyo3

Source
pub fn to_dict_pyo3<T>(py: Python<'_>, value: &T) -> PyResult<Py<PyDict>>
where T: Serialize,
Expand description

Convert a Rust type that implements Serialize to a Python dictionary.

ยงErrors

Returns an error if:

  • The Rust value cannot be serialized to JSON.
  • The JSON string cannot be parsed into a Python dictionary.
  • The Python json module fails to import or execute.