mod private
{
use core ::cmp ::Ordering;
#[ cfg( feature = "determinism" ) ]
extern crate alloc;
#[ cfg( feature = "determinism" ) ]
use alloc ::vec ::IntoIter;
#[ cfg( feature = "determinism" ) ]
use ::itertools ::Itertools;
#[ sealed ::sealed ]
pub trait IfDeterminismIteratorExt: Iterator
{
#[ cfg( feature = "determinism" ) ]
#[ inline( always ) ]
fn if_determinism_then_sort( self ) -> IntoIter< Self ::Item >
where
Self: Sized,
Self ::Item: Ord,
{
self.sorted()
}
#[ cfg( not( feature = "determinism" ) ) ]
#[ inline( always ) ]
fn if_determinism_then_sort( self ) -> Self
where
Self: Sized,
Self ::Item: Ord,
{
self
}
#[ cfg( feature = "determinism" ) ]
#[ inline( always ) ]
fn if_determinism_then_sort_by< F >( self, cmp: F ) -> IntoIter< Self ::Item >
where
Self: Sized,
F: FnMut( &Self ::Item, &Self ::Item ) -> Ordering,
{
self.sorted_by( cmp )
}
#[ cfg( not( feature = "determinism" ) ) ]
#[ inline( always ) ]
fn if_determinism_then_sort_by< F >( self, _: F ) -> Self
where
Self: Sized,
F: FnMut( &Self ::Item, &Self ::Item ) -> Ordering,
{
self
}
}
#[ sealed ::sealed ]
impl< T: ?Sized > IfDeterminismIteratorExt for T
where T: Iterator
{
}
}
crate ::mod_interface!
{
prelude use IfDeterminismIteratorExt;
}