pub struct FeatureList<'g> { /* private fields */ }
Expand description
A sorted, deduplicated list of features from a single package.
This provides a convenient way to query and print out lists of features.
Returned by methods on FeatureSet
.
Implementations§
source§impl<'g> FeatureList<'g>
impl<'g> FeatureList<'g>
sourcepub fn new(
package: PackageMetadata<'g>,
labels: impl IntoIterator<Item = FeatureLabel<'g>>,
) -> Self
pub fn new( package: PackageMetadata<'g>, labels: impl IntoIterator<Item = FeatureLabel<'g>>, ) -> Self
Creates a new FeatureList
from a package and an iterator over feature labels.
sourcepub fn package(&self) -> &PackageMetadata<'g>
pub fn package(&self) -> &PackageMetadata<'g>
Returns the package corresponding to this feature list.
sourcepub fn contains(&self, label: FeatureLabel<'_>) -> bool
pub fn contains(&self, label: FeatureLabel<'_>) -> bool
Returns true if this feature list contains this feature label.
sourcepub fn has_base(&self) -> bool
pub fn has_base(&self) -> bool
Returns true if this feature list contains the “base” feature.
The “base” feature represents the package with no features enabled.
sourcepub fn has_named_feature(&self, feature_name: &str) -> bool
pub fn has_named_feature(&self, feature_name: &str) -> bool
Returns true if this feature list contains the specified named feature.
sourcepub fn has_optional_dependency(&self, dep_name: &str) -> bool
pub fn has_optional_dependency(&self, dep_name: &str) -> bool
Returns true if this feature list contains the specified optional dependency.
sourcepub fn labels(&self) -> &[FeatureLabel<'g>]
pub fn labels(&self) -> &[FeatureLabel<'g>]
Returns the list of labels as a slice.
This slice is guaranteed to be sorted and unique.
sourcepub fn named_features(&self) -> impl Iterator<Item = &'g str> + '_
pub fn named_features(&self) -> impl Iterator<Item = &'g str> + '_
Returns an iterator containing all named features.
The iterator is guaranteed to be sorted and unique.
sourcepub fn optional_deps(&self) -> impl Iterator<Item = &'g str> + '_
pub fn optional_deps(&self) -> impl Iterator<Item = &'g str> + '_
Returns an iterator containing all optional dependencies.
The iterator is guaranteed to be sorted and unique.
sourcepub fn display_features<'a>(&'a self) -> DisplayFeatures<'g, 'a>
pub fn display_features<'a>(&'a self) -> DisplayFeatures<'g, 'a>
Returns a pretty-printer over the list of feature labels.
sourcepub fn into_labels(self) -> Vec<FeatureLabel<'g>>
pub fn into_labels(self) -> Vec<FeatureLabel<'g>>
Returns a vector of feature labels.
The vector is guaranteed to be sorted and unique.
Trait Implementations§
source§impl<'g> Clone for FeatureList<'g>
impl<'g> Clone for FeatureList<'g>
source§fn clone(&self) -> FeatureList<'g>
fn clone(&self) -> FeatureList<'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 FeatureList<'_>
impl Debug for FeatureList<'_>
source§impl<'a, 'g> IntoIterator for &'a FeatureList<'g>
impl<'a, 'g> IntoIterator for &'a FeatureList<'g>
source§impl<'g> IntoIterator for FeatureList<'g>
impl<'g> IntoIterator for FeatureList<'g>
source§impl<'g> PartialEq for FeatureList<'g>
impl<'g> PartialEq for FeatureList<'g>
impl<'g> Eq for FeatureList<'g>
impl<'g> StructuralPartialEq for FeatureList<'g>
Auto Trait Implementations§
impl<'g> Freeze for FeatureList<'g>
impl<'g> RefUnwindSafe for FeatureList<'g>
impl<'g> Send for FeatureList<'g>
impl<'g> Sync for FeatureList<'g>
impl<'g> Unpin for FeatureList<'g>
impl<'g> UnwindSafe for FeatureList<'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
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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