Skip to content

Commit

Permalink
fix: feature_mut docs (#2374)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian authored Oct 30, 2024
1 parent 9502d59 commit b2d5d60
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions crates/pixi_manifest/src/manifests/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,20 +660,21 @@ impl Manifest {
self.parsed.default_feature_mut()
}

/// Returns the mutable feature with the given name or `None` if it does not
/// Returns the mutable feature with the given name or `Err` if it does not
/// exist.
pub fn feature_mut<Q>(&mut self, name: &Q) -> miette::Result<&mut Feature>
where
Q: ?Sized + Hash + Equivalent<FeatureName> + Display,
{
self.parsed
.features
.get_mut(name)
.ok_or_else(|| miette!("Feature `{name}` does not exist"))
self.parsed.features.get_mut(name).ok_or_else(|| {
miette!(
"Feature {} does not exist",
consts::FEATURE_STYLE.apply_to(name)
)
})
}

/// Returns the mutable feature with the given name or `None` if it does not
/// exist.
/// Returns the mutable feature with the given name
pub fn get_or_insert_feature_mut(&mut self, name: &FeatureName) -> &mut Feature {
self.parsed
.features
Expand Down

0 comments on commit b2d5d60

Please sign in to comment.