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
)