pub fn filter(
        &self,
        direction: DependencyDirection,
        mut callback: impl FnMut(PackageMetadata<'g>) -> bool,
    ) -> Self {
        let graph = self.graph;
        let included: IxBitSet = self
            .packages(direction)
            .filter_map(move |package| {
                let package_ix = package.package_ix();
                if callback(package) {
                    Some(package_ix)
                } else {
                    None
                }
            })
            .collect();
        Self::from_included(*graph, included)
    }
Returns a `PackageSet` on which a filter has been applied.

Filters out all values for which the callback returns false.

## Cycles

For packages within a dependency cycle, the callback will be called in non-dev order. When
the direction is forward, if package Foo has a dependency on Bar, and Bar has a cyclic
dev-dependency on Foo, then Foo is returned before Bar.
guppy/src/graph/resolve.rs