# pyo3::PyNativeType - Rust
Types that are built into the Python interpreter.
Keywords: rust, rustlang, rust-lang, PyNativeType

# Trait pyo3::PyNativeType [−] [src]

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

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

### `fn py(&self) -> Python<'_>` [src]

### `unsafe fn unchecked_downcast(obj: &PyAny) -> &Self` [src]

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

Loading content...

## Implementors

### `impl PyNativeType for CancelledError` [src]

### `impl PyNativeType for IncompleteReadError` [src]

### `impl PyNativeType for InvalidStateError` [src]

### `impl PyNativeType for LimitOverrunError` [src]

### `impl PyNativeType for QueueEmpty` [src]

### `impl PyNativeType for QueueFull` [src]

### `impl PyNativeType for TimeoutError` [src]

### `impl PyNativeType for gaierror` [src]

### `impl PyNativeType for herror` [src]

### `impl PyNativeType for timeout` [src]

### `impl PyNativeType for PyArithmeticError` [src]

### `impl PyNativeType for PyAssertionError` [src]

### `impl PyNativeType for PyAttributeError` [src]

### `impl PyNativeType for PyBaseException` [src]

### `impl PyNativeType for PyBlockingIOError` [src]

### `impl PyNativeType for PyBrokenPipeError` [src]

### `impl PyNativeType for PyBufferError` [src]

### `impl PyNativeType for PyChildProcessError` [src]

### `impl PyNativeType for PyConnectionAbortedError` [src]

### `impl PyNativeType for PyConnectionError` [src]

### `impl PyNativeType for PyConnectionRefusedError` [src]

### `impl PyNativeType for PyConnectionResetError` [src]

### `impl PyNativeType for PyEOFError` [src]

### `impl PyNativeType for PyEnvironmentError` [src]

### `impl PyNativeType for PyException` [src]

### `impl PyNativeType for PyFileExistsError` [src]

### `impl PyNativeType for PyFileNotFoundError` [src]

### `impl PyNativeType for PyFloatingPointError` [src]

### `impl PyNativeType for PyGeneratorExit` [src]

### `impl PyNativeType for PyIOError` [src]

### `impl PyNativeType for PyImportError` [src]

### `impl PyNativeType for PyIndexError` [src]

### `impl PyNativeType for PyInterruptedError` [src]

### `impl PyNativeType for PyIsADirectoryError` [src]

### `impl PyNativeType for PyKeyError` [src]

### `impl PyNativeType for PyKeyboardInterrupt` [src]

### `impl PyNativeType for PyLookupError` [src]

### `impl PyNativeType for PyMemoryError` [src]

### `impl PyNativeType for PyModuleNotFoundError` [src]

### `impl PyNativeType for PyNameError` [src]

### `impl PyNativeType for PyNotADirectoryError` [src]

### `impl PyNativeType for PyNotImplementedError` [src]

### `impl PyNativeType for PyOSError` [src]

### `impl PyNativeType for PyOverflowError` [src]

### `impl PyNativeType for PyPermissionError` [src]

### `impl PyNativeType for PyProcessLookupError` [src]

### `impl PyNativeType for PyRecursionError` [src]

### `impl PyNativeType for PyReferenceError` [src]

### `impl PyNativeType for PyRuntimeError` [src]

### `impl PyNativeType for PyStopAsyncIteration` [src]

### `impl PyNativeType for PyStopIteration` [src]

### `impl PyNativeType for PySyntaxError` [src]

### `impl PyNativeType for PySystemError` [src]

### `impl PyNativeType for PySystemExit` [src]

### `impl PyNativeType for PyTimeoutError` [src]

### `impl PyNativeType for PyTypeError` [src]

### `impl PyNativeType for PyUnboundLocalError` [src]

### `impl PyNativeType for PyUnicodeDecodeError` [src]

### `impl PyNativeType for PyUnicodeEncodeError` [src]

### `impl PyNativeType for PyUnicodeError` [src]

### `impl PyNativeType for PyUnicodeTranslateError` [src]

### `impl PyNativeType for PyValueError` [src]

### `impl PyNativeType for PyZeroDivisionError` [src]

### `impl PyNativeType for PanicException` [src]

### `impl PyNativeType for PyAny` [src]

### `impl PyNativeType for PyModule` [src]

### `impl PyNativeType for PyBool` [src]

### `impl PyNativeType for PyByteArray` [src]

### `impl PyNativeType for PyBytes` [src]

### `impl PyNativeType for PyCFunction` [src]

### `impl PyNativeType for PyComplex` [src]

### `impl PyNativeType for PyDate` [src]

### `impl PyNativeType for PyDateTime` [src]

### `impl PyNativeType for PyDelta` [src]

### `impl PyNativeType for PyDict` [src]

### `impl PyNativeType for PyFloat` [src]

### `impl PyNativeType for PyFrozenSet` [src]

### `impl PyNativeType for PyFunction` [src]

### `impl PyNativeType for PyIterator` [src]

### `impl PyNativeType for PyList` [src]

### `impl PyNativeType for PyLong` [src]

### `impl PyNativeType for PySequence` [src]

### `impl PyNativeType for PySet` [src]

### `impl PyNativeType for PySlice` [src]

### `impl PyNativeType for PyString` [src]

### `impl PyNativeType for PyTime` [src]

### `impl PyNativeType for PyTuple` [src]

### `impl PyNativeType for PyType` [src]

### `impl PyNativeType for PyTzInfo` [src]

### `impl<T: PyClass> PyNativeType for PyCell<T>` [src]

Loading content...