pub unsafe fn extract_pyclass_ref_trusted<'a, 'holder, T: PyClass>(
obj: Borrowed<'a, '_, PyAny>,
holder: &'holder mut Option<PyClassGuard<'a, T>>,
) -> PyResult<&'holder T>Expand description
Trusted variant of extract_pyclass_ref: performs an unchecked cast for
extension-type slot receivers where CPython guarantees the receiver type.
This is valid when called from generated slot wrappers installed on a specific extension type, because CPython’s slot dispatch contract ensures the receiver is an instance of that type (or a compatible subtype) before invoking the slot.
§Safety
The caller must ensure that obj is an instance of T. This invariant is
upheld by CPython when dispatching through type slots.