Struct guppy::graph::feature::ConditionalLink
source · 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 ConditionalLink
s 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§
source§impl<'g> ConditionalLink<'g>
impl<'g> ConditionalLink<'g>
sourcepub fn from(&self) -> FeatureMetadata<'g>
pub fn from(&self) -> FeatureMetadata<'g>
Returns the feature which depends on the to
feature.
sourcepub fn to(&self) -> FeatureMetadata<'g>
pub fn to(&self) -> FeatureMetadata<'g>
Returns the feature which is depended on by the from
feature.
sourcepub fn endpoints(&self) -> (FeatureMetadata<'g>, FeatureMetadata<'g>)
pub fn endpoints(&self) -> (FeatureMetadata<'g>, FeatureMetadata<'g>)
Returns the endpoints as a pair of features (from, to)
.
sourcepub fn normal(&self) -> PlatformStatus<'g>
pub fn normal(&self) -> PlatformStatus<'g>
Returns details about this feature dependency from the [dependencies]
section.
sourcepub fn build(&self) -> PlatformStatus<'g>
pub fn build(&self) -> PlatformStatus<'g>
Returns details about this feature dependency from the [build-dependencies]
section.
sourcepub fn dev(&self) -> PlatformStatus<'g>
pub fn dev(&self) -> PlatformStatus<'g>
Returns details about this feature dependency from the [dev-dependencies]
section.
sourcepub fn status_for_kind(&self, kind: DependencyKind) -> PlatformStatus<'g>
pub fn status_for_kind(&self, kind: DependencyKind) -> PlatformStatus<'g>
Returns details about this feature dependency from the section specified by the given dependency kind.
sourcepub fn dev_only(&self) -> bool
pub fn dev_only(&self) -> bool
Returns true if this edge is dev-only, i.e. code from this edge will not be included in normal builds.
sourcepub fn package_link(&self) -> PackageLink<'g>
pub fn package_link(&self) -> PackageLink<'g>
Returns the PackageLink
from which this ConditionalLink
was derived.
Trait Implementations§
source§impl<'g> Clone for ConditionalLink<'g>
impl<'g> Clone for ConditionalLink<'g>
source§fn clone(&self) -> ConditionalLink<'g>
fn clone(&self) -> ConditionalLink<'g>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ConditionalLink<'_>
impl Debug for ConditionalLink<'_>
impl<'g> Copy for ConditionalLink<'g>
Auto Trait Implementations§
impl<'g> Freeze for ConditionalLink<'g>
impl<'g> RefUnwindSafe for ConditionalLink<'g>
impl<'g> Send for ConditionalLink<'g>
impl<'g> Sync for ConditionalLink<'g>
impl<'g> Unpin for ConditionalLink<'g>
impl<'g> UnwindSafe for ConditionalLink<'g>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more