Skip to main content

from_pyobject_pyo3

Function from_pyobject_pyo3 

Source
pub fn from_pyobject_pyo3<T>(
    py: Python<'_>,
    value: &Bound<'_, PyAny>,
) -> Result<T, PyErr>
Expand description

Convert a Python object to a Rust type that implements DeserializeOwned.

ยงErrors

Returns an error if:

  • The Python object cannot be serialized to JSON.
  • The JSON string cannot be deserialized to type T.
  • The Python json module fails to import or execute.