jlrs-ndarray 0.1.0

jlrs is a library built around bindings to the Julia C API that enables Julia code to be called from Rust. jlrs can move many kinds of data from Rust to Julia and back, share n-dimensional numerical arrays between languages, call arbitrary functions, and load code from arbitrary Julia source files. jlrs currently supports Linux and Windows.
docs.rs failed to build jlrs-ndarray-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: jlrs-ndarray-0.3.0

Borrow data from Julia arrays as ndarray's ArrayView and ArrayViewMut.

This crate defines a single trait, NdArray, that provides methods that return an immutable or a mutable view of the array data and is implemented by Array and TypedArray from jlrs.

Example:

use jlrs::prelude::*;
use jlrs_ndarray::NdArray;

fn main() {
    let mut julia = unsafe { Julia::init(16).unwrap() };
    julia.dynamic_frame(|_global, frame| {
        let mut data = vec![1usize, 2, 3, 4, 5, 6];
        let slice = &mut data.as_mut_slice();
        let borrowed = Value::borrow_array(frame, slice, (3, 2))?;

        let _array = borrowed.cast::<TypedArray<usize>>()?.array_view(frame)?;

        Ok(())
    }).unwrap();
}