Trait pyo3::PyNativeType
source · pub unsafe trait PyNativeType: Sized {
// Provided methods
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.
Safety
This trait must only be implemented for types which cannot be accessed without the GIL.
Provided Methods§
sourceunsafe fn unchecked_downcast(obj: &PyAny) -> &Self
unsafe fn unchecked_downcast(obj: &PyAny) -> &Self
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§
impl PyNativeType for CancelledError
impl PyNativeType for IncompleteReadError
impl PyNativeType for InvalidStateError
impl PyNativeType for LimitOverrunError
impl PyNativeType for QueueEmpty
impl PyNativeType for QueueFull
impl PyNativeType for TimeoutError
impl PyNativeType for gaierror
impl PyNativeType for herror
impl PyNativeType for timeout
impl PyNativeType for PyArithmeticError
impl PyNativeType for PyAssertionError
impl PyNativeType for PyAttributeError
impl PyNativeType for PyBaseException
impl PyNativeType for PyBlockingIOError
impl PyNativeType for PyBrokenPipeError
impl PyNativeType for PyBufferError
impl PyNativeType for PyBytesWarning
impl PyNativeType for PyChildProcessError
impl PyNativeType for PyConnectionAbortedError
impl PyNativeType for PyConnectionError
impl PyNativeType for PyConnectionRefusedError
impl PyNativeType for PyConnectionResetError
impl PyNativeType for PyDeprecationWarning
impl PyNativeType for PyEOFError
impl PyNativeType for PyEncodingWarning
impl PyNativeType for PyEnvironmentError
impl PyNativeType for PyException
impl PyNativeType for PyFileExistsError
impl PyNativeType for PyFileNotFoundError
impl PyNativeType for PyFloatingPointError
impl PyNativeType for PyFutureWarning
impl PyNativeType for PyGeneratorExit
impl PyNativeType for PyIOError
impl PyNativeType for PyImportError
impl PyNativeType for PyImportWarning
impl PyNativeType for PyIndexError
impl PyNativeType for PyInterruptedError
impl PyNativeType for PyIsADirectoryError
impl PyNativeType for PyKeyError
impl PyNativeType for PyKeyboardInterrupt
impl PyNativeType for PyLookupError
impl PyNativeType for PyMemoryError
impl PyNativeType for PyModuleNotFoundError
impl PyNativeType for PyNameError
impl PyNativeType for PyNotADirectoryError
impl PyNativeType for PyNotImplementedError
impl PyNativeType for PyOSError
impl PyNativeType for PyOverflowError
impl PyNativeType for PyPendingDeprecationWarning
impl PyNativeType for PyPermissionError
impl PyNativeType for PyProcessLookupError
impl PyNativeType for PyRecursionError
impl PyNativeType for PyReferenceError
impl PyNativeType for PyResourceWarning
impl PyNativeType for PyRuntimeError
impl PyNativeType for PyRuntimeWarning
impl PyNativeType for PyStopAsyncIteration
impl PyNativeType for PyStopIteration
impl PyNativeType for PySyntaxError
impl PyNativeType for PySyntaxWarning
impl PyNativeType for PySystemError
impl PyNativeType for PySystemExit
impl PyNativeType for PyTimeoutError
impl PyNativeType for PyTypeError
impl PyNativeType for PyUnboundLocalError
impl PyNativeType for PyUnicodeDecodeError
impl PyNativeType for PyUnicodeEncodeError
impl PyNativeType for PyUnicodeError
impl PyNativeType for PyUnicodeTranslateError
impl PyNativeType for PyUnicodeWarning
impl PyNativeType for PyUserWarning
impl PyNativeType for PyValueError
impl PyNativeType for PyWarning
impl PyNativeType for PyZeroDivisionError
impl PyNativeType for PanicException
impl PyNativeType for PyAny
impl PyNativeType for PyModule
impl PyNativeType for PyBool
impl PyNativeType for PyByteArray
impl PyNativeType for PyBytes
impl PyNativeType for PyCFunction
impl PyNativeType for PyCapsule
impl PyNativeType for PyCode
Available on non-
Py_LIMITED_API
only.impl PyNativeType for PyComplex
impl PyNativeType for PyDate
Available on non-
Py_LIMITED_API
only.impl PyNativeType for PyDateTime
Available on non-
Py_LIMITED_API
only.impl PyNativeType for PyDelta
Available on non-
Py_LIMITED_API
only.impl PyNativeType for PyDict
impl PyNativeType for PyDictItems
impl PyNativeType for PyDictKeys
impl PyNativeType for PyDictValues
impl PyNativeType for PyFloat
impl PyNativeType for PyFrame
Available on non-
Py_LIMITED_API
and non-PyPy
only.impl PyNativeType for PyFrozenSet
impl PyNativeType for PyFunction
impl PyNativeType for PyIterator
impl PyNativeType for PyList
impl PyNativeType for PyLong
impl PyNativeType for PyMapping
impl PyNativeType for PySequence
impl PyNativeType for PySet
impl PyNativeType for PySlice
impl PyNativeType for PyString
impl PyNativeType for PySuper
Available on non-
PyPy
only.impl PyNativeType for PyTime
Available on non-
Py_LIMITED_API
only.impl PyNativeType for PyTraceback
impl PyNativeType for PyTuple
impl PyNativeType for PyType
impl PyNativeType for PyTzInfo
Available on non-
Py_LIMITED_API
only.