Storage type that is array and slice agnostic?

I am currently writing a small matrix library and I want to declare functions that work with slices and borrowed matrices. Currently I am stuck at always declaring the parameter as a slice. Can I somehow declare a Matrix as Matrix<f64,U3,U3,T> where T is …

Such that T works for both matrices and slices?


Yes, this is possible. The T should be a storage:

fn do_something<T>(m: &Matrix<f64, U3, U3, T>) 
where T: Storage<f64, U3, U3> { ... }

If you need to be able to modify the matrix, you need T: StorageMut<f64, U3, U3> instead.

Thank you for your quick reply!