Trait pyo3::type_object::PyTypeInfo[][src]

pub unsafe trait PyTypeInfo: Sized {
    type Type;
    type BaseType: PyTypeInfo + PyTypeObject;
    type Layout: PyLayout<Self>;
    type BaseLayout: PySizedLayout<Self::BaseType>;
    type Initializer: PyObjectInit<Self>;
    type AsRefTarget: PyNativeType;

    const NAME: &'static str;
    const MODULE: Option<&'static str>;
    const DESCRIPTION: &'static str;
    const FLAGS: usize;

    fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject;

    fn is_type_of(object: &PyAny) -> bool { ... }
fn is_exact_type_of(object: &PyAny) -> bool { ... } }

Python type information. All Python native types(e.g., PyDict) and #[pyclass] structs implement this trait.

This trait is marked unsafe because:

  • specifying the incorrect layout can lead to memory errors
  • the return value of type_object must always point to the same PyTypeObject instance

Associated Types

type Type[src]

Type of objects to store in PyObject struct

type BaseType: PyTypeInfo + PyTypeObject[src]

Base class

type Layout: PyLayout<Self>[src]

Layout

type BaseLayout: PySizedLayout<Self::BaseType>[src]

Layout of Basetype.

type Initializer: PyObjectInit<Self>[src]

Initializer for layout

type AsRefTarget: PyNativeType[src]

Utility type to make Py::as_ref work

Loading content...

Associated Constants

const NAME: &'static str[src]

Class name

const MODULE: Option<&'static str>[src]

Module name, if any

const DESCRIPTION: &'static str[src]

Class doc string

const FLAGS: usize[src]

Type flags (ie PY_TYPE_FLAG_GC, PY_TYPE_FLAG_WEAKREF)

Loading content...

Required methods

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject[src]

PyTypeObject instance for this type.

Loading content...

Provided methods

fn is_type_of(object: &PyAny) -> bool[src]

Checks if object is an instance of this type or a subclass of this type.

fn is_exact_type_of(object: &PyAny) -> bool[src]

Checks if object is an instance of this type.

Loading content...

Implementors

impl PyTypeInfo for CancelledError[src]

impl PyTypeInfo for IncompleteReadError[src]

impl PyTypeInfo for InvalidStateError[src]

impl PyTypeInfo for LimitOverrunError[src]

impl PyTypeInfo for QueueEmpty[src]

impl PyTypeInfo for QueueFull[src]

impl PyTypeInfo for TimeoutError[src]

impl PyTypeInfo for gaierror[src]

impl PyTypeInfo for herror[src]

impl PyTypeInfo for timeout[src]

impl PyTypeInfo for PyArithmeticError[src]

impl PyTypeInfo for PyAssertionError[src]

impl PyTypeInfo for PyAttributeError[src]

impl PyTypeInfo for PyBaseException[src]

impl PyTypeInfo for PyBlockingIOError[src]

impl PyTypeInfo for PyBrokenPipeError[src]

impl PyTypeInfo for PyBufferError[src]

impl PyTypeInfo for PyChildProcessError[src]

impl PyTypeInfo for PyConnectionAbortedError[src]

impl PyTypeInfo for PyConnectionError[src]

impl PyTypeInfo for PyConnectionRefusedError[src]

impl PyTypeInfo for PyConnectionResetError[src]

impl PyTypeInfo for PyEOFError[src]

impl PyTypeInfo for PyEnvironmentError[src]

impl PyTypeInfo for PyException[src]

impl PyTypeInfo for PyFileExistsError[src]

impl PyTypeInfo for PyFileNotFoundError[src]

impl PyTypeInfo for PyFloatingPointError[src]

impl PyTypeInfo for PyGeneratorExit[src]

impl PyTypeInfo for PyIOError[src]

impl PyTypeInfo for PyImportError[src]

impl PyTypeInfo for PyIndexError[src]

impl PyTypeInfo for PyInterruptedError[src]

impl PyTypeInfo for PyIsADirectoryError[src]

impl PyTypeInfo for PyKeyError[src]

impl PyTypeInfo for PyKeyboardInterrupt[src]

impl PyTypeInfo for PyLookupError[src]

impl PyTypeInfo for PyMemoryError[src]

impl PyTypeInfo for PyModuleNotFoundError[src]

impl PyTypeInfo for PyNameError[src]

impl PyTypeInfo for PyNotADirectoryError[src]

impl PyTypeInfo for PyNotImplementedError[src]

impl PyTypeInfo for PyOSError[src]

impl PyTypeInfo for PyOverflowError[src]

impl PyTypeInfo for PyPermissionError[src]

impl PyTypeInfo for PyProcessLookupError[src]

impl PyTypeInfo for PyRecursionError[src]

impl PyTypeInfo for PyReferenceError[src]

impl PyTypeInfo for PyRuntimeError[src]

impl PyTypeInfo for PyStopAsyncIteration[src]

impl PyTypeInfo for PyStopIteration[src]

impl PyTypeInfo for PySyntaxError[src]

impl PyTypeInfo for PySystemError[src]

impl PyTypeInfo for PySystemExit[src]

impl PyTypeInfo for PyTimeoutError[src]

impl PyTypeInfo for PyTypeError[src]

impl PyTypeInfo for PyUnboundLocalError[src]

impl PyTypeInfo for PyUnicodeDecodeError[src]

impl PyTypeInfo for PyUnicodeEncodeError[src]

impl PyTypeInfo for PyUnicodeError[src]

impl PyTypeInfo for PyUnicodeTranslateError[src]

impl PyTypeInfo for PyValueError[src]

impl PyTypeInfo for PyZeroDivisionError[src]

impl PyTypeInfo for PanicException[src]

impl PyTypeInfo for PyAny[src]

impl PyTypeInfo for PyModule[src]

impl PyTypeInfo for PyBool[src]

impl PyTypeInfo for PyByteArray[src]

impl PyTypeInfo for PyBytes[src]

impl PyTypeInfo for PyCFunction[src]

impl PyTypeInfo for PyComplex[src]

impl PyTypeInfo for PyDate[src]

impl PyTypeInfo for PyDateTime[src]

impl PyTypeInfo for PyDelta[src]

impl PyTypeInfo for PyDict[src]

impl PyTypeInfo for PyFloat[src]

impl PyTypeInfo for PyFrozenSet[src]

impl PyTypeInfo for PyFunction[src]

impl PyTypeInfo for PyList[src]

impl PyTypeInfo for PyLong[src]

impl PyTypeInfo for PySet[src]

impl PyTypeInfo for PySlice[src]

impl PyTypeInfo for PyString[src]

impl PyTypeInfo for PyTime[src]

impl PyTypeInfo for PyTuple[src]

impl PyTypeInfo for PyType[src]

impl PyTypeInfo for PyTzInfo[src]

Loading content...