# pyo3::PyObject - Rust
A commonly-used alias for `Py<PyAny>`.
Keywords: rust, rustlang, rust-lang, PyObject

# 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`.

## Implementations

### `impl PyObject` [src]

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

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,` [src]

#### `fn from(obj: &T) -> Self` [src]

Performs the conversion.

### `impl<T> From<Py<T>> for PyObject where
T: AsRef<PyAny>,` [src]

#### `fn from(other: Py<T>) -> Self` [src]

Performs the conversion.