How to operate on 2 mutable slices of a Rust array?
问题 I have a function that needs to operate on two parts of a single array. The purpose is to be able to build an #[nostd] allocator that can return a variable slice of a bigger array to the caller and hang on to the remainder of the array for future allocations. Here's example code that fails: fn split<'a>(mut item: &'a mut [i32], place: usize) -> (&'a mut [i32], &'a mut [i32]) { (&mut item[0..place], &mut item[place..]) } fn main() { let mut mem: [i32; 2048] = [1; 2048]; let (mut array0, mut