Trait BasicSourceControlGraph

Source
pub trait BasicSourceControlGraph: Debug {
    type Node: Clone + Debug + Hash + Eq + 'static;
    type Error: Debug + Error + 'static;

    // Required methods
    fn ancestors(
        &self,
        node: Self::Node,
    ) -> Result<HashSet<Self::Node>, Self::Error>;
    fn descendants(
        &self,
        node: Self::Node,
    ) -> Result<HashSet<Self::Node>, Self::Error>;

    // Provided methods
    fn ancestors_all(
        &self,
        nodes: HashSet<Self::Node>,
    ) -> Result<HashSet<Self::Node>, Self::Error> { ... }
    fn ancestor_heads(
        &self,
        nodes: HashSet<Self::Node>,
    ) -> Result<HashSet<Self::Node>, Self::Error> { ... }
    fn descendant_roots(
        &self,
        nodes: HashSet<Self::Node>,
    ) -> Result<HashSet<Self::Node>, Self::Error> { ... }
    fn descendants_all(
        &self,
        nodes: HashSet<Self::Node>,
    ) -> Result<HashSet<Self::Node>, Self::Error> { ... }
}
Expand description

Directed acyclic graph commonly used in source control.

Implementation of Graph that represents the common case of a directed acyclic graph in source control. You can implement this trait instead of Graph (as there is a blanket implementation for Graph) and also make use of BasicStrategy.

Required Associated Types§

Source

type Node: Clone + Debug + Hash + Eq + 'static

The type of nodes in the graph. This should be cheap to clone.

Source

type Error: Debug + Error + 'static

An error type.

Required Methods§

Source

fn ancestors( &self, node: Self::Node, ) -> Result<HashSet<Self::Node>, Self::Error>

Get every node X in the graph such that X == node or there exists a child of X that is an ancestor of node.

Source

fn descendants( &self, node: Self::Node, ) -> Result<HashSet<Self::Node>, Self::Error>

Get every node X in the graph such that X == node or there exists a parent of X that is a descendant of node.

Provided Methods§

Source

fn ancestors_all( &self, nodes: HashSet<Self::Node>, ) -> Result<HashSet<Self::Node>, Self::Error>

Get the union of ancestors(node) for every node in nodes.

Source

fn ancestor_heads( &self, nodes: HashSet<Self::Node>, ) -> Result<HashSet<Self::Node>, Self::Error>

Filter nodes to only include nodes that are not ancestors of any other node in nodes.

Source

fn descendant_roots( &self, nodes: HashSet<Self::Node>, ) -> Result<HashSet<Self::Node>, Self::Error>

Filter nodes to only include nodes that are not descendants of any other node in nodes.

Source

fn descendants_all( &self, nodes: HashSet<Self::Node>, ) -> Result<HashSet<Self::Node>, Self::Error>

Get the union of descendants(node) for every node in nodes.

Implementors§