Skip to main content

filter_compact

Function filter_compact 

Source
pub fn filter_compact<T, F>(data: &[T], predicate: F) -> Vec<T>
where T: Clone + Send + Sync, F: Fn(&T) -> bool + Sync,
Expand description

Stream compaction: collect elements satisfying predicate into a new vec.

Mimics GPU stream compaction (prefix-sum + scatter). The output preserves the relative order of passing elements.