Rust binding of NumPy C-API
and more (see Cargo.toml)
Please see example directory for a complete example
```rust
extern crate cpython; extern crate numpy; extern crate ndarray;
use numpy::; use ndarray::; use cpython::{PyResult, Python, PyObject};
/* Pure rust-ndarray functions */
// immutable example
fn axpy(a: f64, x: ArrayViewD
// mutable example (no return)
fn mult(a: f64, mut x: ArrayViewMutD
/* rust-cpython wrappers (to be exposed) */
// wrapper of axpy
fn axpypy(py: Python, a: f64, x: PyArray, y: PyArray) -> PyResult
// wrapper of mult
fn multpy(py: Python, a: f64, x: PyArray) -> PyResult
/* Define module "rustext" */ pymoduleinitializer!(rustext, initrustext, PyInitrustext, |py, m| { m.add(py, "doc", "Rust extension for NumPy")?; m.add(py, "axpy", pyfn!(py, axpypy(a: f64, x: PyArray, y: PyArray)))?; m.add(py, "mult", pyfn!(py, mult_py(a: f64, x: PyArray)))?; Ok(()) }); ```
This project is in pre-alpha version. We need your feedback. Don't hesitate to open issue!
v0.2.1
IntoPyErr
, IntoPyResult
for error translationv0.2.0
IntoPyArray
, ToPyArray
PyArray
creation functions are changedv0.1.1
v0.1.0