refactor(toml): Move accessor to be part of schema API

This commit is contained in:
Ed Page 2023-11-18 21:48:35 -06:00
parent 512ce788c5
commit 7e4d0a6149
2 changed files with 9 additions and 7 deletions

View File

@ -1568,13 +1568,6 @@ impl<T> schema::InheritableField<T> {
}),
}
}
fn as_value(&self) -> Option<&T> {
match self {
schema::InheritableField::Inherit(_) => None,
schema::InheritableField::Value(defined) => Some(defined),
}
}
}
impl schema::InheritableDependency {

View File

@ -170,6 +170,15 @@ pub enum InheritableField<T> {
Inherit(TomlInheritedField),
}
impl<T> InheritableField<T> {
pub fn as_value(&self) -> Option<&T> {
match self {
InheritableField::Inherit(_) => None,
InheritableField::Value(defined) => Some(defined),
}
}
}
//. This already has a `Deserialize` impl from version_trim_whitespace
pub type InheritableSemverVersion = InheritableField<semver::Version>;
impl<'de> de::Deserialize<'de> for InheritableSemverVersion {