guppy::graph::feature

Trait 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,