Struct guppy::graph::feature::feature_list::FeatureList
source · 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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default 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.