[−][src]Trait pyo3::type_object::PyTypeInfo
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
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
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)
Required methods
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
PyTypeObject instance for this type.
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