Struct guppy::MetadataCommand [−][src]
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
impl MetadataCommand
[src]
pub fn new() -> Self
[src]
Creates a default cargo metadata
command builder.
By default, this will look for Cargo.toml
in the ancestors of this process's current
directory.
pub fn cargo_path(&mut self, path: impl Into<PathBuf>) -> &mut Self
[src]
Sets the path to the cargo
executable.
If unset, this will use the $CARGO
environment variable, or else cargo
from $PATH
.
pub fn manifest_path(&mut self, path: impl Into<PathBuf>) -> &mut Self
[src]
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.
pub fn current_dir(&mut self, path: impl Into<PathBuf>) -> &mut Self
[src]
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
[src]
&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.
pub fn exec(&self) -> Result<CargoMetadata, Error>
[src]
Runs the configured cargo metadata
and returns a deserialized CargoMetadata
.
pub fn build_graph(&self) -> Result<PackageGraph, Error>
[src]
Runs the configured cargo metadata
and returns a parsed PackageGraph
.
Trait Implementations
impl Clone for MetadataCommand
[src]
fn clone(&self) -> MetadataCommand
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for MetadataCommand
[src]
impl Default for MetadataCommand
[src]
fn default() -> MetadataCommand
[src]
impl<'a> TryFrom<&'a MetadataCommand> for PackageGraph
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(command: &'a MetadataCommand) -> Result<Self, Self::Error>
[src]
impl TryFrom<MetadataCommand> for PackageGraph
[src]
Although consuming a MetadataCommand
is not required for building a PackageGraph
, this impl
is provided for convenience.
Auto Trait Implementations
impl RefUnwindSafe for MetadataCommand
[src]
impl Send for MetadataCommand
[src]
impl Sync for MetadataCommand
[src]
impl Unpin for MetadataCommand
[src]
impl UnwindSafe for MetadataCommand
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T> DefaultFeatures<'a> for T where
T: 'a + Clone + Send + Sync,
[src]
T: 'a + Clone + Send + Sync,
pub fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a> + 'a, Global>
[src]
pub fn self_address_mut(&mut self) -> *mut ()
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'a, T> NonSyncFeatures<'a> for T where
T: 'a + Clone,
[src]
T: 'a + Clone,
pub fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a> + 'a, Global>
[src]
pub fn self_address_mut(&mut self) -> *mut ()
[src]
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> SafeBorrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_replacement(ptr: &T) -> &T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,