pub trait PySubclass: PyPayload {
type Base: PyPayload;
// Required method
fn as_base(&self) -> &Self::Base;
}Expand description
Trait for Python subclasses that can provide a reference to their base type.
This trait is automatically implemented by the #[pyclass] macro when
base = SomeType is specified. It provides safe reference access to the
base type’s payload.
For subclasses with #[repr(transparent)]
which enables ownership transfer via into_base().
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".