Type Definition pyo3::PyObject[][src]

type PyObject = Py<PyAny>;

A commonly-used alias for Py<PyAny>.

This is an owned reference a Python object without any type information. This value can also be safely sent between threads.

See the documentation for Py.


impl PyObject[src]

pub fn cast_as<'p, D>(
    &'p self,
    py: Python<'p>
) -> Result<&'p D, PyDowncastError<'_>> where
    D: PyTryFrom<'p>, 

Casts the PyObject to a concrete Python object type.

This can cast only to native Python types, not types implemented in Rust. For a more flexible alternative, see Py::extract.

Trait Implementations

impl<T> From<&'_ T> for PyObject where
    T: AsPyPointer + PyNativeType

impl<T> From<Py<T>> for PyObject where
    T: AsRef<PyAny>,