Trait guppy::graph::feature::FeatureFilter

source ·
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§

source

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.

Trait Implementations§

source§

impl<'g, 'a> FeatureFilter<'g> for &'a mut dyn FeatureFilter<'g>

source§

fn accept( &mut self, graph: &FeatureGraph<'g>, feature_id: FeatureId<'g>, ) -> bool

Returns true if this feature ID should be selected in the graph. Read more
source§

impl<'g, 'a> FeatureFilter<'g> for Box<dyn FeatureFilter<'g> + 'a>

source§

fn accept( &mut self, graph: &FeatureGraph<'g>, feature_id: FeatureId<'g>, ) -> bool

Returns true if this feature ID should be selected in the graph. Read more

Implementations on Foreign Types§

source§

impl<'g, 'a> FeatureFilter<'g> for Box<dyn FeatureFilter<'g> + 'a>

source§

fn accept( &mut self, graph: &FeatureGraph<'g>, feature_id: FeatureId<'g>, ) -> bool

source§

impl<'g, 'a, T> FeatureFilter<'g> for &'a mut T
where T: FeatureFilter<'g>,

source§

fn accept( &mut self, graph: &FeatureGraph<'g>, feature_id: FeatureId<'g>, ) -> bool

Implementors§

source§

impl<'g> FeatureFilter<'g> for StandardFeatures

source§

impl<'g, 'a> FeatureFilter<'g> for &'a mut dyn FeatureFilter<'g>

source§

impl<'g, F> FeatureFilter<'g> for FeatureFilterFn<F>
where F: FnMut(&FeatureGraph<'g>, FeatureId<'g>) -> bool,