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

A feature dependency that is conditionally activated.

A ConditionalLink is typically a link across packages. For example:

[package]
name = "main"

[dependencies]
dep = { ... }

[dev-dependencies]
dev-dep = { ... }

[target.'cfg(unix)'.dependencies]
unix-dep = { ... }

[features]
feat = ["dep/feat", "dev-dep/feat", "unix-dep/feat"]

In this example, there are ConditionalLinks from main/feat to dep/feat, dev-dep/feat and unix-dep/feat. Each link is only activated if the conditions for it are met. For example, the link to dev-dep/feat is only followed if Cargo is interested in dev-dependencies of main.

If a dependency, for example unix-dep above, is optional, an implicit feature is created in the package main with the name unix-dep. In this case, the dependency from main/feat to main/unix-dep is also a ConditionalLink representing the same cfg(unix) condition.

Implementations§

Returns the feature which depends on the to feature.

Returns the feature which is depended on by the from feature.

Returns the endpoints as a pair of features (from, to).

Returns details about this feature dependency from the [dependencies] section.

Returns details about this feature dependency from the [build-dependencies] section.

Returns details about this feature dependency from the [dev-dependencies] section.

Returns details about this feature dependency from the section specified by the given dependency kind.

Returns true if this edge is dev-only, i.e. code from this edge will not be included in normal builds.

Returns the PackageLink from which this ConditionalLink was derived.

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

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

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
Uses borrowed data to replace owned data, usually by cloning. 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.