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

Method upcast

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

Source from the content-addressed store, hash-verified

2242 }
2243 #[inline]
2244 pub fn upcast<U: PyPayload + StaticType>(self) -> PyRef<U>
2245 where
2246 T: StaticType,
2247 {
2248 debug_assert!(T::static_type().is_subtype(U::static_type()));
2249 let obj: PyObjectRef = self.into();
2250 match obj.downcast::<U>() {
2251 Ok(upcast_ref) => upcast_ref,
2252 Err(_) => unsafe { core::hint::unreachable_unchecked() },
2253 }
2254 }
2255}
2256
2257impl<T: crate::class::PySubclass> Py<T> {

Callers 15

termios_errorFunction · 0.80
load_verify_locationsMethod · 0.80
load_dh_paramsMethod · 0.80
load_cert_chainMethod · 0.80
shutdownMethod · 0.80
do_handshakeMethod · 0.80
writeMethod · 0.80
readMethod · 0.80
new_ssl_errorFunction · 0.80
convert_openssl_errorFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected