Struct guppy::graph::cargo::CargoOptions[][src]

pub struct CargoOptions<'a> { /* fields omitted */ }

Options for queries which simulate what Cargo does.

This provides control over the resolution algorithm used by guppy's simulation of Cargo.

Implementations

impl<'a> CargoOptions<'a>[src]

pub fn new() -> Self[src]

Creates a new CargoOptions with this resolver version and default settings.

The default settings are similar to what a plain cargo build does:

  • use version 1 of the Cargo resolver
  • exclude dev-dependencies
  • do not build proc macros specified in the query on the target platform
  • resolve dependencies assuming any possible host or target platform
  • do not omit any packages.

pub fn set_version(&mut self, version: CargoResolverVersion) -> &mut Self[src]

Sets the Cargo feature resolver version.

For more about feature resolution, see the documentation for CargoResolverVersion.

pub fn set_include_dev(&mut self, include_dev: bool) -> &mut Self[src]

If set to true, causes dev-dependencies of the initial set to be followed.

This does not affect transitive dependencies -- for example, a build or dev-dependency's further dev-dependencies are never followed.

The default is true, which matches what a plain cargo build does.

pub fn set_initials_platform(
    &mut self,
    initials_platform: InitialsPlatform
) -> &mut Self
[src]

Configures the way initials are treated on the target and the host.

The default is a "standard" build and this does not usually need to be set, but some advanced use cases may require it. For more about this option, see the documentation for InitialsPlatform.

pub fn set_platform(
    &mut self,
    platform: Option<impl Into<Obs<'a, Platform<'a>>>>
) -> &mut Self
[src]

Sets both the target and host platforms to the provided one, or to evaluate against any platform if None.

This method accepts an owned Platform<'a>, a borrowed &'a Platform<'a> or a shared Arc<Platform<'static>>.

Examples

use guppy::graph::cargo::CargoOptions;
use guppy::Platform;
use std::sync::Arc;

let platform = Platform::current();

// Borrowed platform.
let _ = CargoOptions::new().set_platform(platform.as_ref());

// Owned platform.
let _ = CargoOptions::new().set_platform(platform.clone());

// Shared platform.
let _ = CargoOptions::new().set_platform(platform.map(Arc::new));

pub fn set_target_platform(
    &mut self,
    target_platform: Option<impl Into<Obs<'a, Platform<'a>>>>
) -> &mut Self
[src]

Sets the target platform to the provided one, or to evaluate against any platform if None.

This method accepts an owned Platform<'a>, a borrowed &'a Platform<'a> or a shared Arc<Platform<'static>>.

pub fn set_host_platform(
    &mut self,
    host_platform: Option<impl Into<Obs<'a, Platform<'a>>>>
) -> &mut Self
[src]

Sets the host platform to the provided one, or to evaluate against any platform if None.

This method accepts an owned Platform<'a>, a borrowed &'a Platform<'a> or a shared Arc<Platform<'static>>.

pub fn add_omitted_packages(
    &mut self,
    package_ids: impl IntoIterator<Item = &'a PackageId>
) -> &mut Self
[src]

Omits edges into the given packages.

This may be useful in order to figure out what additional dependencies or features a particular set of packages pulls in.

This method is additive.

Trait Implementations

impl<'a> Clone for CargoOptions<'a>[src]

impl<'a> Debug for CargoOptions<'a>[src]

impl<'a> Default for CargoOptions<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for CargoOptions<'a>[src]

impl<'a> Send for CargoOptions<'a>[src]

impl<'a> Sync for CargoOptions<'a>[src]

impl<'a> Unpin for CargoOptions<'a>[src]

impl<'a> !UnwindSafe for CargoOptions<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> DefaultFeatures<'a> for T where
    T: 'a + Clone + Send + Sync
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'a, T> NonSyncFeatures<'a> for T where
    T: 'a + Clone
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> SafeBorrow<T> for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,