(py: Python<'py>, array: *mut PyArrayObject)
| 174 | // These entry points will be used to access the shared borrow checking API from this extension: |
| 175 | |
| 176 | pub fn acquire<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<(), BorrowError> { |
| 177 | let shared = get_or_insert_shared(py).expect("Internal borrow checking API error"); |
| 178 | |
| 179 | let rc = unsafe { (shared.acquire)(shared.flags, array) }; |
| 180 | |
| 181 | match rc { |
| 182 | 0 => Ok(()), |
| 183 | -1 => Err(BorrowError::AlreadyBorrowed), |
| 184 | rc => panic!("Unexpected return code {rc} from borrow checking API"), |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | pub fn acquire_mut<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<(), BorrowError> { |
| 189 | let shared = get_or_insert_shared(py).expect("Internal borrow checking API error"); |
no test coverage detected