# pyo3::pyclass::PyClass - Rust
If `PyClass` is implemented for `T`, then we can use `T` in the Python world, via `PyCell`.
Keywords: rust, rustlang, rust-lang, PyClass

# Trait pyo3::pyclass::PyClass [−] [src]

    pub trait PyClass: PyTypeInfo<Layout = PyCell<Self>, AsRefTarget = PyCell<Self>> + Sized + PyClassSend + PyClassAlloc + PyMethods + PyProtoMethods {
        type Dict: PyClassDict;
        type WeakRef: PyClassWeakRef;
        type BaseNativeType: PyTypeInfo + PyNativeType;
    }

If `PyClass` is implemented for `T`, then we can use `T` in the Python world, via `PyCell`.

The `#[pyclass]` attribute automatically implements this trait for your Rust struct, so you don’t have to use this trait directly.

## Associated Types

### `type Dict: PyClassDict` [src]

Specify this class has `#[pyclass(dict)]` or not.

### `type WeakRef: PyClassWeakRef` [src]

Specify this class has `#[pyclass(weakref)]` or not.

### `type BaseNativeType: PyTypeInfo + PyNativeType` [src]

The closest native ancestor. This is `PyAny` by default, and when you declare `#[pyclass(extends=PyDict)]`, it’s `PyDict`.

Loading content...

## Implementors

Loading content...