(self)
| 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)?; |
no test coverage detected