Struct cargo::ops::tree::graph::Graph

source ·
pub struct Graph<'a> {
    nodes: Vec<Node>,
    edges: Vec<Edges>,
    index: HashMap<Node, usize>,
    package_map: HashMap<PackageId, &'a Package>,
    cli_features: HashSet<usize>,
    dep_name_map: HashMap<usize, HashMap<InternedString, HashSet<(usize, bool)>>>,
}
Expand description

A graph of dependencies.

Fields§

§nodes: Vec<Node>§edges: Vec<Edges>

The indexes of edges correspond to the nodes. That is, edges[0] is the set of outgoing edges for nodes[0]. They should always be in sync.

§index: HashMap<Node, usize>

Index maps a node to an index, for fast lookup.

§package_map: HashMap<PackageId, &'a Package>

Map for looking up packages.

§cli_features: HashSet<usize>

Set of indexes of feature nodes that were added via the command-line.

For example --features foo will mark the “foo” node here.

§dep_name_map: HashMap<usize, HashMap<InternedString, HashSet<(usize, bool)>>>

Map of dependency names, used for building internal feature map for dep_name/feat_name syntax.

Key is the index of a package node, value is a map of dep_name to a set of (pkg_node_index, is_optional).

Implementations§

Adds a new node to the graph, returning its new index.

Returns a list of nodes the given node index points to for the given kind.

Returns true if the given node has any outgoing edges.

Gets a node by index.

Given a slice of PackageIds, returns the indexes of all nodes that match.

Returns true if the given feature node index is a feature enabled via the command-line.

Returns a new graph by removing all nodes not reachable from the given nodes.

Inverts the direction of all edges.

Returns a list of nodes that are considered “duplicates” (same package name, with different versions/features/source/etc.).

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 240 bytes