fn parse<T: FromStr>(property_name: &PropertyName, to_parse: &str) -> Result<T, Error> {
    match to_parse.parse::<T>() {
        Ok(to_parse) => Ok(to_parse),
        Err(_) => {
            return Err(Error::DatatypeNotMatching {
                property_name: property_name.clone(),
                value: to_parse.to_string(),
                datatype: std::any::type_name::<T>().to_string(),
            })
        }
    }
}
/// Parse a value to a certain datatype and throw error if parsing not possible
///
/// # Arguments
///
/// * `property_name` - name of the property
/// * `to_parse` - value to be parsed into a certain T
///
Parse a value to a certain datatype and throw error if parsing not possible
Parse a value to a certain datatype and throw error if parsing not possible
fn parse<T: FromStr>(property_name: &PropertyName, to_parse: &str) -> Result<T, Error> {
    match to_parse.parse::<T>() {
        Ok(to_parse) => Ok(to_parse),
        Err(_) => {
            return Err(Error::DatatypeNotMatching {
                property_name: property_name.clone(),
                value: to_parse.to_string(),
                datatype: std::any::type_name::<T>().to_string(),
            })
        }
    }
}
fn parse < T : FromStr > ( property_name : & PropertyName , to_parse : & str ) -> Result < T , Error > { match to_parse . parse :: < T > ( ) { Ok ( to_parse ) => Ok ( to_parse ) , Err ( _ ) => { return Err ( Error :: DatatypeNotMatching { property_name : property_name . clone ( ) , value : to_parse . to_string ( ) , datatype : std :: any :: type_name :: < T > ( ) . to_string ( ) , } ) } } }
Parse a value to a certain datatype and throw error if parsing not possible
Parse a value to a certain datatype and throw error if parsing not possible
property_name
&PropertyName
to_parse
&str