fn check_version_supported_or_deprecated(
    property_name: &PropertyName,
    version: &Version,
    as_of_version: &str,
    deprecated_since: &Option<String>,
) -> ValidationResult<()> {
    let property_version = Version::parse(as_of_version)?;

    // compare version of the property and product version
    if property_version > *version {
        return Err(Error::VersionNotSupported {
            property_name: property_name.clone(),
            product_version: version.to_string(),
            required_version: property_version.to_string(),
        });
    }

    // check if requested property is deprecated
    if let Some(deprecated) = deprecated_since {
        let deprecated_since_version = Version::parse(deprecated.as_ref())?;

        if deprecated_since_version <= *version {
            return Err(Error::VersionDeprecated {
                property_name: property_name.clone(),
                product_version: version.to_string(),
                deprecated_version: deprecated_since_version.to_string(),
            });
        }
    }

    Ok(())
}
/// Check if property version is supported or deprecated regarding the product version
///
/// # Arguments
///
/// * `property_name` - name of the property
/// * `product_version` - the current product version
/// * `property_version` - as of version of the provided config property
/// * `deprecated_since` - version from which point onwards the property is deprecated
///
Check if property version is supported or deprecated regarding the product version
Check if property version is supported or deprecated regarding the product version
fn check_version_supported_or_deprecated(
    property_name: &PropertyName,
    version: &Version,
    as_of_version: &str,
    deprecated_since: &Option<String>,
) -> ValidationResult<()> {
    let property_version = Version::parse(as_of_version)?;
    // compare version of the property and product version
    if property_version > *version {
        return Err(Error::VersionNotSupported {
            property_name: property_name.clone(),
            product_version: version.to_string(),
            required_version: property_version.to_string(),
        });
    }
    // check if requested property is deprecated
    if let Some(deprecated) = deprecated_since {
        let deprecated_since_version = Version::parse(deprecated.as_ref())?;
        if deprecated_since_version <= *version {
            return Err(Error::VersionDeprecated {
                property_name: property_name.clone(),
                product_version: version.to_string(),
                deprecated_version: deprecated_since_version.to_string(),
            });
        }
    }
    Ok(())
}
fn check_version_supported_or_deprecated ( property_name : & PropertyName , version : & Version , as_of_version : & str , deprecated_since : & Option < String > , ) -> ValidationResult < ( ) > { let property_version = Version :: parse ( as_of_version ) ? ; // compare version of the property and product version if property_version > * version { return Err ( Error :: VersionNotSupported { property_name : property_name . clone ( ) , product_version : version . to_string ( ) , required_version : property_version . to_string ( ) , } ) ; } // check if requested property is deprecated if let Some ( deprecated ) = deprecated_since { let deprecated_since_version = Version :: parse ( deprecated . as_ref ( ) ) ? ; if deprecated_since_version <= * version { return Err ( Error :: VersionDeprecated { property_name : property_name . clone ( ) , product_version : version . to_string ( ) , deprecated_version : deprecated_since_version . to_string ( ) , } ) ; } } Ok ( ( ) ) }
Check if property version is supported or deprecated regarding the product version
Check if property version is supported or deprecated regarding the product version
property_name
&PropertyName
version
&Version
as_of_version
&str
deprecated_since
&Option<String>