fn retain_prefix( output: &mut [EnemyIdx], count: usize, keep: impl FnMut(EnemyIdx) -> bool, ) -> usize