fn check_allowed_values(
    property_name: &PropertyName,
    property_value: &str,
    allowed_values: &Option<Vec<String>>,
) -> ValidationResult<()> {
    if allowed_values.is_some() {
        let allowed_values = allowed_values.clone().unwrap();
        if !allowed_values.is_empty() && !allowed_values.contains(&property_value.to_string()) {
            return Err(Error::PropertyValueNotInAllowedValues {
                property_name: property_name.clone(),
                value: property_value.to_string(),
                allowed_values,
            });
        }
    }
    Ok(())
}
/// Check if property value is in allowed values
/// # Arguments
///
/// * `property_name` - name of the property
/// * `property_value` - property value to be validated
/// * `allowed_values` - vector of allowed values
///
Check if property value is in allowed values
Check if property value is in allowed values
fn check_allowed_values(
    property_name: &PropertyName,
    property_value: &str,
    allowed_values: &Option<Vec<String>>,
) -> ValidationResult<()> {
    if allowed_values.is_some() {
        let allowed_values = allowed_values.clone().unwrap();
        if !allowed_values.is_empty() && !allowed_values.contains(&property_value.to_string()) {
            return Err(Error::PropertyValueNotInAllowedValues {
                property_name: property_name.clone(),
                value: property_value.to_string(),
                allowed_values,
            });
        }
    }
    Ok(())
}
fn check_allowed_values ( property_name : & PropertyName , property_value : & str , allowed_values : & Option < Vec < String > > , ) -> ValidationResult < ( ) > { if allowed_values . is_some ( ) { let allowed_values = allowed_values . clone ( ) . unwrap ( ) ; if ! allowed_values . is_empty ( ) && ! allowed_values . contains ( & property_value . to_string ( ) ) { return Err ( Error :: PropertyValueNotInAllowedValues { property_name : property_name . clone ( ) , value : property_value . to_string ( ) , allowed_values , } ) ; } } Ok ( ( ) ) }
Check if property value is in allowed values
Check if property value is in allowed values
property_name
&PropertyName
property_value
&str
allowed_values
&Option<Vec<String>>