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

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_instance(object: &PyAny) -> bool { ... }
fn is_exact_instance(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:

Associated Types

type Type

Type of objects to store in PyObject struct

type BaseType: PyTypeInfo + PyTypeObject

Base class

type Layout: PyLayout<Self>

Layout

type BaseLayout: PySizedLayout<Self::BaseType>

Layout of Basetype.

type Initializer: PyObjectInit<Self>

Initializer for layout

type AsRefTarget: PyNativeType

Utility type to make AsPyRef work

Loading content...

Associated Constants

const NAME: &'static str

Class name

const MODULE: Option<&'static str>

Module name, if any

const DESCRIPTION: &'static str

Class doc string

const FLAGS: usize

Type flags (ie PY_TYPE_FLAG_GC, PY_TYPE_FLAG_WEAKREF)

Loading content...

Required methods

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

PyTypeObject instance for this type.

Loading content...

Provided methods

fn is_instance(object: &PyAny) -> bool

Check if *mut ffi::PyObject is instance of this type

fn is_exact_instance(object: &PyAny) -> bool

Check if *mut ffi::PyObject is exact instance of this type

Loading content...

Implementors

impl PyTypeInfo for PyModule[src]

impl PyTypeInfo for PyAny[src]

impl PyTypeInfo for PyBool[src]

impl PyTypeInfo for PyByteArray[src]

impl PyTypeInfo for PyBytes[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 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...