pub struct EnabledStatus<'g> { /* private fields */ }
Expand description
Whether a dependency or feature is required, optional, or disabled.
Returned by the methods on DependencyMetadata
.
§Examples
[dependencies]
once_cell = "1"
The dependency and default features are required on all platforms.
[dependencies]
once_cell = { version = "1", optional = true }
The dependency and default features are optional on all platforms.
[target.'cfg(windows)'.dependencies]
once_cell = { version = "1", optional = true }
The result is platform-dependent. On Windows, the dependency and default features are both optional. On non-Windows platforms, the dependency and default features are disabled.
[dependencies]
once_cell = { version = "1", optional = true }
[target.'cfg(windows)'.dependencies]
once_cell = { version = "1", optional = false, default-features = false }
The result is platform-dependent. On Windows, the dependency is mandatory and default features
are optional (i.e. enabled if the once_cell
feature is turned on).
On Unix platforms, the dependency and default features are both optional.
Implementations§
source§impl<'g> EnabledStatus<'g>
impl<'g> EnabledStatus<'g>
sourcepub fn is_never(&self) -> bool
pub fn is_never(&self) -> bool
Returns true if this dependency is never enabled on any platform.
sourcepub fn required_on(&self, platform_spec: &PlatformSpec) -> EnabledTernary
pub fn required_on(&self, platform_spec: &PlatformSpec) -> EnabledTernary
Evaluates whether this dependency is required on the given platform spec.
Returns Unknown
if the result was unknown, which may happen if evaluating against an
individual platform and its target features are unknown.
sourcepub fn enabled_on(&self, platform_spec: &PlatformSpec) -> EnabledTernary
pub fn enabled_on(&self, platform_spec: &PlatformSpec) -> EnabledTernary
Evaluates whether this dependency is enabled (required or optional) on the given platform spec.
Returns Unknown
if the result was unknown, which may happen if evaluating against an
individual platform and its target features are unknown.
sourcepub fn required_status(&self) -> PlatformStatus<'g>
pub fn required_status(&self) -> PlatformStatus<'g>
Returns the PlatformStatus
corresponding to whether this dependency is required.
sourcepub fn optional_status(&self) -> PlatformStatus<'g>
pub fn optional_status(&self) -> PlatformStatus<'g>
Returns the PlatformStatus
corresponding to whether this dependency is optional.
Trait Implementations§
source§impl<'g> Clone for EnabledStatus<'g>
impl<'g> Clone for EnabledStatus<'g>
source§fn clone(&self) -> EnabledStatus<'g>
fn clone(&self) -> EnabledStatus<'g>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'g> Debug for EnabledStatus<'g>
impl<'g> Debug for EnabledStatus<'g>
impl<'g> Copy for EnabledStatus<'g>
Auto Trait Implementations§
impl<'g> Freeze for EnabledStatus<'g>
impl<'g> RefUnwindSafe for EnabledStatus<'g>
impl<'g> Send for EnabledStatus<'g>
impl<'g> Sync for EnabledStatus<'g>
impl<'g> Unpin for EnabledStatus<'g>
impl<'g> UnwindSafe for EnabledStatus<'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