Is this realistically beneficial at all compared to just a map iterator that converts?

⚓ Rust    📅 2026-05-23    👤 surdeus    👁️ 1      

surdeus

let mut temp_vec = ManuallyDrop::new(iter.collect::<Vec<u32>>());
                        unsafe {
                            Vec::from_raw_parts(
                                temp_vec.as_mut_ptr() as *mut [u32; 3],
                                temp_vec.len() / 3,
                                temp_vec.capacity() / 3,
                            )
                        }

4 posts - 3 participants

Read full topic

🏷️ Rust_feed