Before I write this myself ... Anyone know of a straightforward way in rust to split a slice by column? Say I've got a 640x480 (columns x rows) matrix that is stored in a &[u8; 640*480] and I want two slices that are &[u8; 320*480] , so split at column = 320, and half of each row is visible in each child slice, if that makes sense.
Seems like ordinary split and the predicate methods would not work for this. My thought is to write a slice wrapper similar to the wrapping crate.
Rust's built-in slice and array types can only represent data that is contiguous in memory, so you will indeed need to use some sort of wrapper or "view" type instead. (For example, in ndarray, the slice method returns an ArrayView rather than an &[T] slice.)
Thanks very much for the links and clarification about slice. I should have mentioned I need this for embedded no_std code with no allocator. It sounds like writing a custom “view” wrapper is the way to go.