(&self, item: PyObjectRef, vm: &VirtualMachine)
| 403 | |
| 404 | #[pymethod] |
| 405 | fn count(&self, item: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> { |
| 406 | if let Ok(int) = item.clone().downcast::<PyInt>() { |
| 407 | let count = if self.index_of(int.as_bigint()).is_some() { |
| 408 | 1 |
| 409 | } else { |
| 410 | 0 |
| 411 | }; |
| 412 | Ok(count) |
| 413 | } else { |
| 414 | // Dealing with classes who might compare equal with ints in their |
| 415 | // __eq__, slow search. |
| 416 | iter_search(self.as_object(), &item, SearchType::Count, vm) |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | impl PyRange { |
nothing calls this directly
no test coverage detected