Skip to main content

PyClass

Trait PyClass 

Source
pub trait PyClass: PyTypeInfo + PyClassImpl {
    type Frozen: Frozen;

    const NAME: &'static str;
}
Expand description

Types that can be used as Python classes.

The #[pyclass] attribute implements this trait for your Rust struct - you shouldn’t implement this trait directly.

Required Associated Constants§

Source

const NAME: &'static str

Name of the class.

This can be set via #[pyclass(name = "...")], otherwise it defaults to the Rust type name.

Required Associated Types§

Source

type Frozen: Frozen

Whether the pyclass is frozen.

This can be enabled via #[pyclass(frozen)].

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl PyClass for Coroutine

Source§

const NAME: &str = "Coroutine"

Source§

type Frozen = False