[][src]Static numpy::npyffi::array::PY_ARRAY_API

pub static PY_ARRAY_API: PyArrayAPI

A global variable which stores a 'capsule' pointer to Numpy Array API.

You can acceess raw c APIs via this variable and its Deref implementation.

See PyArrayAPI for what methods you can use via this variable.

Example

use numpy::{PyArray, npyffi::types::NPY_SORTKIND, PY_ARRAY_API};
use pyo3::Python;
let gil = Python::acquire_gil();
let array = PyArray::from_slice(gil.python(), &[3, 2, 4]);
unsafe {
    PY_ARRAY_API.PyArray_Sort(array.as_array_ptr(), 0, NPY_SORTKIND::NPY_QUICKSORT);
}
assert_eq!(array.readonly().as_slice().unwrap(), &[2, 3, 4]);