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.
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 1
as its metadata format. - passes in
--all-features
, so thatguppy
has a full view of the dependency graph. - does not pass in
--no-deps
, so thatguppy
knows about non-workspace dependencies.
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
Given ptr
, which was obtained from a prior call to Self::borrow()
,
return a value with the same nominal lifetime which is guaranteed to
survive mutations to Self
. Read more