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.
pub fn other_options(
&mut self,
options: impl IntoIterator<Item = impl Into<String>>
) -> &mut Self
pub fn other_options(
&mut self,
options: impl IntoIterator<Item = impl Into<String>>
) -> &mut Self
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 1as its metadata format. - passes in
--all-features, so thatguppyhas 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 the “default value” for a type. Read more
Although consuming a MetadataCommand is not required for building a PackageGraph, this impl
is provided for convenience.
Auto Trait Implementations
impl RefUnwindSafe for MetadataCommand
impl Send for MetadataCommand
impl Sync for MetadataCommand
impl Unpin for MetadataCommand
impl UnwindSafe for MetadataCommand
Blanket Implementations
Mutably borrows from an owned value. Read more