Closed sanbox-irl closed 3 years ago
Hiya!
The recent changes in the last commit allowed for some type simplification as a library maker.
// this COMPILES ON MASTER right now, but NOT on `0.5.6`. fn test<T>(input: &mut T) where T: Copy + Into<MintVec3> + From<MintVec3>, { let as_mint = (*input).into(); let mut as_vec3: [f32; 3] = as_mint.into(); let changed = mutate_vec3(&mut as_vec3); if changed { let as_mint: MintVec3 = as_vec3.into(); *input = as_mint.into(); } } // this compiles on both, but is ugly fn test3<T>(input: &mut T) where T: Copy + Into<MintVec3>, MintVec3: Into<T> + Into<[f32; 3]>, { let as_mint = (*input).into(); let mut as_vec3: [f32; 3] = as_mint.into(); let changed = mutate_vec3(&mut as_vec3); if changed { let as_mint: MintVec3 = as_vec3.into(); *input = as_mint.into(); } } fn mutate_vec3(input: &mut [f32; 3]) -> bool { todo!() }
Done!
Hiya!
The recent changes in the last commit allowed for some type simplification as a library maker.