mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
add is_inherited methods to InheritableDependency and InheritableField (#15828)
I was looking into adding cargo_util_schemas as a parsing backend for crates-io and this was a little method I found myself missing a lot.
This commit is contained in:
commit
6bf996c866
@ -351,6 +351,10 @@ impl<T> InheritableField<T> {
|
||||
InheritableField::Value(defined) => Some(defined),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_inherited(&self) -> bool {
|
||||
matches!(self, Self::Inherit(_))
|
||||
}
|
||||
}
|
||||
|
||||
//. This already has a `Deserialize` impl from version_trim_whitespace
|
||||
@ -675,6 +679,10 @@ impl InheritableDependency {
|
||||
InheritableDependency::Inherit(_) => Err(UnresolvedError),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_inherited(&self) -> bool {
|
||||
matches!(self, InheritableDependency::Inherit(_))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> de::Deserialize<'de> for InheritableDependency {
|
||||
|
Loading…
x
Reference in New Issue
Block a user