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

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 with_version(self, version: CargoResolverVersion) -> Self[src]

Sets the Cargo feature resolver version.

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

pub fn with_dev_deps(self, include_dev: bool) -> 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 with_proc_macros_on_target(self, proc_macros_on_target: bool) -> Self[src]

If set to true, causes procedural macros (and transitive dependencies) specified in the initial set to be built on the host platform as well, not just the target platform.

Procedural macros are typically not built on the target platform, but if they contain binary or test targets they will be.

Procedural macros that are dependencies of the initial set will only be built on the host platform, regardless of whether this configuration is set.

pub fn with_platform(self, platform: Option<impl Obs<'a, Platform<'a>>>) -> 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().with_platform(platform.as_ref());

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

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

pub fn with_target_platform(
    self,
    target_platform: Option<impl Obs<'a, Platform<'a>>>
) -> 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 with_host_platform(
    self,
    host_platform: Option<impl Obs<'a, Platform<'a>>>
) -> 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 with_omitted_packages(
    self,
    package_ids: impl IntoIterator<Item = &'a PackageId>
) -> 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>

impl<'a> Send for CargoOptions<'a>

impl<'a> Sync for CargoOptions<'a>

impl<'a> Unpin for CargoOptions<'a>

impl<'a> !UnwindSafe for CargoOptions<'a>

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>,