use alloc::boxed::ThinBox; use core::mem::size_of; #[test] fn want_niche_optimization() { fn uses_niche() -> bool { size_of::<*const ()>() == size_of::>>() } trait Tr {} assert!(uses_niche::()); assert!(uses_niche::<[i32]>()); assert!(uses_niche::()); } #[test] fn want_thin() { fn is_thin() -> bool { size_of::<*const ()>() == size_of::>() } trait Tr {} assert!(is_thin::()); assert!(is_thin::<[i32]>()); assert!(is_thin::()); }