MCPcopy Index your code
hub / github.com/RustPython/RustPython / payload_if_subclass

Method payload_if_subclass

crates/vm/src/object/core.rs:1477–1484  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1475 #[deprecated(note = "use downcast_ref instead")]
1476 #[inline(always)]
1477 pub fn payload_if_subclass<T: crate::PyPayload>(&self, vm: &VirtualMachine) -> Option<&T> {
1478 if self.class().fast_issubclass(T::class(&vm.ctx)) {
1479 #[allow(deprecated)]
1480 self.payload()
1481 } else {
1482 None
1483 }
1484 }
1485
1486 #[inline]
1487 pub(crate) fn typeid(&self) -> TypeId {

Callers

nothing calls this directly

Calls 3

fast_issubclassMethod · 0.80
payloadMethod · 0.80
classMethod · 0.45

Tested by

no test coverage detected