pub trait FeatureFilter<'g> {
// Required method
fn accept(
&mut self,
graph: &FeatureGraph<'g>,
feature_id: FeatureId<'g>,
) -> bool;
}
Expand description
Trait representing whether a feature within a package should be selected.
This is conceptually similar to passing --features
or other similar command-line options to
Cargo.
Most uses will involve using one of the predefined filters: all_filter
, default_filter
, or
none_filter
. A customized filter can be provided either through filter_fn
or by implementing
this trait.
Required Methods§
sourcefn accept(
&mut self,
graph: &FeatureGraph<'g>,
feature_id: FeatureId<'g>,
) -> bool
fn accept( &mut self, graph: &FeatureGraph<'g>, feature_id: FeatureId<'g>, ) -> bool
Returns true if this feature ID should be selected in the graph.
Returning false does not prevent this feature ID from being included if it’s reachable through other means.
In general, accept
should return true if feature_id.is_base()
is true.
The feature ID is guaranteed to be in this graph, so it is OK to panic if it isn’t found.