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
sourceimpl<'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 iter<'a>(&'a self) -> Iter<'g, 'a>ⓘNotable traits for Iter<'g, 'a>impl<'g, 'a> Iterator for Iter<'g, 'a> type Item = FeatureId<'g>;
pub fn iter<'a>(&'a self) -> Iter<'g, 'a>ⓘNotable traits for Iter<'g, 'a>impl<'g, 'a> Iterator for Iter<'g, 'a> type Item = FeatureId<'g>;
Returns a borrowed iterator over feature IDs.
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>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn into_labels(self) -> Vec<FeatureLabel<'g>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns a vector of feature labels.
The vector is guaranteed to be sorted and unique.
Trait Implementations
sourceimpl<'g> Clone for FeatureList<'g>
impl<'g> Clone for FeatureList<'g>
sourcefn clone(&self) -> FeatureList<'g>
fn clone(&self) -> FeatureList<'g>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'g> Debug for FeatureList<'g>
impl<'g> Debug for FeatureList<'g>
sourceimpl<'g> IntoIterator for FeatureList<'g>
impl<'g> IntoIterator for FeatureList<'g>
sourceimpl<'a, 'g> IntoIterator for &'a FeatureList<'g>
impl<'a, 'g> IntoIterator for &'a FeatureList<'g>
sourceimpl<'g> PartialEq<FeatureList<'g>> for FeatureList<'g>
impl<'g> PartialEq<FeatureList<'g>> for FeatureList<'g>
sourcefn eq(&self, other: &FeatureList<'g>) -> bool
fn eq(&self, other: &FeatureList<'g>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &FeatureList<'g>) -> bool
fn ne(&self, other: &FeatureList<'g>) -> bool
This method tests for !=
.
impl<'g> Eq for FeatureList<'g>
impl<'g> StructuralEq for FeatureList<'g>
impl<'g> StructuralPartialEq for FeatureList<'g>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more