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<'g> Debug for FeatureList<'g>
impl<'g> Debug for FeatureList<'g>
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
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.