Skip to main content

KeepFirstN

Trait KeepFirstN 

Source
pub trait KeepFirstN<T, F>
where F: Fn(&T, &T) -> Ordering,
{ // Required method fn keep_first_n<'async_trait>( self, n: usize, sorted_by: F, ) -> Pin<Box<dyn Future<Output = Iter<IntoIter<T>>> + Send + 'async_trait>> where Self: 'async_trait; }

Required Methods§

Source

fn keep_first_n<'async_trait>( self, n: usize, sorted_by: F, ) -> Pin<Box<dyn Future<Output = Iter<IntoIter<T>>> + Send + 'async_trait>>
where Self: 'async_trait,

Takes the largest N values according to the sorted function, returned in descending order (max first). Exhausts the stream.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<SInput, T, F> KeepFirstN<T, F> for SInput
where SInput: Stream<Item = T> + Send + Unpin, T: Clone + Send + Sync, F: Fn(&T, &T) -> Ordering + Send + Sync + 'static,