Skip to main content

FilterTree

Trait FilterTree 

Source
pub trait FilterTree {
    // Required methods
    fn filter_by_patterns<'a>(
        &'a self,
        tree: &'a Tree<'a>,
        patterns: &[&str],
    ) -> Result<Tree<'a>, Error>;
    fn filter_by_attributes<'a>(
        &'a self,
        tree: &'a Tree<'a>,
        attributes: &[&str],
    ) -> Result<Tree<'a>, Error>;
}

Required Methods§

Source

fn filter_by_patterns<'a>( &'a self, tree: &'a Tree<'a>, patterns: &[&str], ) -> Result<Tree<'a>, Error>

Filters tree entries by gitattributes-style patterns and returns a new tree with contents filtered through the provided patterns. Recursively walks the tree and matches patterns against full paths from the tree root.

The patterns type is an array of string slices and not a glob type because Git has specific glob syntax that differs from standard shell syntax.

Source

fn filter_by_attributes<'a>( &'a self, tree: &'a Tree<'a>, attributes: &[&str], ) -> Result<Tree<'a>, Error>

Filters tree entries by gitattributes and returns a new tree with contents filtered. Recursively walks the tree and matches attributes against full paths from the tree root.

The attributes type is an array of string slices. For attributes which haves values, not simply set or unset, use typical .gitattributes syntax.

Implementors§