Open
Description
I'm currently trying to write a function that can take either an owned array or a view. I'm currently relying on this stackoverflow post to do something like:
use ndarray::{ArrayBase, RawData, s, array, Ix1};
fn do_something_with_array<S>(a: &ArrayBase<S, Ix1>) where S: RawData{
}
fn main () {
let a = array![1, 2, 3];
do_something_with_array(&a);
let slc = a.slice(s![1..3]);
do_something_with_array(&slc);
}
I'm not sure if this is the best way though (certainly having to include a type parameter in the function definition seems clunky), so it would be good to get clarification and add a section to the docs explaining how to write these functions.