Many GSL functions take a slice &[F] (with F being f32, f64), a stride, and a length (not always checked to be sound in the higher level bindings). What about having a trait such as
which could be implemented for various types (all that implement AsRef<[f64]> but maybe also (impl AsRef<[f64]>, usize) to specify a stride,...). The length would never be passed to the functions, restricting the slice would be the way to go.
Many GSL functions take a slice
&[F]
(withF
beingf32
,f64
), a stride, and a length (not always checked to be sound in the higher level bindings). What about having a trait such aswhich could be implemented for various types (all that implement
AsRef<[f64]>
but maybe also(impl AsRef<[f64]>, usize)
to specify a stride,...). The length would never be passed to the functions, restricting the slice would be the way to go.