pub fn search_last_by_key<F, K, const TW: usize, const TH: usize>( segments: &[PixelSegment<TW, TH>], key: K, f: F, ) -> Result<usize, usize>where F: FnMut(&PixelSegment<TW, TH>) -> K, K: Ord,