use std::cmp::Ordering;
use itertools::Itertools;
extern crate alloc;
mod extrema_set;
pub trait FallibleItertools: Itertools {
fn fallible_min_set_by<F, E>(self, mut compare: F) -> Result<Vec<Self::Item>, E>
where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Result<Ordering, E>,
{
extrema_set::min_set_impl(self, |_| (), |x, y, (), ()| compare(x, y))
}
fn fallible_max_set_by<F, E>(self, mut compare: F) -> Result<Vec<Self::Item>, E>
where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Result<Ordering, E>,
{
extrema_set::max_set_impl(self, |_| (), |x, y, (), ()| compare(x, y))
}
}
impl<T> FallibleItertools for T where T: Itertools {}