pub trait DerefToPyAny { }
Expand description
Python objects that have a base type.
This marks types that can be upcast into a PyAny
and used in its place.
This essentially includes every Python object except PyAny
itself.
This is used to provide the Deref<Target = Bound<'_, PyAny>>
implementations for Bound<'_, T>
.
Users should not need to implement this trait directly. It’s implementation
is provided by the #[pyclass]
attribute.
§Note
This is needed because the compiler currently tries to figure out all the
types in a deref-chain before starting to look for applicable method calls.
So we need to prevent Bound<'_, PyAny
dereferencing to
itself in order to avoid running into the recursion limit. This trait is
used to exclude this from our blanket implementation. See this Rust
issue for more details. If the compiler limitation gets resolved, this
trait will be removed.