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

Method downcast_unchecked

crates/vm/src/object/core.rs:1285–1292  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1283 /// T must be the exact payload type
1284 #[inline(always)]
1285 pub unsafe fn downcast_unchecked<T>(self) -> PyRef<T> {
1286 // PyRef::from_obj_unchecked(self)
1287 // manual impl to avoid assertion
1288 let obj = ManuallyDrop::new(self);
1289 PyRef {
1290 ptr: obj.ptr.cast(),
1291 }
1292 }
1293
1294 // ideally we'd be able to define these in pyobject.rs, but method visibility rules are weird
1295

Callers 4

try_from_objectMethod · 0.80
try_from_objectMethod · 0.80
downcastMethod · 0.80
try_downcastMethod · 0.80

Calls 2

newFunction · 0.85
castMethod · 0.45

Tested by

no test coverage detected