Trait pyo3::PyNativeType[][src]

pub unsafe trait PyNativeType: Sized {
    fn py(&self) -> Python<'_> { ... }
unsafe fn unchecked_downcast(obj: &PyAny) -> &Self { ... } }
Expand description

Types that are built into the Python interpreter.

PyO3 is designed in a way that all references to those types are bound to the GIL, which is why you can get a token from all references of those types.

Provided methods

Cast &PyAny to &Self without no type checking.

Safety

obj must have the same layout as *const ffi::PyObject and must be an instance of a type corresponding to Self.

Implementors