(&'a self, py: Python)
| 75 | |
| 76 | #[inline] |
| 77 | pub fn as_slice<'a>(&'a self, py: Python) -> &'a [PyObject] { |
| 78 | // This is safe because PyObject has the same memory layout as *mut ffi::PyObject, |
| 79 | // and because tuples are immutable. |
| 80 | // (We don't even need a Python token, thanks to immutability) |
| 81 | unsafe { |
| 82 | let ptr = self.0.as_ptr() as *mut ffi::PyTupleObject; |
| 83 | PyObject::borrow_from_owned_ptr_slice(slice::from_raw_parts( |
| 84 | (*ptr).ob_item.as_ptr(), |
| 85 | self.len(py), |
| 86 | )) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | #[inline] |
| 91 | pub fn iter(&self, py: Python) -> slice::Iter<PyObject> { |
no test coverage detected