pub trait Sortable { type Item; fn sort_by_key_b(&mut self, func: Func) where Func: FnMut(&Self::Item) -> Key, Key: Ord; } impl Sortable for [Item] { type Item = Item; fn sort_by_key_b(&mut self, func: Func) where Func: FnMut(&Self::Item) -> Key, Key: Ord, { self.sort_by_key(func) } } impl Sortable for [Item; LENGTH] { type Item = Item; fn sort_by_key_b(&mut self, func: Func) where Func: FnMut(&Self::Item) -> Key, Key: Ord, { self.sort_by_key(func) } } impl Sortable for Vec { type Item = Item; fn sort_by_key_b(&mut self, func: Func) where Func: FnMut(&Self::Item) -> Key, Key: Ord, { self.sort_by_key(func) } }