pub struct FeatureId<'g> { /* private fields */ }
Expand description

An identifier for a (package, feature) pair in a feature graph.

Returned by various methods on FeatureGraph and FeatureQuery.

From impls are available for (&'g PackageId, &'g str) and (&'g PackageId, Option<&'g str>) tuples.

Implementations

Creates a new FeatureId with the given PackageId and FeatureLabel.

Creates a new FeatureId representing a named feature in the [features] section, or an implicit named feature created by an optional dependency.

Creates a new FeatureId representing an optional dependency.

Creates a new FeatureId representing the base feature for a package.

Returns the package ID.

Returns the FeatureLabel associated with the feature.

Returns true if this is the base feature for the package.

Returns true if this is an optional dependency.

Returns true if this is a named feature.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The Display impl prints out:

  • {package-id}/[base] for base features.
  • {package-id}/feature-name for named features.
  • {package-id}/dep:dep-name for optional dependencies.
Examples
use guppy::PackageId;
use guppy::graph::feature::FeatureId;

let package_id = PackageId::new("region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)");

assert_eq!(
    format!("{}", FeatureId::base(&package_id)),
    "region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)/[base]"
);

assert_eq!(
    format!("{}", FeatureId::named(&package_id, "foo")),
    "region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)/foo"
);

assert_eq!(
    format!("{}", FeatureId::optional_dependency(&package_id, "bar")),
    "region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)/dep:bar"
);

Formats the value using the given formatter. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.