Struct guppy::MetadataCommand[][src]

pub struct MetadataCommand { /* fields omitted */ }
Expand description

A builder for configuring cargo metadata invocations.

This is the most common entry point for constructing a PackageGraph.

Examples

Build a PackageGraph for the Cargo workspace in the current directory:

use guppy::MetadataCommand;
use guppy::graph::PackageGraph;

let mut cmd = MetadataCommand::new();
let package_graph = PackageGraph::from_command(&mut cmd);

Implementations

Creates a default cargo metadata command builder.

By default, this will look for Cargo.toml in the ancestors of this process’s current directory.

Sets the path to the cargo executable.

If unset, this will use the $CARGO environment variable, or else cargo from $PATH.

Sets the path to Cargo.toml.

By default, this will look for Cargo.toml in the ancestors of the current directory. Note that this doesn’t need to be the root Cargo.toml in a workspace – any member of the workspace is fine.

Sets the current directory of the cargo metadata process.

By default, the current directory will be inherited from this process.

Output information only about the workspace and do not fetch dependencies.

For full functionality, cargo metadata should be run without --no-deps, so that guppy knows about third-party crates and dependency edges. However, guppy supports a “light” mode if --no-deps is run, in which case the following limitations will apply:

  • dependency queries will not work
  • there will be no information about non-workspace crates

Constructing a graph with this option can be several times faster than the default.

Arbitrary flags to pass to cargo metadata. These will be added to the end of the command invocation.

Note that guppy internally:

  • uses --format-version 1 as its metadata format.
  • passes in --all-features, so that guppy has a full view of the dependency graph.

Attempting to override either of those options may lead to unexpected results.

Runs the configured cargo metadata and returns a deserialized CargoMetadata.

Runs the configured cargo metadata and returns a parsed PackageGraph.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Although consuming a MetadataCommand is not required for building a PackageGraph, this impl is provided for convenience.

The type returned in the event of a conversion error.

Performs the conversion.

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

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.