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

Method downcast

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

Source from the content-addressed store, hash-verified

1265 /// another downcast can be attempted without unnecessary cloning.
1266 #[inline(always)]
1267 pub fn downcast<T: PyPayload>(self) -> Result<PyRef<T>, Self> {
1268 if self.downcastable::<T>() {
1269 Ok(unsafe { self.downcast_unchecked() })
1270 } else {
1271 Err(self)
1272 }
1273 }
1274
1275 pub fn try_downcast<T: PyPayload>(self, vm: &VirtualMachine) -> PyResult<PyRef<T>> {
1276 T::try_downcast_from(&self, vm)?;

Callers 15

get_pipFunction · 0.80
convert_openssl_errorFunction · 0.80
extract_addressMethod · 0.80
ioctlMethod · 0.80
resultMethod · 0.80
set_exceptionMethod · 0.80
remove_done_callbackMethod · 0.80
_callbacksMethod · 0.80
get_future_repr_infoFunction · 0.80
get_task_repr_infoFunction · 0.80
throwMethod · 0.80
task_step_implFunction · 0.80

Calls 2

downcast_uncheckedMethod · 0.80
ErrClass · 0.50

Tested by

no test coverage detected