pub fn filter_effect<T, Env, F, Eff>(
items: Vec<T>,
predicate: F,
) -> BoxedEffect<Vec<T>, AnalysisError, Env>Expand description
Filter a collection using an effectful predicate.
This combinator evaluates a predicate effect for each item and keeps
only those for which the predicate returns true.
§Arguments
items- The collection to filterpredicate- A function that produces an effect returningbool
§Returns
An effect that produces a vector of items that passed the predicate.
§Example
ⓘ
let paths = vec!["a.rs", "b.rs", "missing.rs"];
let effect = filter_effect(paths, |p| file_exists_effect(p.into()));
let existing = effect.run(&env).await?; // Only existing files